Skip to content

Commit

Permalink
Updated build system
Browse files Browse the repository at this point in the history
  • Loading branch information
pelya committed Oct 17, 2012
1 parent daeec87 commit 0a64ebe
Show file tree
Hide file tree
Showing 10 changed files with 3,379 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "project/jni/application/openarena/vm"] [submodule "project/jni/application/openarena/vm"]
path = project/jni/application/openarena/vm path = project/jni/application/openarena/vm
url = https://github.com/pelya/openarena-vm url = https://github.com/pelya/openarena-vm
[submodule "project/jni/application/teeworlds-0.7/src"]
path = project/jni/application/teeworlds-0.7/src
url = git://github.com/pelya/teeworlds.git
10 changes: 8 additions & 2 deletions build.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if ( grep "package $AppFullName;" project/src/Globals.java > /dev/null && \
[ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \ [ "`readlink AndroidAppSettings.cfg`" -ot "project/src/Globals.java" ] && \
[ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] && \ [ -z "`find project/java/* project/AndroidManifestTemplate.xml -cnewer project/src/Globals.java`" ] && \
[ -z "`find project/jni/application/src/AndroidData/* -cnewer project/src/Globals.java`" ] ) ; then true ; else [ -z "`find project/jni/application/src/AndroidData/* -cnewer project/src/Globals.java`" ] ) ; then true ; else
./ChangeAppSettings.sh -a ./changeAppSettings.sh -a
sleep 1 sleep 1
touch project/src/Globals.java touch project/src/Globals.java
fi fi
Expand All @@ -42,7 +42,12 @@ if uname -s | grep -i "windows" > /dev/null ; then
fi fi


rm -r -f project/bin/* # New Android SDK introduced some lame-ass optimizations to the build system which we should take care about rm -r -f project/bin/* # New Android SDK introduced some lame-ass optimizations to the build system which we should take care about
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU && \ [ -x project/jni/application/src/AndroidPreBuild.sh ] && {
cd project/jni/application/src
./AndroidPreBuild.sh || { echo "AndroidPreBuild.sh returned with error" ; exit 1 ; }
cd ../../../..
}
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 && \
{ grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \ { grep "CustomBuildScript=y" ../AndroidAppSettings.cfg > /dev/null && \
echo Stripping libapplication.so by hand && \ echo Stripping libapplication.so by hand && \
rm obj/local/armeabi/libapplication.so && \ rm obj/local/armeabi/libapplication.so && \
Expand All @@ -58,6 +63,7 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \ cp jni/application/src/libapplication-armeabi-v7a.so libs/armeabi-v7a/libapplication.so && \
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \ `which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.6/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi-v7a/libapplication.so \
|| true ; } && \ || true ; } && \
cd .. && ./copyAssets.sh && cd project && \
ant debug && \ ant debug && \
$install_apk && [ -n "`adb devices | tail -n +2`" ] && \ $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
{ cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \ { cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
Expand Down
13 changes: 1 addition & 12 deletions ChangeAppSettings.sh → changeAppSettings.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -989,17 +989,6 @@ done
rm -rf project/bin/classes rm -rf project/bin/classes
rm -rf project/bin/res rm -rf project/bin/res


mkdir -p project/assets ./copyAssets.sh || exit 1
rm -f project/assets/*
if [ -d "project/jni/application/src/AndroidData" ] ; then
echo Copying asset files
cp project/jni/application/src/AndroidData/* project/assets/
for F in project/assets/*; do
if [ `cat $F | wc -c` -gt 1000000 ] ; then
echo "The file $F is bigger than 1 megabyte - splitting it into smaller chunks"
split -b 1000000 -d $F $F && rm $F || { echo "Error: 'split' command not installed" ; exit 1 ; }
fi
done
fi


echo Done echo Done
16 changes: 16 additions & 0 deletions copyAssets.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

echo "Copying app data files from project/jni/application/src/AndroidData to project/assets"
mkdir -p project/assets
rm -f project/assets/*
if [ -d "project/jni/application/src/AndroidData" ] ; then
echo Copying asset files
cp project/jni/application/src/AndroidData/* project/assets/
for F in project/assets/*; do
if [ `cat $F | wc -c` -gt 1000000 ] ; then
echo "The file $F is bigger than 1 megabyte - splitting it into smaller chunks"
split -b 1000000 -d $F $F && rm $F || { echo "Error: 'split' command not installed" ; exit 1 ; }
fi
done
fi
exit 0
2 changes: 1 addition & 1 deletion project/jni/Application.mk
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ APP_PROJECT_PATH := $(call my-dir)/..


APP_STL := gnustl_static APP_STL := gnustl_static
APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources APP_CFLAGS := -O3 -DNDEBUG -g # arm-linux-androideabi-4.4.3 crashes in -O0 mode on SDL sources
APP_PLATFORM := android-8 APP_PLATFORM := android-9 # Android 2.3.0 or newer, includes EGL headers


include jni/Settings.mk include jni/Settings.mk


Loading

0 comments on commit 0a64ebe

Please sign in to comment.