aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/build_commands.py
diff options
context:
space:
mode:
authorJohn Lin <jolin@mozilla.com>2017-08-08 13:23:11 +0800
committerJohn Lin <jolin@mozilla.com>2017-08-10 12:12:54 +0800
commitfbdb2093dda5f7d2b6bfa0c48405484dc69ab4b4 (patch)
tree4236fe17ca97dc294fa33882c2f6d7a085b09a52 /python/servo/build_commands.py
parent8a48578a2601769d61ab6f8429e7b1ecb19cbb84 (diff)
downloadservo-fbdb2093dda5f7d2b6bfa0c48405484dc69ab4b4.tar.gz
servo-fbdb2093dda5f7d2b6bfa0c48405484dc69ab4b4.zip
Fix Android build errors on macOS.
- Add sysroot path to environment variable 'CPPFLAGS': When checking C preprocessor, the 'configure' script of libbacktrace uses 'CPPFLAGS' rather than 'CFLAGS' and doesn't get the correct search path. (#15758) This check passes on Linux because the '/lib/cpp' fallback is available there. - Introduce CMake toolchain file for Android cross compiling: CMake needs several variables [1] to cross compile for Android. It works (accidentally) on Linux because cmake-rs sets compilers correctly and binutils for Linux & Android are pretty much the same. [1] https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android-with-the-ndk
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r--python/servo/build_commands.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 9aae8e31320..63b7ebd19fd 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -306,6 +306,9 @@ class MachCommands(CommandBase):
"-I" + cxx_include,
"-I" + cxxabi_include])
env["NDK_ANDROID_VERSION"] = android_platform.replace("android-", "")
+ env['CPPFLAGS'] = ' '.join(["--sysroot", env['ANDROID_SYSROOT']])
+ env["CMAKE_ANDROID_ARCH_ABI"] = self.config["android"]["lib"]
+ env["CMAKE_TOOLCHAIN_FILE"] = path.join(self.android_support_dir(), "toolchain.cmake")
cargo_binary = "cargo" + BIN_SUFFIX