summaryrefslogtreecommitdiff
path: root/android/apk
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-29 17:12:55 +0100
committerMax Kellermann <max@musicpd.org>2018-10-14 23:41:38 +0200
commit94592c14062d5afc9482d11baa401648082022c0 (patch)
tree8723d462737f883181fb1aaa3f91ee3d0add9721 /android/apk
parent13ce142df137f346526de2a31a7ccbd59a903cdd (diff)
build with Meson instead of autotools
So long, autotools! This is my last MPD related project to migrate away from it. It has its strengths, but also very obvious weaknesses and weirdnesses. Today, many of its quirks are not needed anymore, and are cumbersome and slow. Now welcome our new Meson overlords!
Diffstat (limited to 'android/apk')
-rwxr-xr-xandroid/apk/make-unsigned-apk.sh21
-rw-r--r--android/apk/meson.build59
2 files changed, 80 insertions, 0 deletions
diff --git a/android/apk/make-unsigned-apk.sh b/android/apk/make-unsigned-apk.sh
new file mode 100755
index 000000000..f6a2e9739
--- /dev/null
+++ b/android/apk/make-unsigned-apk.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+S=`dirname "$0"`
+ANDROID_ABI=$1
+STRIP=$2
+ZIP=$3
+UNSIGNED_APK=$4
+LIBMPD_SO=$5
+CLASSES_DEX=$6
+RESOURCES_APK=$7
+D=`dirname "$UNSIGNED_APK"`
+
+rm -rf "$D/apk"
+mkdir -p "$D/apk/lib/$ANDROID_ABI"
+
+"$STRIP" "$LIBMPD_SO" -o "$D/apk/lib/$ANDROID_ABI/`basename $LIBMPD_SO`"
+cp "$CLASSES_DEX" "$D/apk/"
+cp "$RESOURCES_APK" "$UNSIGNED_APK"
+
+cd "$D/apk"
+exec zip -q -r "../`basename $UNSIGNED_APK`" .
diff --git a/android/apk/meson.build b/android/apk/meson.build
new file mode 100644
index 000000000..fc9c81737
--- /dev/null
+++ b/android/apk/meson.build
@@ -0,0 +1,59 @@
+unsigned_apk = custom_target(
+ 'mpd-unsigned.apk',
+ output: 'mpd-unsigned.apk',
+ input: [mpd, classes_dex, resources_apk[0]],
+ command: [
+ join_paths(meson.current_source_dir(), 'make-unsigned-apk.sh'),
+ android_abi,
+ get_option('android_strip'),
+ zip,
+ '@OUTPUT0@',
+ '@INPUT@',
+ ],
+)
+
+if get_option('android_debug_keystore') != ''
+ debug_apk = custom_target(
+ 'mpd-debug.apk',
+ output: 'mpd-debug.apk',
+ input: unsigned_apk,
+ command: [
+ jarsigner,
+ '-keystore', get_option('android_debug_keystore'),
+ '-storepass', 'android',
+ '-signedjar', '@OUTPUT@',
+ '@INPUT@',
+ 'androiddebugkey',
+ ],
+ build_by_default: true
+ )
+endif
+
+if get_option('android_keystore') != '' and get_option('android_keyalias') != '' and get_option('android_keypass') != ''
+ unaligned_apk = custom_target(
+ 'mpd-unaligned.apk',
+ output: 'mpd-unaligned.apk',
+ input: unsigned_apk,
+ command: [
+ jarsigner,
+ '-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
+ '-keystore', get_option('android_keystore'),
+ '-storepass', get_option('android_keypass'),
+ '-signedjar', '@OUTPUT@',
+ '@INPUT@',
+ get_option('android_keyalias'),
+ ],
+ )
+
+ apk = custom_target(
+ 'mpd.apk',
+ output: 'mpd.apk',
+ input: unaligned_apk,
+ command: [
+ android_zipalign,
+ '-f', '4',
+ '@INPUT@', '@OUTPUT@',
+ ],
+ build_by_default: true
+ )
+endif