summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-03-04 20:43:59 +0100
committerMax Kellermann <max@musicpd.org>2018-03-04 20:43:59 +0100
commitea552208fcb5d59386253233955b5ae5f7989562 (patch)
treedb7f73a58e29849168144915b87c05a09142df49
parente86015a72a8225f534df8777c16748a849914522 (diff)
android/build.py: add ABI parameter
-rwxr-xr-xandroid/build.py26
-rw-r--r--doc/user.xml9
2 files changed, 26 insertions, 9 deletions
diff --git a/android/build.py b/android/build.py
index 516829274..02b426119 100755
--- a/android/build.py
+++ b/android/build.py
@@ -3,13 +3,14 @@
import os, os.path
import sys, subprocess
-if len(sys.argv) < 3:
- print("Usage: build.py SDK_PATH NDK_PATH [configure_args...]", file=sys.stderr)
+if len(sys.argv) < 4:
+ print("Usage: build.py SDK_PATH NDK_PATH ABI [configure_args...]", file=sys.stderr)
sys.exit(1)
sdk_path = sys.argv[1]
ndk_path = sys.argv[2]
-configure_args = sys.argv[3:]
+android_abi = sys.argv[3]
+configure_args = sys.argv[4:]
if not os.path.isfile(os.path.join(sdk_path, 'tools', 'android')):
print("SDK not found in", ndk_path, file=sys.stderr)
@@ -19,8 +20,18 @@ if not os.path.isdir(ndk_path):
print("NDK not found in", ndk_path, file=sys.stderr)
sys.exit(1)
+android_abis = {
+ 'armeabi-v7a': {
+ 'arch': 'arm-linux-androideabi',
+ 'ndk_arch': 'arm',
+ 'llvm_triple': 'armv7-none-linux-androideabi',
+ 'cflags': '-march=armv7-a -mfpu=vfp -mfloat-abi=softfp',
+ },
+}
+
# select the NDK target
-arch = 'arm-linux-androideabi'
+abi_info = android_abis[android_abi]
+arch = abi_info['arch']
# the path to the MPD sources
mpd_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]) or '.', '..'))
@@ -44,8 +55,7 @@ class AndroidNdkToolchain:
self.src_path = src_path
self.build_path = build_path
- ndk_arch = 'arm'
- android_abi = 'armeabi-v7a'
+ ndk_arch = abi_info['ndk_arch']
ndk_platform = 'android-14'
# select the NDK compiler
@@ -63,11 +73,11 @@ class AndroidNdkToolchain:
toolchain_path = os.path.join(ndk_path, 'toolchains', arch + '-' + gcc_version, 'prebuilt', build_arch)
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
- llvm_triple = 'armv7-none-linux-androideabi'
+ llvm_triple = abi_info['llvm_triple']
common_flags = '-Os -g'
common_flags += ' -fPIC'
- common_flags += ' -march=armv7-a -mfpu=vfp -mfloat-abi=softfp'
+ common_flags += ' ' + abi_info['cflags']
toolchain_bin = os.path.join(toolchain_path, 'bin')
llvm_bin = os.path.join(llvm_path, 'bin')
diff --git a/doc/user.xml b/doc/user.xml
index 1636914ef..1707a8cbc 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -303,10 +303,17 @@ apt-get install g++ \
<command>./configure</command>, type:
</para>
- <programlisting>./android/build.py SDK_PATH NDK_PATH
+ <programlisting>./android/build.py SDK_PATH NDK_PATH ABI
make android/build/mpd-debug.apk</programlisting>
<para>
+ <varname>SDK_PATH</varname> is the absolute path where you
+ installed the Android SDK; <varname>NDK_PATH</varname> is
+ the Android NDK installation path; <varname>ABI</varname> is
+ the Android ABI to be built, e.g. "armeabi-v7a".
+ </para>
+
+ <para>
This downloads various library sources, and then configures
and builds <application>MPD</application>.
</para>