aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@gmail.com>2017-05-15 17:08:24 -0400
committerNathan Froyd <froydnj@gmail.com>2017-05-17 10:17:40 -0400
commit536154475cd7508744efc20388c8b3619fe9747f (patch)
tree6b0f69ea5ebe222f488352dc3b0b1cac197f54c1 /components
parentabb2985ffe96485b58f6b9e5f8b2dd3641d987b7 (diff)
downloadservo-536154475cd7508744efc20388c8b3619fe9747f.tar.gz
servo-536154475cd7508744efc20388c8b3619fe9747f.zip
fix linux cross-compilation, take 2
We were using `cfg!(target_arch)` checks, which are not correct, as those check the architecture of the compiled build script, not the clang target.
Diffstat (limited to 'components')
-rw-r--r--components/style/build_gecko.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs
index 6da76e25f42..37b8caaf851 100644
--- a/components/style/build_gecko.rs
+++ b/components/style/build_gecko.rs
@@ -153,14 +153,16 @@ mod bindings {
}
if cfg!(target_os = "linux") {
builder = builder.clang_arg("-DOS_LINUX=1");
- // We may be cross-compiling with a clang that defaults to
- // a different architecture, so we should explicitly specify
- // the bitness being used here. Specifying --target instead
- // leads to difficulties with LLVM search paths.
- if cfg!(target_arch = "x86") {
- builder = builder.clang_arg("-m32")
- } else if cfg!(target_arch = "x86_64") {
- builder = builder.clang_arg("-m64")
+ // cfg!(target_arch) will tell us the architecture that this .rs
+ // file is being compiled for. We want the architecture that
+ // the clang we're going to invoking is compiling for, which
+ // isn't necessarily the same thing. Cargo provides the
+ // (undocumented) CARGO_CFG_TARGET_ARCH for this purpose
+ let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
+ if target_arch == "x86" {
+ builder = builder.clang_arg("-m32");
+ } else if target_arch == "x86_64" {
+ builder = builder.clang_arg("-m64");
}
} else if cfg!(target_os = "solaris") {
builder = builder.clang_arg("-DOS_SOLARIS=1");