diff --git a/project/jni/application/setEnvironment.sh b/project/jni/application/setEnvironment.sh index 282f0f1a8..b698cd27e 100755 --- a/project/jni/application/setEnvironment.sh +++ b/project/jni/application/setEnvironment.sh @@ -23,6 +23,12 @@ GCCVER=4.4.0 PLATFORMVER=android-8 LOCAL_PATH=`dirname $0` LOCAL_PATH=`cd $LOCAL_PATH && pwd` +STL_INCLUDE="-I$LOCAL_PATH/../stlport/stlport" +STL_LIB="$LOCAL_PATH/../../obj/local/armeabi/libstlport.a" +if [ -n "`echo $NDK | grep '[-]crystax'`" ] ; then + STL_INCLUDE= + STL_LIB= +fi APP_MODULES=`grep 'APP_MODULES [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@'` APP_AVAILABLE_STATIC_LIBS=`grep 'APP_AVAILABLE_STATIC_LIBS [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@'` @@ -31,6 +37,7 @@ echo $APP_MODULES | xargs -n 1 echo | while read LIB ; do STATIC=`echo $APP_AVAILABLE_STATIC_LIBS | grep "\\\\b$LIB\\\\b"` if [ "$LIB" = "application" ] ; then true elif [ "$LIB" = "sdl_main" ] ; then true + elif [ "$LIB" = "stlport" ] ; then true elif [ -n "$STATIC" ] ; then true else echo $LIB @@ -44,7 +51,7 @@ CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os \ -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \ -Wa,--noexecstack -DNDEBUG -g \ --I$LOCAL_PATH/../sdl-1.2/include -I$LOCAL_PATH/../stlport/stlport \ +-I$LOCAL_PATH/../sdl-1.2/include $STL_INCLUDE \ `echo $APP_MODULES | sed \"s@\([-a-zA-Z0-9_.]\+\)@-I$LOCAL_PATH/../\1/include@g\"`" LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \ @@ -58,10 +65,7 @@ $NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \ -L$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \ -lGLESv1_CM -ldl -llog -lz \ -Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \ --L$LOCAL_PATH/../../obj/local/armeabi" - -# Comment out if you're using CrystaX toolchain -LDFLAGS="$LDFLAGS $LOCAL_PATH/../../obj/local/armeabi/libstlport.a" +-L$LOCAL_PATH/../../obj/local/armeabi $STL_LIB" env PATH=$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \ CFLAGS="$CFLAGS" \ diff --git a/readme.txt b/readme.txt index 814e8cd22..fe3e792d3 100644 --- a/readme.txt +++ b/readme.txt @@ -148,19 +148,13 @@ This compiler flags will catch most obvious errors, you may add them to AppCflag How to compile your own application using automake/configure scripts ==================================================================== -There is limited support for "configure" scripts, I've managed to compile lbreakout2 that way, +There is limited support for "configure" scripts, I'm compiling scummvm this way, though ./configure scripts tend to have stupid bugs in various places, avoid using that method if you can. -1. Download lbreakout2-2.6.1.tar.gz from http://lgames.sourceforge.net/, unpack it to project/jni/application dir. -2. Determine libraries needed for your app, launch ChangeAppSettings.sh, select correct libSDL version - (1.2 for lbreakout2), and correct libs (sdl_mixer sdl_image sdl_net for lbreakout2), also change name etc. -3. Launch ./build.sh, wait till it builds all .so files -4. Go to project/jni/application/lbreakout2-2.6.1 dir, and launch command - ../launchConfigure.sh --disable-install --enable-sdl-net LIBS=-lintl -5. Watch how ./configure configures, if it fails fix launchConfigure.sh, rinse and repeat. -6. Launch make, and pray. If you're lucky it will create application binary (lbreakout2-2.6.1/client/lbreakout2) -7. Move the application binary to dir project/libs/armeabi, rename it to libapplication.so (overwrite old file) -8. Run command "arm-eabi-strip -g libapplication.so", you can find arm-eabi-strip under your NDK dir. -9. Run "ant debug" or "ant release" from project dir, install to device & enjoy. +You should enable custom build script in ChangeAppSettings.sh, and you should create script +AndroidBuild.sh and put it under project/jni/application/src dir. The AndroidBuild.sh script should +generate file project/jni/application/src/libapplication.so, which will be copied into .apk file by build system. +There is helper script project/jni/application/setEnvironment.sh which will set CFLAGS and LDFLAGS +for configure script and makefile, see AndroidBuild.sh in project/jni/application/scummvm dir for reference. Android Application lifecycle support =====================================