mozilla/rust — pull request #5242 by brson (2013-03-05 22:09:02+00:00)
Title: Android cross-compile

r? @graydon

This is the bulk of the makefile work necessary to support cross-compiling with multiple toolchains. With this we can cross-compile to Android, but not run the test suite on Android. There is still some polish yet to add, but I want to get this merged.

Key changes:

The build now thinks about three kinds of triples: the build triple, which is the architecture the rust build takes place on, the host triples, which are architectures for which the rust build produces rust compliers, and the target triples, which are architectures for which the produced compilers can compile code. The host triples contain the build triple, and the target triples are a superset of the host triples.
platform.mk produces distinct toolchain variables (CC, CXX, etc.) for each target triple, and in turn most of the makefiles are now parametrized over target triples.
configure requires --android-ndk-path when arm-unknown-android is a target triple

As an example, to cross-compile to android, you configure with ../configure --target-triples=arm-unknown-android --android-ndk-path=~/dev/android-standalone-ndk-14. In this case the build triple and the host triples are automatically inferred, and the build triple added to the target triples, so if you are running on x86_64-unknown-linux-gnu, build-triple=x86_64-unknown-linux-gnu, host-triples=x86_64-unknown-linux-gnu and target-triples=x86_64-unknown-linux-gnu,arm-unknown-android.

Thanks to @yichoi who did most of this work.

Issue #4513.