mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
add utility musl_root method, update config.toml.example
This commit is contained in:
parent
8df4a768a7
commit
8cfc69ecea
@ -60,8 +60,7 @@ pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if target.contains("musl") {
|
if target.contains("musl") {
|
||||||
if let Some(p) = build.config.target_config[target].musl_root.as_ref()
|
if let Some(p) = build.musl_root(target) {
|
||||||
.or(build.config.musl_root.as_ref()) {
|
|
||||||
cargo.env("MUSL_ROOT", p);
|
cargo.env("MUSL_ROOT", p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,10 +115,6 @@
|
|||||||
# nightly features
|
# nightly features
|
||||||
#channel = "dev"
|
#channel = "dev"
|
||||||
|
|
||||||
# The root location of the MUSL installation directory. The library directory
|
|
||||||
# will also need to contain libunwind.a for an unwinding implementation.
|
|
||||||
#musl-root = "..."
|
|
||||||
|
|
||||||
# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
|
# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
|
||||||
# platforms to ensure that the compiler is usable by default from the build
|
# platforms to ensure that the compiler is usable by default from the build
|
||||||
# directory (as it links to a number of dynamic libraries). This may not be
|
# directory (as it links to a number of dynamic libraries). This may not be
|
||||||
@ -160,3 +156,9 @@
|
|||||||
# the NDK for the target lives. This is used to find the C compiler to link and
|
# the NDK for the target lives. This is used to find the C compiler to link and
|
||||||
# build native code.
|
# build native code.
|
||||||
#android-ndk = "/path/to/ndk"
|
#android-ndk = "/path/to/ndk"
|
||||||
|
|
||||||
|
# The root location of the MUSL installation directory. The library directory
|
||||||
|
# will also need to contain libunwind.a for an unwinding implementation. Note
|
||||||
|
# that this option only makes sense for MUSL targets that produce statically
|
||||||
|
# linked binaries
|
||||||
|
#musl-root = "..."
|
||||||
|
@ -977,6 +977,13 @@ impl Build {
|
|||||||
}
|
}
|
||||||
return base
|
return base
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the "musl root" for this `target`, if defined
|
||||||
|
fn musl_root(&self, target: &str) -> Option<&Path> {
|
||||||
|
self.config.target_config[target].musl_root.as_ref()
|
||||||
|
.or(self.config.musl_root.as_ref())
|
||||||
|
.map(|p| &**p)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Compiler<'a> {
|
impl<'a> Compiler<'a> {
|
||||||
|
@ -111,8 +111,7 @@ pub fn check(build: &mut Build) {
|
|||||||
|
|
||||||
// Make sure musl-root is valid if specified
|
// Make sure musl-root is valid if specified
|
||||||
if target.contains("musl") && !target.contains("mips") {
|
if target.contains("musl") && !target.contains("mips") {
|
||||||
match build.config.target_config[target].musl_root.as_ref()
|
match build.musl_root(target) {
|
||||||
.or(build.config.musl_root.as_ref()) {
|
|
||||||
Some(root) => {
|
Some(root) => {
|
||||||
if fs::metadata(root.join("lib/libc.a")).is_err() {
|
if fs::metadata(root.join("lib/libc.a")).is_err() {
|
||||||
panic!("couldn't find libc.a in musl dir: {}",
|
panic!("couldn't find libc.a in musl dir: {}",
|
||||||
|
Loading…
Reference in New Issue
Block a user