From 12e675f7548bb883aedf2d00f22ed7ea55a2396d Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 25 Jan 2021 23:42:31 +1100 Subject: [PATCH] Add buildbot script for android (still got a few things to fix though) --- android/app/src/main/AndroidManifest.xml | 12 ++--- .../{ic_launcher.png => ccicon.png} | Bin .../{ic_launcher.png => ccicon.png} | Bin .../{ic_launcher.png => ccicon.png} | Bin .../{ic_launcher.png => ccicon.png} | Bin misc/builddroid.sh | 44 ++++++++++++++++++ 6 files changed, 48 insertions(+), 8 deletions(-) rename android/app/src/main/res/mipmap-hdpi/{ic_launcher.png => ccicon.png} (100%) rename android/app/src/main/res/mipmap-mdpi/{ic_launcher.png => ccicon.png} (100%) rename android/app/src/main/res/mipmap-xhdpi/{ic_launcher.png => ccicon.png} (100%) rename android/app/src/main/res/mipmap-xxhdpi/{ic_launcher.png => ccicon.png} (100%) create mode 100644 misc/builddroid.sh diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3d5220f60..3ba98779f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,16 +8,12 @@ + + + - - - - - diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ccicon.png similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-hdpi/ccicon.png diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ccicon.png similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-mdpi/ccicon.png diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ccicon.png similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-xhdpi/ccicon.png diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ccicon.png similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-xxhdpi/ccicon.png diff --git a/misc/builddroid.sh b/misc/builddroid.sh new file mode 100644 index 000000000..62fde33ad --- /dev/null +++ b/misc/builddroid.sh @@ -0,0 +1,44 @@ +FLAGS="-fPIC -shared -s -O1" +LIBS="-lGLESv2 -lEGL -lOpenSLES -lm -landroid -llog" +NDK_ROOT="/home/buildbot/android/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin" +TOOLS_ROOT="/home/buildbot/android/sdk/build-tools/26.0.0" +SDK_ROOT="/home/buildbot/android/sdk/platforms/android-26" + +cd /home/buildbot/client/src +$NDK_ROOT/i686-linux-android26-clang *.c $FLAGS $LIBS -o cc-droid-x86_32 +$NDK_ROOT/aarch64-linux-android26-clang *.c $FLAGS $LIBS -o cc-droid-arm_64 +$NDK_ROOT/x86_64-linux-android26-clang *.c $FLAGS $LIBS -o cc-droid-x86_64 +$NDK_ROOT/armv7a-linux-androideabi26-clang *.c $FLAGS $LIBS -o cc-droid-arm_32 + +cd ../android/app/src/main +# remove old java temp files +rm -rf obj +mkdir obj +rm classes.dex + +# copy required native libraries +rm -rf lib +mkdir lib +mkdir lib/armeabi-v7a +mkdir lib/arm64-v8a +mkdir lib/x86 +mkdir lib/x86_64 +cp ~/client/src/cc-droid-arm_32 lib/armeabi-v7a/libclassicube.so +cp ~/client/src/cc-droid-arm_64 lib/arm64-v8a/libclassicube.so +cp ~/client/src/cc-droid-x86_32 lib/x86/libclassicube.so +cp ~/client/src/cc-droid-x86_64 lib/x86_64/libclassicube.so + +# compile interop java file into its multiple .class files +javac java/com/classicube/MainActivity.java -d ./obj -classpath $SDK_ROOT/android.jar +# compile the multiple .class files into one .dex file +$TOOLS_ROOT/dx --dex --output=obj/classes.dex ./obj +# create initial .apk with packaged version of resources +$TOOLS_ROOT/aapt package -f -M AndroidManifest.xml -S res -F obj/cc-unsigned.apk -I $SDK_ROOT/android.jar +# and add all the required files +cp obj/classes.dex classes.dex +$TOOLS_ROOT/aapt add -f obj/cc-unsigned.apk classes.dex lib/armeabi-v7a/libclassicube.so lib/arm64-v8a/libclassicube.so lib/x86/libclassicube.so lib/x86_64/libclassicube.so +# sign the apk with debug key (https://stackoverflow.com/questions/16711233/) +cp obj/cc-unsigned.apk obj/cc-signed.apk +jarsigner -verbose -keystore debug.keystore -storepass android -keypass android obj/cc-signed.apk androiddebugkey +# create aligned .apk file +$TOOLS_ROOT/zipalign -f -v 4 obj/cc-signed.apk obj/cc-final.apk \ No newline at end of file