Auto merge of #16769 - MortimerGoro:android_archs, r=larsbergstrom

Support for Android armv7 and aarch64 target triples

<!-- Please describe your changes on the following line: -->

Support for Android armv7 and aarch64 target triples in python build scripts (build + packaging)

`--android` build parameter works as always (arm-linux-androideabi still the default)
`./mach build --release --android`

New compilation modes for android
`./mach build --release --target=arm-linux-androideabi`
`./mach build --release --target=armv7-linux-androideabi`
`./mach build --release --target=aarch64-linux-android`

See https://github.com/servo/servo/issues/11921. When all crates are ready we'll switch default android compilations to` armv7-linux-androideabi` target triple.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16769)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-13 10:24:29 -05:00 committed by GitHub
commit 286bfb96a0
9 changed files with 145 additions and 34 deletions

View file

@ -221,11 +221,14 @@ class MachCommands(CommandBase):
opts += ["-j", jobs]
if verbose:
opts += ["-v"]
if android:
target = self.config["android"]["target"]
if target:
opts += ["--target", target]
if not android:
android = self.handle_android_target(target)
self.ensure_bootstrapped(target=target)
self.ensure_clobbered()
@ -278,10 +281,15 @@ class MachCommands(CommandBase):
elif cpu_type in ["x86_64", "x86-64", "x64", "amd64"]:
host_suffix = "x86_64"
host = os_type + "-" + host_suffix
android_platform = self.config["android"]["platform"]
android_toolchain = self.config["android"]["toolchain_name"]
android_arch = "arch-" + self.config["android"]["arch"]
env['PATH'] = path.join(
env['ANDROID_NDK'], "toolchains", "arm-linux-androideabi-4.9", "prebuilt", host, "bin"
env['ANDROID_NDK'], "toolchains", android_toolchain, "prebuilt", host, "bin"
) + ':' + env['PATH']
env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "platforms", "android-18", "arch-arm")
env['ANDROID_SYSROOT'] = path.join(env['ANDROID_NDK'], "platforms", android_platform, android_arch)
support_include = path.join(env['ANDROID_NDK'], "sources", "android", "support", "include")
cxx_include = path.join(
env['ANDROID_NDK'], "sources", "cxx-stl", "llvm-libc++", "libcxx", "include")
@ -295,6 +303,7 @@ class MachCommands(CommandBase):
"-I" + support_include,
"-I" + cxx_include,
"-I" + cxxabi_include])
env["NDK_ANDROID_VERSION"] = android_platform.replace("android-", "")
cargo_binary = "cargo" + BIN_SUFFIX