mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Upgrade NDK to v15c.
This commit is contained in:
parent
0a5aab6cc2
commit
7a95cbcf91
8 changed files with 73 additions and 31 deletions
|
@ -15,7 +15,22 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
symbol_regex = re.compile(b"D \*UND\*\t(.*) (.*)$")
|
symbol_regex = re.compile(b"D \*UND\*\t(.*) (.*)$")
|
||||||
allowed_symbols = frozenset([b'unshare', b'malloc_usable_size', b'__cxa_type_match', b'signal'])
|
allowed_symbols = frozenset([
|
||||||
|
b'unshare',
|
||||||
|
b'malloc_usable_size',
|
||||||
|
b'__cxa_type_match',
|
||||||
|
b'signal',
|
||||||
|
b'tcgetattr',
|
||||||
|
b'tcsetattr',
|
||||||
|
b'__strncpy_chk2',
|
||||||
|
b'rand',
|
||||||
|
b'__read_chk',
|
||||||
|
b'fesetenv',
|
||||||
|
b'srand',
|
||||||
|
b'abs',
|
||||||
|
b'fegetenv',
|
||||||
|
b'sigemptyset',
|
||||||
|
])
|
||||||
actual_symbols = set()
|
actual_symbols = set()
|
||||||
|
|
||||||
objdump_output = subprocess.check_output([
|
objdump_output = subprocess.check_output([
|
||||||
|
|
|
@ -92,7 +92,7 @@ class MachCommands(CommandBase):
|
||||||
if not (build or emulator_x86):
|
if not (build or emulator_x86):
|
||||||
print("Must specify `--build` or `--emulator-x86` or both.")
|
print("Must specify `--build` or `--emulator-x86` or both.")
|
||||||
|
|
||||||
ndk = "android-ndk-r12b-{system}-{arch}"
|
ndk = "android-ndk-r15c-{system}-{arch}"
|
||||||
tools = "sdk-tools-{system}-4333796"
|
tools = "sdk-tools-{system}-4333796"
|
||||||
|
|
||||||
emulator_platform = "android-28"
|
emulator_platform = "android-28"
|
||||||
|
@ -105,10 +105,10 @@ class MachCommands(CommandBase):
|
||||||
"sdk-tools-windows-4333796.zip": "aa298b5346ee0d63940d13609fe6bec621384510",
|
"sdk-tools-windows-4333796.zip": "aa298b5346ee0d63940d13609fe6bec621384510",
|
||||||
|
|
||||||
# https://developer.android.com/ndk/downloads/older_releases
|
# https://developer.android.com/ndk/downloads/older_releases
|
||||||
"android-ndk-r12b-windows-x86.zip": "8e6eef0091dac2f3c7a1ecbb7070d4fa22212c04",
|
"android-ndk-r15c-windows-x86.zip": "f2e47121feb73ec34ced5e947cbf1adc6b56246e",
|
||||||
"android-ndk-r12b-windows-x86_64.zip": "337746d8579a1c65e8a69bf9cbdc9849bcacf7f5",
|
"android-ndk-r15c-windows-x86_64.zip": "970bb2496de0eada74674bb1b06d79165f725696",
|
||||||
"android-ndk-r12b-darwin-x86_64.zip": "e257fe12f8947be9f79c10c3fffe87fb9406118a",
|
"android-ndk-r15c-darwin-x86_64.zip": "ea4b5d76475db84745aa8828000d009625fc1f98",
|
||||||
"android-ndk-r12b-linux-x86_64.zip": "170a119bfa0f0ce5dc932405eaa3a7cc61b27694",
|
"android-ndk-r15c-linux-x86_64.zip": "0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2",
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchains = path.join(self.context.topdir, "android-toolchains")
|
toolchains = path.join(self.context.topdir, "android-toolchains")
|
||||||
|
|
|
@ -339,15 +339,15 @@ class MachCommands(CommandBase):
|
||||||
shutil.copy(path.join(self.android_support_dir(), "openssl.makefile"), openssl_dir)
|
shutil.copy(path.join(self.android_support_dir(), "openssl.makefile"), openssl_dir)
|
||||||
shutil.copy(path.join(self.android_support_dir(), "openssl.sh"), openssl_dir)
|
shutil.copy(path.join(self.android_support_dir(), "openssl.sh"), openssl_dir)
|
||||||
|
|
||||||
# Check if the NDK version is 12
|
# Check if the NDK version is 15
|
||||||
if not os.path.isfile(path.join(env["ANDROID_NDK"], 'source.properties')):
|
if not os.path.isfile(path.join(env["ANDROID_NDK"], 'source.properties')):
|
||||||
print("ANDROID_NDK should have file `source.properties`.")
|
print("ANDROID_NDK should have file `source.properties`.")
|
||||||
print("The environment variable ANDROID_NDK may be set at a wrong path.")
|
print("The environment variable ANDROID_NDK may be set at a wrong path.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
with open(path.join(env["ANDROID_NDK"], 'source.properties')) as ndk_properties:
|
with open(path.join(env["ANDROID_NDK"], 'source.properties')) as ndk_properties:
|
||||||
lines = ndk_properties.readlines()
|
lines = ndk_properties.readlines()
|
||||||
if lines[1].split(' = ')[1].split('.')[0] != '12':
|
if lines[1].split(' = ')[1].split('.')[0] != '15':
|
||||||
print("Currently only support NDK 12.")
|
print("Currently only support NDK 15. Please re-run `./mach bootstrap-android`.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
env["RUST_TARGET"] = target
|
env["RUST_TARGET"] = target
|
||||||
|
@ -388,13 +388,20 @@ class MachCommands(CommandBase):
|
||||||
env['PATH'] = (path.join(llvm_toolchain, "bin") + ':'
|
env['PATH'] = (path.join(llvm_toolchain, "bin") + ':'
|
||||||
+ path.join(gcc_toolchain, "bin") + ':'
|
+ path.join(gcc_toolchain, "bin") + ':'
|
||||||
+ env['PATH'])
|
+ env['PATH'])
|
||||||
env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "platforms",
|
env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "sysroot")
|
||||||
android_platform, "arch-" + android_arch)
|
|
||||||
support_include = path.join(env['ANDROID_NDK'], "sources", "android", "support", "include")
|
support_include = path.join(env['ANDROID_NDK'], "sources", "android", "support", "include")
|
||||||
|
cpufeatures_include = path.join(env['ANDROID_NDK'], "sources", "android", "cpufeatures")
|
||||||
cxx_include = path.join(env['ANDROID_NDK'], "sources", "cxx-stl",
|
cxx_include = path.join(env['ANDROID_NDK'], "sources", "cxx-stl",
|
||||||
"llvm-libc++", "libcxx", "include")
|
"llvm-libc++", "include")
|
||||||
clang_include = path.join(llvm_toolchain, "lib64", "clang", "3.8", "include")
|
clang_include = path.join(llvm_toolchain, "lib64", "clang", "3.8", "include")
|
||||||
|
cxxabi_include = path.join(env['ANDROID_NDK'], "sources", "cxx-stl",
|
||||||
|
"llvm-libc++abi", "include")
|
||||||
sysroot_include = path.join(env['ANDROID_SYSROOT'], "usr", "include")
|
sysroot_include = path.join(env['ANDROID_SYSROOT'], "usr", "include")
|
||||||
|
arch_include = path.join(sysroot_include, android_toolchain_name)
|
||||||
|
android_platform_dir = path.join(env['ANDROID_NDK'], "platforms", android_platform, "arch-" + android_arch)
|
||||||
|
arch_libs = path.join(android_platform_dir, "usr", "lib")
|
||||||
|
clang_include = path.join(llvm_toolchain, "lib64", "clang", "5.0", "include")
|
||||||
|
android_api = android_platform.replace('android-', '')
|
||||||
env['HOST_CC'] = host_cc
|
env['HOST_CC'] = host_cc
|
||||||
env['HOST_CXX'] = host_cxx
|
env['HOST_CXX'] = host_cxx
|
||||||
env['HOST_CFLAGS'] = ''
|
env['HOST_CFLAGS'] = ''
|
||||||
|
@ -403,6 +410,9 @@ class MachCommands(CommandBase):
|
||||||
env['CPP'] = path.join(llvm_toolchain, "bin", "clang") + " -E"
|
env['CPP'] = path.join(llvm_toolchain, "bin", "clang") + " -E"
|
||||||
env['CXX'] = path.join(llvm_toolchain, "bin", "clang++")
|
env['CXX'] = path.join(llvm_toolchain, "bin", "clang++")
|
||||||
env['ANDROID_TOOLCHAIN'] = gcc_toolchain
|
env['ANDROID_TOOLCHAIN'] = gcc_toolchain
|
||||||
|
env['ANDROID_TOOLCHAIN_DIR'] = gcc_toolchain
|
||||||
|
env['ANDROID_VERSION'] = android_api
|
||||||
|
env['ANDROID_PLATFORM_DIR'] = android_platform_dir
|
||||||
env['GCC_TOOLCHAIN'] = gcc_toolchain
|
env['GCC_TOOLCHAIN'] = gcc_toolchain
|
||||||
gcc_toolchain_bin = path.join(gcc_toolchain, android_toolchain_name, "bin")
|
gcc_toolchain_bin = path.join(gcc_toolchain, android_toolchain_name, "bin")
|
||||||
env['AR'] = path.join(gcc_toolchain_bin, "ar")
|
env['AR'] = path.join(gcc_toolchain_bin, "ar")
|
||||||
|
@ -425,21 +435,40 @@ class MachCommands(CommandBase):
|
||||||
"--sysroot=" + env['ANDROID_SYSROOT'],
|
"--sysroot=" + env['ANDROID_SYSROOT'],
|
||||||
"--gcc-toolchain=" + gcc_toolchain,
|
"--gcc-toolchain=" + gcc_toolchain,
|
||||||
"-isystem", sysroot_include,
|
"-isystem", sysroot_include,
|
||||||
"-L" + gcc_libs])
|
"-I" + arch_include,
|
||||||
|
"-B" + arch_libs,
|
||||||
|
"-L" + arch_libs,
|
||||||
|
"-D__ANDROID_API__=" + android_api,
|
||||||
|
])
|
||||||
env['CXXFLAGS'] = ' '.join([
|
env['CXXFLAGS'] = ' '.join([
|
||||||
"--target=" + target,
|
"--target=" + target,
|
||||||
"--sysroot=" + env['ANDROID_SYSROOT'],
|
"--sysroot=" + env['ANDROID_SYSROOT'],
|
||||||
"--gcc-toolchain=" + gcc_toolchain,
|
"--gcc-toolchain=" + gcc_toolchain,
|
||||||
"-I" + support_include,
|
"-I" + cpufeatures_include,
|
||||||
"-I" + cxx_include,
|
"-I" + cxx_include,
|
||||||
"-I" + clang_include,
|
"-I" + clang_include,
|
||||||
"-isystem", sysroot_include,
|
"-isystem", sysroot_include,
|
||||||
|
"-I" + cxxabi_include,
|
||||||
|
"-I" + clang_include,
|
||||||
|
"-I" + arch_include,
|
||||||
|
"-I" + support_include,
|
||||||
"-L" + gcc_libs,
|
"-L" + gcc_libs,
|
||||||
|
"-B" + arch_libs,
|
||||||
|
"-L" + arch_libs,
|
||||||
|
"-D__ANDROID_API__=" + android_api,
|
||||||
"-D__STDC_CONSTANT_MACROS",
|
"-D__STDC_CONSTANT_MACROS",
|
||||||
"-D__NDK_FPABI__="])
|
"-D__NDK_FPABI__=",
|
||||||
env["NDK_ANDROID_VERSION"] = android_platform.replace("android-", "")
|
])
|
||||||
env['CPPFLAGS'] = ' '.join(["--sysroot", env['ANDROID_SYSROOT']])
|
env['CPPFLAGS'] = ' '.join([
|
||||||
env["CMAKE_ANDROID_ARCH_ABI"] = android_lib
|
"--target=" + target,
|
||||||
|
"--sysroot=" + env['ANDROID_SYSROOT'],
|
||||||
|
"-I" + arch_include,
|
||||||
|
])
|
||||||
|
env["NDK_ANDROID_VERSION"] = android_api
|
||||||
|
env["ANDROID_ABI"] = android_lib
|
||||||
|
env["ANDROID_PLATFORM"] = android_platform
|
||||||
|
env["ANDROID_TOOLCHAIN_NAME"] = "clang"
|
||||||
|
env["NDK_CMAKE_TOOLCHAIN_FILE"] = path.join(env['ANDROID_NDK'], "build", "cmake", "android.toolchain.cmake")
|
||||||
env["CMAKE_TOOLCHAIN_FILE"] = path.join(self.android_support_dir(), "toolchain.cmake")
|
env["CMAKE_TOOLCHAIN_FILE"] = path.join(self.android_support_dir(), "toolchain.cmake")
|
||||||
# Set output dir for gradle aar files
|
# Set output dir for gradle aar files
|
||||||
aar_out_dir = self.android_aar_dir()
|
aar_out_dir = self.android_aar_dir()
|
||||||
|
|
|
@ -774,7 +774,7 @@ install them, let us know by filing a bug!")
|
||||||
|
|
||||||
def handle_android_target(self, target):
|
def handle_android_target(self, target):
|
||||||
if target == "armv7-linux-androideabi":
|
if target == "armv7-linux-androideabi":
|
||||||
self.config["android"]["platform"] = "android-18"
|
self.config["android"]["platform"] = "android-21"
|
||||||
self.config["android"]["target"] = target
|
self.config["android"]["target"] = target
|
||||||
self.config["android"]["toolchain_prefix"] = "arm-linux-androideabi"
|
self.config["android"]["toolchain_prefix"] = "arm-linux-androideabi"
|
||||||
self.config["android"]["arch"] = "arm"
|
self.config["android"]["arch"] = "arm"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
NDK_TOOLCHAIN_VERSION := clang
|
NDK_TOOLCHAIN_VERSION := clang
|
||||||
APP_MODULES := c++_shared servojni gstreamer
|
APP_MODULES := c++_shared servojni gstreamer
|
||||||
APP_PLATFORM := android-18
|
APP_PLATFORM := android-21
|
||||||
APP_STL:= c++_shared
|
APP_STL:= c++_shared
|
||||||
APP_ABI:= armeabi-v7a x86
|
APP_ABI:= armeabi-v7a x86
|
||||||
|
|
|
@ -11,7 +11,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.mozilla.servo"
|
applicationId "org.mozilla.servo"
|
||||||
minSdkVersion 18
|
minSdkVersion 21
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
|
@ -29,10 +29,8 @@ android {
|
||||||
main {
|
main {
|
||||||
}
|
}
|
||||||
googlevr {
|
googlevr {
|
||||||
minSdkVersion 21
|
|
||||||
}
|
}
|
||||||
oculusvr {
|
oculusvr {
|
||||||
minSdkVersion 21
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ fi
|
||||||
|
|
||||||
# For the Android SYSROOT. Can be used on the command line with --sysroot
|
# For the Android SYSROOT. Can be used on the command line with --sysroot
|
||||||
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
|
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/sysroot"
|
||||||
export SYSROOT="$ANDROID_SYSROOT"
|
export SYSROOT="$ANDROID_SYSROOT"
|
||||||
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
|
||||||
|
@ -193,7 +193,6 @@ export ARCH=$_OPENSSL_ARCH
|
||||||
|
|
||||||
# For the Android toolchain
|
# For the Android toolchain
|
||||||
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
|
|
||||||
export SYSROOT="$ANDROID_SYSROOT"
|
export SYSROOT="$ANDROID_SYSROOT"
|
||||||
#export CROSS_SYSROOT="$ANDROID_SYSROOT"
|
#export CROSS_SYSROOT="$ANDROID_SYSROOT"
|
||||||
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
@ -216,6 +215,7 @@ xCFLAGS="-DSHARED_EXTENSION=.so -DOPENSSL_PIC -DDSO_DLFCN -DHAVE_DLFCN_H \
|
||||||
-fPIC -fomit-frame-pointer \
|
-fPIC -fomit-frame-pointer \
|
||||||
-Wall -Wno-error=macro-redefined \
|
-Wall -Wno-error=macro-redefined \
|
||||||
-O3 \
|
-O3 \
|
||||||
|
-I$ANDROID_SYSROOT/usr/include/$_ANDROID_TARGET \
|
||||||
-I$ANDROID_DEV/include \
|
-I$ANDROID_DEV/include \
|
||||||
-B$ANDROID_DEV/lib -B$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr/lib \
|
-B$ANDROID_DEV/lib -B$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr/lib \
|
||||||
-L$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr/lib -L$ANDROID_NDK_ROOT/toolchains/$_ANDROID_GCC-4.9/prebuilt/$host/lib/gcc/$_ANDROID_TARGET/4.9.x/ \
|
-L$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr/lib -L$ANDROID_NDK_ROOT/toolchains/$_ANDROID_GCC-4.9/prebuilt/$host/lib/gcc/$_ANDROID_TARGET/4.9.x/ \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
set(CMAKE_SYSTEM_NAME Android)
|
|
||||||
set(CMAKE_ANDROID_NDK $ENV{ANDROID_NDK})
|
|
||||||
set(CMAKE_ANDROID_API $ENV{NDK_ANDROID_VERSION})
|
|
||||||
set(CMAKE_ANDROID_ARCH_ABI $ENV{CMAKE_ANDROID_ARCH_ABI})
|
|
||||||
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
set(ANDROID_ABI $ENV{ANDROID_ABI})
|
||||||
|
set(ANDROID_TOOLCHAIN_NAME $ENV{ANDROID_TOOLCHAIN_NAME})
|
||||||
|
set(ANDROID_PLATFORM $ENV{ANDROID_PLATFORM})
|
||||||
|
|
||||||
|
include($ENV{NDK_CMAKE_TOOLCHAIN_FILE})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue