-
Notifications
You must be signed in to change notification settings - Fork 5
/
updateJNIchanges.sh
executable file
·26 lines (25 loc) · 1.1 KB
/
updateJNIchanges.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# set -x
pdir=$(pwd)
cdir=$(dirname "$0")
cd $cdir # change to script directory
cdir=$(pwd)
echo $cdir
pathToJavaLib=/usr/lib/jvm/java-8-openjdk-amd64
espeakDir=${cdir}/../espeak-ng
if [ ! -d ${espeakDir} ]; then
echo "eSpeak NG directory was not found!"
exit 1
fi
echo "Compiling Java classes..."
mvn clean compile
echo "Generating ESpeakService.h..."
javah -cp target/classes -jni -d src/main/java/org/espeakng/jeditor/jni org.espeakng.jeditor.jni.ESpeakService
echo "Compiling eSpeakService.c..."
gcc -Wall -fPIC -O -std=c99 -g -I${pathToJavaLib}/include -I${pathToJavaLib}/include/linux -I/usr/include -I/usr/include/x86_64-linux-gnu -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/local/include -I${espeakDir} ${cdir}/src/main/java/org/espeakng/jeditor/jni/eSpeakService.c -c -o ${cdir}/lib/eSpeakService.o
echo "Compiling libespeakservice.so shared library..."
gcc -shared ${cdir}/lib/eSpeakService.o -lespeak-ng -o ${cdir}/lib/libespeakservice.so
echo "Copying libraries from lib to .lib"
cp -a lib/. .lib/
echo "OK"
cd $pdir # go back to previous directory