forked from pelya/commandergenius
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RecompileAllApps.sh
executable file
·69 lines (62 loc) · 2.09 KB
/
RecompileAllApps.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
KEYSTORE=~/.ssh/android.keystore
ALIAS=pelya
APPS_SKIP="src scummvm"
APPS_BUILD="$*"
mkdir -p apk
if [ "-$1" = "--a" ] ; then
cd apk
for F in *.apk; do
APPS_SKIP="$APPS_SKIP `echo $F | sed 's/\(.*\)[.]apk/\1/'`"
done
cd ..
fi
echo -n "Enter password for keystore at $KEYSTORE alias $ALIAS: "
stty -echo
read PASSWORD
stty echo
echo
# First edit app settings if their format was changed
for APP1 in project/jni/application/*/AndroidAppSettings.cfg; do
APP=`echo $APP1 | sed 's@project/jni/application/\([^/]*\)/.*@\1@'`
if [ -n "$APPS_BUILD" ] ; then
echo "$APPS_BUILD" | grep "$APP" || continue
else
if echo $APPS_SKIP | grep $APP > /dev/null ; then
continue
fi
fi
rm project/jni/application/src
ln -s $APP project/jni/application/src
echo
echo ===== Settings for $APP =====
./ChangeAppSettings.sh -v
rm -f apk/$APP.apk
done
for APP1 in project/jni/application/*/AndroidAppSettings.cfg; do
APP=`echo $APP1 | sed 's@project/jni/application/\([^/]*\)/.*@\1@'`
if [ -n "$APPS_BUILD" ] ; then
echo "$APPS_BUILD" | grep "$APP" || continue
else
if echo $APPS_SKIP | grep $APP > /dev/null ; then
continue
fi
fi
rm -f project/jni/application/src
ln -s $APP project/jni/application/src
rm -rf project/obj/local/*/libapplication.so project/obj/local/*/objs/application
rm -rf project/obj/local/*/libsdl*.so project/obj/local/*/objs/sdl*
./ChangeAppSettings.sh -a
NDKBUILD=ndk-build
if grep "AppUseCrystaXToolchain=y" AndroidAppSettings.cfg > /dev/null ; then
NDKBUILD=`which ndk-build | sed 's@/[^/]*/ndk-build@/android-ndk-r4-crystax@'`/ndk-build
fi
echo Compiling $APP
APPVERSION=`grep 'AppVersionCode=' AndroidAppSettings.cfg | sed 's/AppVersionCode=\(.*\)/\1/'`
OLDPATH="`pwd`"
( cd project && nice -n5 $NDKBUILD -j4 V=1 && ant release && \
jarsigner -verbose -keystore "$KEYSTORE" -storepass "$PASSWORD" bin/DemoActivity-unsigned.apk $ALIAS && \
zipalign 4 bin/DemoActivity-unsigned.apk ../apk/$APP.apk && \
mkdir -p debuginfo/$APP-$APPVERSION && cp -f obj/local/armeabi/libapplication.so obj/local/armeabi/libsdl-*.so debuginfo/$APP-$APPVERSION &&
cd .. ) || exit 1
done