Skip to content

Commit

Permalink
android/build.py: drop --sysroot, -isystem, -L, ...
Browse files Browse the repository at this point in the history
These appear to be no longer necessary (tested with NDK r20b).

Closes android/ndk#951
  • Loading branch information
MaxKellermann committed Jan 12, 2020
1 parent 2306b0d commit 8c31370
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions android/build.py
Expand Up @@ -75,20 +75,14 @@ def __init__(self, tarball_path, src_path, build_path,

ndk_arch = abi_info['ndk_arch']
android_api_level = '21'
ndk_platform = 'android-' + android_api_level

# select the NDK compiler
gcc_version = '4.9'

ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
sysroot = os.path.join(ndk_path, 'sysroot')
target_root = os.path.join(ndk_platform_path, 'arch-' + ndk_arch)

install_prefix = os.path.join(arch_path, 'root')

self.arch = arch
self.install_prefix = install_prefix
self.sysroot = sysroot

toolchain_path = os.path.join(ndk_path, 'toolchains', abi_info['toolchain_arch'] + '-' + gcc_version, 'prebuilt', build_arch)
llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch)
Expand All @@ -113,28 +107,21 @@ def __init__(self, tarball_path, src_path, build_path,

self.cflags = common_flags
self.cxxflags = common_flags
self.cppflags = '--sysroot=' + sysroot + \
' -isystem ' + os.path.join(install_prefix, 'include') + \
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch)
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') + \
self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include')
self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \
' ' + common_flags
self.ldflags = common_flags
self.libs = ''

self.is_arm = ndk_arch == 'arm'
self.is_armv7 = self.is_arm and 'armv7' in self.cflags
self.is_aarch64 = ndk_arch == 'arm64'
self.is_windows = False

libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++')
libcxx_libs_path = os.path.join(libcxx_path, 'libs', android_abi)

libstdcxx_flags = ''
libstdcxx_cxxflags = libstdcxx_flags + ' -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include')
libstdcxx_ldflags = libstdcxx_flags + ' -L' + libcxx_libs_path
libstdcxx_libs = '-lc++_static -lc++abi'
libstdcxx_cxxflags = ''
libstdcxx_ldflags = ''
libstdcxx_libs = '-static-libstdc++'

if self.is_armv7:
# On 32 bit ARM, clang generates no ".eh_frame" section;
Expand Down

0 comments on commit 8c31370

Please sign in to comment.