From 4910dbc6d25bcd7d3f6a0d3668a21742cf9cf9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Thu, 29 Aug 2019 21:59:00 +0200 Subject: [PATCH] android: migrate from lzma to zip file --- Makefile | 23 ++++++++++++++++++----- kodev | 12 ++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 741dbefa1..dd4d42219 100644 --- a/Makefile +++ b/Makefile @@ -346,11 +346,24 @@ androidupdate: all -rm $(ANDROID_LAUNCHER_DIR)/assets/module/koreader-* # in runtime luajit-launcher's libluajit.so will be loaded -rm $(INSTALL_DIR)/koreader/libs/libluajit.so - # make android update apk - cd $(INSTALL_DIR)/koreader && 7z a -l -m0=lzma2 -mx=1 \ - ../../$(ANDROID_LAUNCHER_DIR)/assets/module/koreader-$(VERSION).7z * \ - -x!resources/fonts -x!resources/icons/src -x!spec - $(MAKE) -C $(ANDROID_LAUNCHER_DIR) $(if $(KODEBUG), debug, release) ANDROID_APPNAME=KOReader ANDROID_VERSION=$(ANDROID_VERSION) ANDROID_NAME=$(ANDROID_NAME) ANDROID_FLAVOR=$(ANDROID_FLAVOR) + + # assets are compressed manually and stored inside the APK. + cd $(INSTALL_DIR)/koreader && zip -r9 \ + ../../$(ANDROID_LAUNCHER_DIR)/assets/module/koreader-$(VERSION).zip * \ + --exclude=*resources/fonts* \ + --exclude=*resources/icons/src* \ + --exclude=*share/man* \ + --exclude=*spec* \ + --exclude=*COPYING* \ + --exclude=*README.md* + + # make the android APK + $(MAKE) -C $(ANDROID_LAUNCHER_DIR) $(if $(KODEBUG), debug, release) \ + ANDROID_APPNAME=KOReader \ + ANDROID_VERSION=$(ANDROID_VERSION) \ + ANDROID_NAME=$(ANDROID_NAME) \ + ANDROID_FLAVOR=$(ANDROID_FLAVOR) + cp $(ANDROID_LAUNCHER_DIR)/bin/NativeActivity.apk \ koreader-android-$(ANDROID_ARCH)$(KODEDUG_SUFFIX)-$(VERSION).apk diff --git a/kodev b/kodev index e44e064b7..4f8b7d154 100755 --- a/kodev +++ b/kodev @@ -9,15 +9,7 @@ fi # Default Android build to arm. ANDROID_ARCH="${ANDROID_ARCH:-arm}" -if [ -z "${ANDROID_FULL_ARCH}" ]; then - if [ "${ANDROID_ARCH}" = "arm" ]; then - ANDROID_FULL_ARCH_APK="${ANDROID_FULL_ARCH_APK:-arm-linux-androideabi}" - elif [ "${ANDROID_ARCH}" = "x86" ]; then - ANDROID_FULL_ARCH_APK="${ANDROID_FULL_ARCH_APK:-i686-linux-android}" - else - ANDROID_FULL_ARCH_APK="${ANDROID_ARCH}" - fi -fi + # Default to Android 4.0+; required for NDK 15 but with a custom NDK the strict minimum is 9. NDKABI=${NDKABI:-14} export NDKABI @@ -625,7 +617,7 @@ TARGET: # uninstall existing package to make sure *everything* is gone from memory # no assert_ret_zero; uninstall is allowed to fail if there's nothing to uninstall adb uninstall "org.koreader.launcher" - adb install "koreader-android-${ANDROID_FULL_ARCH_APK}${KODEBUG_SUFFIX}-${VERSION}.apk" + adb install "koreader-android-${ANDROID_ARCH}${KODEBUG_SUFFIX}-${VERSION}.apk" assert_ret_zero $? # there's no adb run so we do this… adb shell monkey -p org.koreader.launcher -c android.intent.category.LAUNCHER 1