Browse Source

Initial support for building with gradle.

master
Reece H. Dunn 12 years ago
parent
commit
9fc815cf9b
5 changed files with 82 additions and 20 deletions
  1. 7
    0
      .gitignore
  2. 9
    3
      Makefile.am
  3. 38
    17
      README.md
  4. 27
    0
      android/build.gradle
  5. 1
    0
      android/settings.gradle

+ 7
- 0
.gitignore View File

@@ -18,6 +18,13 @@ libttsespeak.so
android/res/raw/espeakdata.zip
android/res/raw/espeakdata_version

local.properties

# android gradle output:

.gradle/
build/

# autotools

AUTHORS

+ 9
- 3
Makefile.am View File

@@ -23,7 +23,7 @@ EXTRA_DIST += ChangeLog

##### standard build actions:

all: src/speak src/libespeak.so src/libespeak.a src/espeak src/espeakedit espeak-data/phontab dictionaries docs/speak_lib.h
all: jni espeakdata apk-release

install:
cd src && make DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) BINDIR=$(BINDIR) INCDIR=$(INCDIR) LIBDIR=$(LIBDIR) install && cd ..
@@ -31,6 +31,7 @@ install:

clean:
cd src && rm -f *.o *~ && cd ..
cd android && gradle clean

distclean: clean
cd src && rm -f libespeak.a libespeak.so.* speak espeak espeakedit && cd ..
@@ -123,6 +124,12 @@ espeak-data/phontab: src/espeakedit espeak-data/dictsource/dir.stamp espeak-data
jni:
cd android && ndk-build

apk-release:
cd android && gradle assembleRelease

apk-debug:
cd android && gradle assembleDebug

android/res/raw/espeakdata.zip: espeak-data/phontab dictionaries
mkdir -pv android/res/raw
rm -f $@
@@ -133,8 +140,7 @@ android/res/raw/espeakdata.zip: espeak-data/phontab dictionaries
android/res/raw/espeakdata_version: android/res/raw/espeakdata.zip
sha1sum $< | awk '{ print $$1 }' > $@

android: \
jni \
espeakdata: \
android/res/raw/espeakdata.zip \
android/res/raw/espeakdata_version


+ 38
- 17
README.md View File

@@ -17,40 +17,59 @@ If you are building with Eclipse, you will also need:
1. Eclipse
2. Android Developer Tools (ADT) for Eclipse

If you are building on the command line, you will also need:
If you are building on the command line, you will also need either:

1. ant (e.g. run `sudo apt-get install ant` on a Debian-based distribution)
1. ant (e.g. run `sudo apt-get install ant` on a Debian-based distribution), or
2. gradle 1.6, which can be installed from the
[Ubuntu PPA](https://launchpad.net/~cwchien/+archive/gradle/+files/gradle_1.6-0ubuntu1_all.deb)
debian file (including on Debian systems)

## Building eSpeak
## Building with Gradle

The eSpeak language data file and the JNI bindings needed for the Android
APK can be build using the following commands:
1. Set the location of the Android SDK:

$ ./autogen.sh
$ ./configure --prefix=/usr
$ make android
$ export ANDROID_HOME=<path-to-sdk>
2. Build the project:

## Building the APK with Eclipse
$ ./autogen.sh
$ ./configure
$ make

1. Open Eclipse.
2. Create a new workspace.
3. Import the espeak folder as an exising Android project.
4. Build the espeak apk within Eclipse.
This will create an `android/build/apk/espeak-release-unsigned.apk` file.

## Building with Eclipse

1. Build the JNI binding and espeak data file by running:

$ ./autogen.sh
$ ./configure
$ make jni espeakdata
2. Open Eclipse.
3. Create a new workspace.
4. Import the espeak folder as an exising Android project.
5. Build the espeak apk within Eclipse.

The generated `eSpeakActivity.apk` can be installed like any other apk build
via eclipse, such as by using the `Run` menu option.

## Building the APK from the Command Line
## Building with Ant

1. Update the project using the Android utility which is part of the SDK:
1. Build the JNI binding and espeak data file by running:

$ ./autogen.sh
$ ./configure
$ make jni espeakdata
2. Update the project using the Android utility which is part of the SDK:

$ cd android
$ android update project -s -t 1 -p .
2. Build the package.
3. Build the package.

$ ant release

In order to install the built `bin/eSpeakActivity-release-unsigned.apk` APK,
## Signing the APK

In order to install the built APK (e.g. `bin/eSpeakActivity-release-unsigned.apk`)
you need to self-sign the package. You can do this by:

1. Creating a certificate, if you do not already have one:
@@ -66,6 +85,8 @@ you need to self-sign the package. You can do this by:
$ zipalign 4 bin/eSpeakActivity-release-unsigned.apk \
bin/eSpeakActivity-release-signed.apk

## Installing the APK

Now, you can install the APK using the `adb` tool:

$ adb install -r bin/eSpeakActivity-release-signed.apk

+ 27
- 0
android/build.gradle View File

@@ -0,0 +1,27 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}

apply plugin: 'android'

android {
buildToolsVersion '17.0'
compileSdkVersion 17

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}

tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
pkgTask -> pkgTask.jniDir new File(projectDir, 'libs')
}

+ 1
- 0
android/settings.gradle View File

@@ -0,0 +1 @@
rootProject.name = 'espeak'

Loading…
Cancel
Save