Skip to content

Commit 9fc815c

Browse files
committed
Initial support for building with gradle.
1 parent 6f085e7 commit 9fc815c

File tree

5 files changed

+82
-20
lines changed

5 files changed

+82
-20
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ libttsespeak.so
1818
android/res/raw/espeakdata.zip
1919
android/res/raw/espeakdata_version
2020

21+
local.properties
22+
23+
# android gradle output:
24+
25+
.gradle/
26+
build/
27+
2128
# autotools
2229

2330
AUTHORS

Makefile.am

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ EXTRA_DIST += ChangeLog
2323

2424
##### standard build actions:
2525

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

2828
install:
2929
cd src && make DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) BINDIR=$(BINDIR) INCDIR=$(INCDIR) LIBDIR=$(LIBDIR) install && cd ..
3030
install -m 755 src/espeakedit $(DESTDIR)$(BINDIR)
3131

3232
clean:
3333
cd src && rm -f *.o *~ && cd ..
34+
cd android && gradle clean
3435

3536
distclean: clean
3637
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
123124
jni:
124125
cd android && ndk-build
125126

127+
apk-release:
128+
cd android && gradle assembleRelease
129+
130+
apk-debug:
131+
cd android && gradle assembleDebug
132+
126133
android/res/raw/espeakdata.zip: espeak-data/phontab dictionaries
127134
mkdir -pv android/res/raw
128135
rm -f $@
@@ -133,8 +140,7 @@ android/res/raw/espeakdata.zip: espeak-data/phontab dictionaries
133140
android/res/raw/espeakdata_version: android/res/raw/espeakdata.zip
134141
sha1sum $< | awk '{ print $$1 }' > $@
135142

136-
android: \
137-
jni \
143+
espeakdata: \
138144
android/res/raw/espeakdata.zip \
139145
android/res/raw/espeakdata_version
140146

README.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,59 @@ If you are building with Eclipse, you will also need:
1717
1. Eclipse
1818
2. Android Developer Tools (ADT) for Eclipse
1919

20-
If you are building on the command line, you will also need:
20+
If you are building on the command line, you will also need either:
2121

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

24-
## Building eSpeak
27+
## Building with Gradle
2528

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

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

33-
## Building the APK with Eclipse
34+
$ ./autogen.sh
35+
$ ./configure
36+
$ make
3437

35-
1. Open Eclipse.
36-
2. Create a new workspace.
37-
3. Import the espeak folder as an exising Android project.
38-
4. Build the espeak apk within Eclipse.
38+
This will create an `android/build/apk/espeak-release-unsigned.apk` file.
39+
40+
## Building with Eclipse
41+
42+
1. Build the JNI binding and espeak data file by running:
43+
44+
$ ./autogen.sh
45+
$ ./configure
46+
$ make jni espeakdata
47+
2. Open Eclipse.
48+
3. Create a new workspace.
49+
4. Import the espeak folder as an exising Android project.
50+
5. Build the espeak apk within Eclipse.
3951

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

43-
## Building the APK from the Command Line
55+
## Building with Ant
4456

45-
1. Update the project using the Android utility which is part of the SDK:
57+
1. Build the JNI binding and espeak data file by running:
58+
59+
$ ./autogen.sh
60+
$ ./configure
61+
$ make jni espeakdata
62+
2. Update the project using the Android utility which is part of the SDK:
4663

4764
$ cd android
4865
$ android update project -s -t 1 -p .
49-
2. Build the package.
66+
3. Build the package.
5067

5168
$ ant release
5269

53-
In order to install the built `bin/eSpeakActivity-release-unsigned.apk` APK,
70+
## Signing the APK
71+
72+
In order to install the built APK (e.g. `bin/eSpeakActivity-release-unsigned.apk`)
5473
you need to self-sign the package. You can do this by:
5574

5675
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:
6685
$ zipalign 4 bin/eSpeakActivity-release-unsigned.apk \
6786
bin/eSpeakActivity-release-signed.apk
6887

88+
## Installing the APK
89+
6990
Now, you can install the APK using the `adb` tool:
7091

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

android/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:0.4.2'
7+
}
8+
}
9+
10+
apply plugin: 'android'
11+
12+
android {
13+
buildToolsVersion '17.0'
14+
compileSdkVersion 17
15+
16+
sourceSets {
17+
main {
18+
manifest.srcFile 'AndroidManifest.xml'
19+
java.srcDirs = ['src']
20+
res.srcDirs = ['res']
21+
}
22+
}
23+
}
24+
25+
tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
26+
pkgTask -> pkgTask.jniDir new File(projectDir, 'libs')
27+
}

android/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'espeak'

0 commit comments

Comments
 (0)