Commit ae6ba829 authored by Matthew Waters's avatar Matthew Waters 🐨

android/bootstrap: update to NDK r16

parent 4c41cf23
......@@ -27,7 +27,7 @@ from cerbero.utils import _, shell
class AndroidBootstrapper (BootstrapperBase):
NDK_BASE_URL = 'http://dl.google.com/android/repository/'
NDK_VERSION = 'r13b'
NDK_VERSION = 'r16'
NDK_ZIP = 'android-ndk-' + NDK_VERSION + '-%s-%s.zip'
def start(self):
......
......@@ -14,7 +14,7 @@ variants += ['nopython', 'notestspackage']
allow_system_libs=False
if not toolchain_prefix:
toolchain_prefix = os.path.join(home_dir, 'android-ndk-r13b')
toolchain_prefix = os.path.join(home_dir, 'android-ndk-16')
toolchain_path = None
toolchain_version = None
......@@ -85,17 +85,24 @@ if not toolchain_path:
v = DistroVersion.get_android_api_version(target_distro_version)
isysroot = "%s/sysroot" % (toolchain_prefix)
sysroot = "%s/platforms/android-%d/arch-%s" % (toolchain_prefix, v, _arch)
incl_dir = os.path.join(prefix, _arch, 'include')
if target_arch != Architecture.UNIVERSAL and not os.path.exists(incl_dir):
os.makedirs(incl_dir)
# Default compiler flags
os.environ['CFLAGS'] = '-Wall -g -Os '
os.environ['CXXFLAGS'] = '-Wall -g -Os '
os.environ['OBJCFLAGS'] = '-Wall -g -Os '
ccache = use_ccache and 'ccache ' or ''
defines = '-DANDROID -DPIC'
cflags = '--sysroot=%s -I%s/usr/include -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fPIC' % (sysroot, sysroot)
ldflags = '--sysroot=%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 ' % (sysroot)
defines = '-DANDROID -DPIC -D__ANDROID_API__=%s' % (v)
# the '=' in '-isystem =/usr...' is important and means prepend the sysroot path
# https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
cflags = '-isysroot %s -isystem %s -isystem %s/usr/include -isystem %s/usr/include/%s -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fPIC' % (isysroot, incl_dir, isysroot, isysroot, tools_prefix)
ldflags = '--sysroot %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 ' % (sysroot)
if not target_arch in [Architecture.ARM64, Architecture.X86_64]:
# nocopyreloc causes broken linking on arm64
ldflags += ' -Wl,-z,nocopyreloc '
......@@ -119,9 +126,13 @@ if target_arch in [Architecture.ARM, Architecture.ARMv7, Architecture.ARM64]:
elif target_arch == Architecture.X86:
cflags += ' -march=i686 '
lib_dir = os.path.join(prefix, _arch, 'lib')
if target_arch != Architecture.UNIVERSAL and not os.path.exists(lib_dir):
os.makedirs(lib_dir)
ldflags += ' -L%s' % (lib_dir,)
# Toolchain environment
os.environ['CPPFLAGS'] = '--sysroot=%s -I%s/usr/include %s' % (sysroot, sysroot, defines)
os.environ['CPPFLAGS'] = '-isysroot %s -isystem %s -isystem %s/usr/include -isystem %s/usr/include/%s %s' % (isysroot, incl_dir, isysroot, isysroot, tools_prefix, defines)
os.environ['CFLAGS'] += "%s %s -Wa,--noexecstack" % (cflags, defines)
os.environ['CXXFLAGS'] = os.environ['CFLAGS'] + ' -fno-rtti -fno-exceptions'
os.environ['LDFLAGS'] = '%s' % (ldflags,)
......
......@@ -3,7 +3,7 @@ from cerbero.config import Platform, Architecture, Distro, DistroVersion
target_platform = Platform.ANDROID
target_distro = Distro.ANDROID
target_distro_version = DistroVersion.ANDROID_GINGERBREAD
target_distro_version = DistroVersion.ANDROID_ICE_CREAM_SANDWICH
target_arch = Architecture.ARMv7
#variants = ['nodebug']
......@@ -3,7 +3,7 @@ from cerbero.config import Platform, Architecture, Distro, DistroVersion
target_platform = Platform.ANDROID
target_distro = Distro.ANDROID
target_distro_version = DistroVersion.ANDROID_GINGERBREAD
target_distro_version = DistroVersion.ANDROID_ICE_CREAM_SANDWICH
target_arch = Architecture.UNIVERSAL
universal_archs = {
......
......@@ -3,7 +3,7 @@ from cerbero.config import Platform, Architecture, Distro, DistroVersion
target_platform = Platform.ANDROID
target_distro = Distro.ANDROID
target_distro_version = DistroVersion.ANDROID_GINGERBREAD
target_distro_version = DistroVersion.ANDROID_ICE_CREAM_SANDWICH
target_arch = Architecture.X86
#variants = ['nodebug']
......@@ -3,7 +3,7 @@ from cerbero.config import Platform, Architecture, Distro, DistroVersion
target_platform = Platform.ANDROID
target_distro = Distro.ANDROID
target_distro_version = DistroVersion.ANDROID_GINGERBREAD
target_distro_version = DistroVersion.ANDROID_ICE_CREAM_SANDWICH
target_arch = Architecture.ARM
#variants = ['nodebug']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment