From f9b6745d68b8c75da848892cc75848a47c607644 Mon Sep 17 00:00:00 2001 From: Antoniou Athanasios Date: Wed, 18 Sep 2019 19:36:47 +0300 Subject: ANDROIDSDL: Use "debug" or "release" as a parameter for building the port --- dists/androidsdl/How_to_Build.txt | 10 +++--- dists/androidsdl/build.sh | 46 ++++++++++++++++++++++++- dists/androidsdl/scummvm/AndroidBuild.sh | 22 ------------ dists/androidsdl/scummvm/AndroidBuildDebug.sh | 22 ++++++++++++ dists/androidsdl/scummvm/AndroidBuildRelease.sh | 22 ++++++++++++ 5 files changed, 95 insertions(+), 27 deletions(-) delete mode 100755 dists/androidsdl/scummvm/AndroidBuild.sh create mode 100644 dists/androidsdl/scummvm/AndroidBuildDebug.sh create mode 100644 dists/androidsdl/scummvm/AndroidBuildRelease.sh diff --git a/dists/androidsdl/How_to_Build.txt b/dists/androidsdl/How_to_Build.txt index c294fc8e67..c0562ca2de 100644 --- a/dists/androidsdl/How_to_Build.txt +++ b/dists/androidsdl/How_to_Build.txt @@ -106,6 +106,9 @@ cd ~/scummvm/dists/androidsdl ./build.sh +7b) The above build command will create a release build. In order to make a debug build, you will need to add the "debug" argument when running the build command like so: + ./build.sh debug + 8) If the process completes successfully, a "scummvm-debug.apk" file will be stored in that folder (~/scummvm/dists/androidsdl). Since this apk is self-signed you will need to enable installation by third-party sources on your Android device in order to install it. @@ -120,12 +123,11 @@ NOTE: You can significantly reduce the build time if you target a specific Andro The above line is only an example; you might have to specify another architecture for your specific use case. B) In order to build the scummvm androidsdl port for specific engines only: - - Open the "~/scummvm/dists/androidsdl/scummvm/AndroidBuild.sh" file - - Find the following line which contains the configure command: - $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " + - Depending on whether you are building a release or a debug build, open one of the "AndroidBuildRelease.sh" or "AndroidBuildDebug.sh" files in the "~/scummvm/dists/androidsdl/scummvm/" folder + - Find the following line which contains the configure command. - Edit the line and after "../configure" add "--disable-all-engines --enable-engine=YYYY", where in place of "YYYY" you should specify game engine for which you want to build scummvm. For example (building only for the bladerunner engine): - $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --disable-all-engines --enable-engine=bladerunner --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " + $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --disable-all-engines --enable-engine=bladerunner --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " References: diff --git a/dists/androidsdl/build.sh b/dists/androidsdl/build.sh index f801d8c857..13bb56fd01 100755 --- a/dists/androidsdl/build.sh +++ b/dists/androidsdl/build.sh @@ -2,6 +2,43 @@ LOCAL_PATH=`dirname $0` LOCAL_PATH=`cd $LOCAL_PATH && pwd` +# default build mode is release +build_release=true + +if [ "$#" -eq "1" ]; then + if [ "$1" = "debug" ]; then + build_release=false + echo "Preparing for a debug build..." + elif [ "$1" = "release" ]; then + echo "Preparing for a release build..." + else + echo "Usage: $0 [debug|release]" + echo " debug: build debug package" + echo " release: build release package (default)" + exit 0 + fi +else + echo "Preparing for a release (default) build..." +fi +sleep 1 + +if $build_release ; then + if [ -x scummvm/AndroidBuildRelease.sh ] && \ + { cp scummvm/AndroidBuildRelease.sh scummvm/AndroidBuild.sh ; } ; then + echo "AndroidBuild.sh created successfully" + else + echo "Error: Required script AndroidBuildRelease.sh could not be copied to AndroidBuild.sh" + exit 0 + fi +else + if [ -x scummvm/AndroidBuildDebug.sh ] && \ + { cp scummvm/AndroidBuildDebug.sh scummvm/AndroidBuild.sh ; } ; then + echo "AndroidBuild.sh created successfully" + else + echo "Error: Required script AndroidBuildDebug.sh could not be copied to AndroidBuild.sh" + exit 0 + fi +fi if [ \! -d ../../../androidsdl ] ; then cd ../../.. @@ -24,7 +61,14 @@ if [ \! -d ../../../androidsdl/project/jni/application/scummvm ] ; then fi cd ../../../androidsdl -./build.sh scummvm +if $build_release ; then + ./build.sh release scummvm +else + ./build.sh debug scummvm +fi + +# the androidsdl build.sh script ensures that the output file is named "app-release" even if we are in debug mode mv project/app/build/outputs/apk/app-release.apk ../scummvm/dists/androidsdl/scummvm-debug.apk cd ../scummvm/dists/androidsdl +rm scummvm/AndroidBuild.sh diff --git a/dists/androidsdl/scummvm/AndroidBuild.sh b/dists/androidsdl/scummvm/AndroidBuild.sh deleted file mode 100755 index c54aeb2c57..0000000000 --- a/dists/androidsdl/scummvm/AndroidBuild.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -LOCAL_PATH=`dirname $0` -LOCAL_PATH=`cd $LOCAL_PATH && pwd` -ANDROIDSDL=../../../../androidsdl - -#ln -sf libtremor.a $ANDROIDSDL/project/obj/local/$1/libvorbisidec.a -ln -sf libflac.a $ANDROIDSDL/project/obj/local/$1/libFLAC.a -ln -sf libvorbis.a $ANDROIDSDL/project/obj/local/$1/libvorbisfile.a -ln -sf libtheora.so $ANDROIDSDL/project/obj/local/$1/libtheoradec.so -ln -sf libsdl_net.so $ANDROIDSDL/project/obj/local/$1/libSDL_net.so -ln -sf libglshim.a $ANDROIDSDL/project/obj/local/$1/libGL.a - -mkdir -p scummvm/bin-$1 - -if [ \! -f scummvm/bin-$1/config.mk ] ; then - $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " -fi -$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh make -j4 -C scummvm/bin-$1 -make -C scummvm/bin-$1 androidsdl -mv -f scummvm/bin-$1/scummvm*.z* AndroidData -cp -f scummvm/bin-$1/scummvm libapplication-$1.so diff --git a/dists/androidsdl/scummvm/AndroidBuildDebug.sh b/dists/androidsdl/scummvm/AndroidBuildDebug.sh new file mode 100644 index 0000000000..c54aeb2c57 --- /dev/null +++ b/dists/androidsdl/scummvm/AndroidBuildDebug.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +LOCAL_PATH=`dirname $0` +LOCAL_PATH=`cd $LOCAL_PATH && pwd` +ANDROIDSDL=../../../../androidsdl + +#ln -sf libtremor.a $ANDROIDSDL/project/obj/local/$1/libvorbisidec.a +ln -sf libflac.a $ANDROIDSDL/project/obj/local/$1/libFLAC.a +ln -sf libvorbis.a $ANDROIDSDL/project/obj/local/$1/libvorbisfile.a +ln -sf libtheora.so $ANDROIDSDL/project/obj/local/$1/libtheoradec.so +ln -sf libsdl_net.so $ANDROIDSDL/project/obj/local/$1/libSDL_net.so +ln -sf libglshim.a $ANDROIDSDL/project/obj/local/$1/libGL.a + +mkdir -p scummvm/bin-$1 + +if [ \! -f scummvm/bin-$1/config.mk ] ; then + $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " +fi +$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh make -j4 -C scummvm/bin-$1 +make -C scummvm/bin-$1 androidsdl +mv -f scummvm/bin-$1/scummvm*.z* AndroidData +cp -f scummvm/bin-$1/scummvm libapplication-$1.so diff --git a/dists/androidsdl/scummvm/AndroidBuildRelease.sh b/dists/androidsdl/scummvm/AndroidBuildRelease.sh new file mode 100644 index 0000000000..fee183a544 --- /dev/null +++ b/dists/androidsdl/scummvm/AndroidBuildRelease.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +LOCAL_PATH=`dirname $0` +LOCAL_PATH=`cd $LOCAL_PATH && pwd` +ANDROIDSDL=../../../../androidsdl + +#ln -sf libtremor.a $ANDROIDSDL/project/obj/local/$1/libvorbisidec.a +ln -sf libflac.a $ANDROIDSDL/project/obj/local/$1/libFLAC.a +ln -sf libvorbis.a $ANDROIDSDL/project/obj/local/$1/libvorbisfile.a +ln -sf libtheora.so $ANDROIDSDL/project/obj/local/$1/libtheoradec.so +ln -sf libsdl_net.so $ANDROIDSDL/project/obj/local/$1/libSDL_net.so +ln -sf libglshim.a $ANDROIDSDL/project/obj/local/$1/libGL.a + +mkdir -p scummvm/bin-$1 + +if [ \! -f scummvm/bin-$1/config.mk ] ; then + $ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-optimizations --enable-release --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. " +fi +$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh make -j4 -C scummvm/bin-$1 +make -C scummvm/bin-$1 androidsdl +mv -f scummvm/bin-$1/scummvm*.z* AndroidData +cp -f scummvm/bin-$1/scummvm libapplication-$1.so -- cgit v1.2.3