summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2020-03-31 21:23:28 +1100
committerMatthew Waters <matthew@centricular.com>2020-04-06 11:55:40 +1000
commit6aeec3799c37c33b199f145e3cc33ff04cd56450 (patch)
tree7d01a85a6b3fdb64d130f0b0118e776d559ce337 /config
parenta38b895ab1e9d59ccfd8a147caa2e3101896c1f6 (diff)
android: update to NDK r21
Diffstat (limited to 'config')
-rw-r--r--config/android.config33
1 files changed, 27 insertions, 6 deletions
diff --git a/config/android.config b/config/android.config
index 1a72f324..c3c170f1 100644
--- a/config/android.config
+++ b/config/android.config
@@ -32,7 +32,7 @@ variants += ['nopython', 'notestspackage']
allow_system_libs=False
if not toolchain_prefix:
- toolchain_prefix = os.path.join(home_dir, 'android-ndk-18')
+ toolchain_prefix = os.path.join(home_dir, 'android-ndk-21')
toolchain_path = None
toolchain_version = None
@@ -43,7 +43,7 @@ tools_prefix = None
tools_dir = None
host = None
llvm_triple = None
-_arch = None
+
if target_arch == Architecture.ARMv7:
tools_prefix = 'arm-linux-androideabi'
tools_dir = tools_prefix
@@ -52,6 +52,7 @@ if target_arch == Architecture.ARMv7:
llvm_triple = 'armv7-none-linux-androideabi' + str(v)
_android_arch = 'arm'
_cerbero_arch = 'armv7'
+ _cxx_arch = 'armeabi-v7a'
elif target_arch == Architecture.ARM64:
tools_prefix = 'aarch64-linux-android'
tools_dir = tools_prefix
@@ -60,6 +61,7 @@ elif target_arch == Architecture.ARM64:
llvm_triple = 'aarch64-none-linux-android'
_android_arch = 'arm64'
_cerbero_arch = 'arm64'
+ _cxx_arch = 'arm64-v8a'
elif target_arch == Architecture.X86:
tools_prefix = 'i686-linux-android'
tools_dir = 'x86'
@@ -68,6 +70,7 @@ elif target_arch == Architecture.X86:
llvm_triple = "i686-none-linux-android"
_android_arch = 'x86'
_cerbero_arch = 'x86'
+ _cxx_arch = 'x86'
elif target_arch == Architecture.X86_64:
tools_prefix = 'x86_64-linux-android'
tools_dir = 'x86_64'
@@ -75,12 +78,14 @@ elif target_arch == Architecture.X86_64:
llvm_triple = "x86_64-none-linux-android"
_android_arch = 'x86_64'
_cerbero_arch = 'x86_64'
+ _cxx_arch = 'x86_64'
elif target_arch == Architecture.UNIVERSAL:
tools_prefix = ''
host = ''
llvm_triple = ''
_android_arch = 'x86_64'
_cerbero_arch = 'x86_64'
+ _cxx_arch = 'x86_64'
else:
raise FatalError("Arch %s not supported" % target_arch)
@@ -138,7 +143,7 @@ if target_arch == Architecture.X86:
if v < 24:
cflags += ' -mstackrealign'
-ldflags = '-gcc-toolchain %s -fPIC -no-canonical-prefixes -Wl,-no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-dynamic-linker,/system/bin/linker -Wl,--warn-shared-textrel -Wl,--exclude-libs,libatomic.a -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libunwind.a' % (gcc_toolchain_root)
+ldflags = '-gcc-toolchain %s -fPIC -no-canonical-prefixes -Wl,-no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--gc-sections -Wl,-dynamic-linker,/system/bin/linker -Wl,--warn-shared-textrel -Wl,--exclude-libs,libatomic.a -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libunwind.a' % (gcc_toolchain_root,)
if target_arch == Architecture.ARMv7:
defines += ' -D__ARM_ARCH_7A__ '
@@ -159,11 +164,26 @@ else:
ldvariant = 'gold'
ldflags += ' -fuse-ld=%s ' % ldvariant
+# this C++ stl setup is closely tied to the gnustl recipe which sets up the
+# necessary environment and files for this
+stl_prefix = os.path.join(toolchain_prefix, 'sources', 'cxx-stl', 'llvm-libc++')
+stl_libdir = os.path.join(toolchain_prefix, 'libs', _cxx_arch)
+
+stl_cxxlinkargs = ['-nostdlib++', '-L' + stl_libdir, '-lc++_shared']
+stl_cxxflags = '-nostdlib++ -isystem ' + os.path.join (stl_prefix, 'include') + ' -isystem ' + os.path.join (stl_prefix, '..', 'llvm-libc++abi', 'include')
+if v < 21:
+ stl_cxxflags += ' -Wl,' + os.path.join (lib_dir, 'libandroid_support.a')
+ stl_cxxlinkargs += ['-Wl,' + os.path.join (lib_dir, 'libandroid_support.a')]
+ stl_cxxflags += ' -isystem ' + os.path.join (toolchain_prefix, 'sources', 'android', 'support', 'include')
+if target_arch == Architecture.ARMv7:
+ stl_cxxflags += ' -Wl,' + os.path.join (lib_dir, 'libunwind.a')
+ stl_cxxlinkargs += ['-Wl,' + os.path.join (lib_dir, 'libunwind.a')]
+
# Toolchain environment
-env['CPPFLAGS'] = '-isysroot %s -isystem %s -isystem %s/usr/include -isystem %s/usr/include/%s %s' % (isysroot, incl_dir, isysroot, isysroot, tools_prefix, defines)
+env['CPPFLAGS'] = defines
env['CFLAGS'] += "%s %s -Wa,--noexecstack" % (cflags, defines)
-env['CXXFLAGS'] = env['CFLAGS'] + ' -fno-rtti -fno-exceptions'
-env['LDFLAGS'] = '%s' % (ldflags,)
+env['CXXFLAGS'] = stl_cxxflags + ' ' + env['CFLAGS'] + ' -fno-rtti -fno-exceptions '
+env['LDFLAGS'] = ldflags + ' -nostdlib++'
def cmd(command):
return '%s-%s' % (tools_prefix, command)
@@ -219,3 +239,4 @@ if v < 24:
meson_cross_properties['has_function_fsetpos64'] = 'false'
meson_cross_properties['has_function_fgetpos64'] = 'false'
+meson_cross_properties['cpp_link_args'] = stl_cxxlinkargs