android/build.py: support NDK r16

This commit is contained in:
Max Kellermann 2017-12-12 09:43:48 +01:00
parent 7586a8ab2c
commit d9552d8a6d
2 changed files with 13 additions and 5 deletions

View File

@ -46,13 +46,14 @@ class AndroidNdkToolchain:
self.ndk_arch = 'arm' self.ndk_arch = 'arm'
android_abi = 'armeabi-v7a' android_abi = 'armeabi-v7a'
ndk_platform = 'android-14' ndk_platform = 'android-21'
# select the NDK compiler # select the NDK compiler
gcc_version = '4.9' gcc_version = '4.9'
ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform) ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
sysroot = os.path.join(ndk_platform_path, 'arch-' + self.ndk_arch) sysroot = os.path.join(ndk_path, 'sysroot')
target_root = os.path.join(ndk_platform_path, 'arch-' + self.ndk_arch)
install_prefix = os.path.join(arch_path, 'root') install_prefix = os.path.join(arch_path, 'root')
@ -79,8 +80,15 @@ class AndroidNdkToolchain:
self.cflags = '-Os -g ' + common_flags self.cflags = '-Os -g ' + common_flags
self.cxxflags = '-Os -g ' + common_flags self.cxxflags = '-Os -g ' + common_flags
self.cppflags = '--sysroot=' + self.sysroot + ' -isystem ' + os.path.join(install_prefix, 'include') self.cppflags = '--sysroot=' + sysroot + \
self.ldflags = '--sysroot=' + self.sysroot + ' ' + common_flags + ' -L' + os.path.join(install_prefix, 'lib') ' -isystem ' + os.path.join(install_prefix, 'include') + \
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \
' -D__ANDROID_API__=21'
self.ldflags = '--sysroot=' + sysroot + \
' -L' + os.path.join(install_prefix, 'lib') + \
' -L' + os.path.join(target_root, 'usr', 'lib') + \
' -B' + os.path.join(target_root, 'usr', 'lib') + \
' ' + common_flags
self.libs = '' self.libs = ''
self.is_arm = self.ndk_arch == 'arm' self.is_arm = self.ndk_arch == 'arm'

View File

@ -22,7 +22,7 @@
#include "EPollFD.hxx" #include "EPollFD.hxx"
#include "FatalError.hxx" #include "FatalError.hxx"
#ifdef __BIONIC__ #if defined(__BIONIC__) && __ANDROID_API__ < 21
#include <sys/syscall.h> #include <sys/syscall.h>
#include <fcntl.h> #include <fcntl.h>