about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-09-06 01:04:41 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-09-06 01:04:41 -0500
commit8df4a768a7e98a594bd7a2d70a7bdcec14bc0518 (patch)
treeada8ec7fd7b5b5a1e555e513bd3badc586efbfc9 /src/bootstrap/compile.rs
parente77d86c142ae668038dd43594d04022cbd6bf4d8 (diff)
rustbuild: per target musl-root
config.toml now accepts a target.$TARGET.musl-root key that lets you
override the "build" musl-root value, which is set via the --musl-root
flag or via the build.musl-root key.

With this change, it's now possible to compile std for several musl
targets at once. Here's are the sample commands to do such thing:

```
$ configure \
    --enable-rustbuild \
    --target=x86_64-unknown-linux-musl,arm-unknown-linux-musleabi \
    --musl-root=/musl/x86_64-unknown-linux-musl/

$ edit config.toml && tail config.toml
[target.arm-unknown-linux-musleabi]
musl-root = "/x-tools/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/sysroot/usr"

$ make
```
Diffstat (limited to 'src/bootstrap/compile.rs')
-rw-r--r--src/bootstrap/compile.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 302ac68460c..e14317b23b4 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -59,8 +59,9 @@ pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
             cargo.env("JEMALLOC_OVERRIDE", jemalloc);
         }
     }
-    if let Some(ref p) = build.config.musl_root {
-        if target.contains("musl") {
+    if target.contains("musl") {
+        if let Some(p) = build.config.target_config[target].musl_root.as_ref()
+            .or(build.config.musl_root.as_ref()) {
             cargo.env("MUSL_ROOT", p);
         }
     }