Skip to content

Commit 19d1929

Browse files
committed
configure: Add options for separate musl roots
This allows using the `./configure` script to enable rustbuild to compile multiple musl targets at once. We'll hopefully use this soon on our bots to produce a bunch of targets.
1 parent fd1ea13 commit 19d1929

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

configure

+6-9
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,12 @@ valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
653653
valopt armv7-linux-androideabi-ndk "" "armv7-linux-androideabi NDK standalone path"
654654
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
655655
valopt nacl-cross-path "" "NaCl SDK path (Pepper Canary is recommended). Must be absolute!"
656-
valopt musl-root "/usr/local" "MUSL root installation directory"
656+
valopt musl-root "/usr/local" "MUSL root installation directory (deprecated)"
657+
valopt musl-root-x86_64 "/usr/local" "x86_64-unknown-linux-musl install directory"
658+
valopt musl-root-i686 "/usr/local" "i686-unknown-linux-musl install directory"
659+
valopt musl-root-arm "/usr/local" "arm-unknown-linux-musleabi install directory"
660+
valopt musl-root-armhf "/usr/local" "arm-unknown-linux-musleabihf install directory"
661+
valopt musl-root-armv7 "/usr/local" "armv7-unknown-linux-musleabihf install directory"
657662
valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
658663

659664
if [ -e ${CFG_SRC_DIR}.git ]
@@ -1212,14 +1217,6 @@ do
12121217
fi
12131218
;;
12141219

1215-
1216-
x86_64-*-musl | arm-*-musleabi)
1217-
if [ ! -f $CFG_MUSL_ROOT/lib/libc.a ]
1218-
then
1219-
err "musl libc $CFG_MUSL_ROOT/lib/libc.a not found"
1220-
fi
1221-
;;
1222-
12231220
*-msvc)
12241221
# There are three builds of cmake on windows: MSVC, MinGW and Cygwin
12251222
# The Cygwin build does not have generators for Visual Studio, so

src/bootstrap/config.rs

+30
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,36 @@ impl Config {
345345
"CFG_MUSL_ROOT" if value.len() > 0 => {
346346
self.musl_root = Some(PathBuf::from(value));
347347
}
348+
"CFG_MUSL_ROOT_X86_64" if value.len() > 0 => {
349+
let target = "x86_64-unknown-linux-musl".to_string();
350+
let target = self.target_config.entry(target)
351+
.or_insert(Target::default());
352+
target.musl_root = Some(PathBuf::from(value));
353+
}
354+
"CFG_MUSL_ROOT_I686" if value.len() > 0 => {
355+
let target = "i686-unknown-linux-musl".to_string();
356+
let target = self.target_config.entry(target)
357+
.or_insert(Target::default());
358+
target.musl_root = Some(PathBuf::from(value));
359+
}
360+
"CFG_MUSL_ROOT_ARM" if value.len() > 0 => {
361+
let target = "arm-unknown-linux-musleabi".to_string();
362+
let target = self.target_config.entry(target)
363+
.or_insert(Target::default());
364+
target.musl_root = Some(PathBuf::from(value));
365+
}
366+
"CFG_MUSL_ROOT_ARMHF" if value.len() > 0 => {
367+
let target = "arm-unknown-linux-musleabihf".to_string();
368+
let target = self.target_config.entry(target)
369+
.or_insert(Target::default());
370+
target.musl_root = Some(PathBuf::from(value));
371+
}
372+
"CFG_MUSL_ROOT_ARMV7" if value.len() > 0 => {
373+
let target = "armv7-unknown-linux-musleabihf".to_string();
374+
let target = self.target_config.entry(target)
375+
.or_insert(Target::default());
376+
target.musl_root = Some(PathBuf::from(value));
377+
}
348378
"CFG_DEFAULT_AR" if value.len() > 0 => {
349379
self.rustc_default_ar = Some(value.to_string());
350380
}

0 commit comments

Comments
 (0)