diff options
author | Aric Belsito <lluixhi@gmail.com> | 2018-05-11 12:33:53 -0700 |
---|---|---|
committer | Aric Belsito <lluixhi@gmail.com> | 2018-05-11 12:33:53 -0700 |
commit | 23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe (patch) | |
tree | 72ea8a9aca7970a365b20beec9701d9b2d4e4d4e | |
parent | x11-base/xorg-server - bug #653688 patch inclusion (diff) | |
download | musl-23a3ae0b.tar.gz musl-23a3ae0b.tar.bz2 musl-23a3ae0b.zip |
dev-lang/rust: version bump to 1.25.0
12 files changed, 970 insertions, 1 deletions
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest index 71e99e10..e7153b05 100644 --- a/dev-lang/rust/Manifest +++ b/dev-lang/rust/Manifest @@ -14,5 +14,16 @@ DIST rust-1.23.0-i686-unknown-linux-gnu.tar.xz 79540368 BLAKE2B 5df0fb0fa904e7da DIST rust-1.23.0-i686-unknown-linux-musl.tar.xz 77706812 BLAKE2B d30d4359c94ce8c44a2654e9a41a8fcb5d98d330d46e6e0a98500745895f8ded97a8395970c278078b325648d6ee13af7b538a58b41a6d3b027533a40e270767 SHA512 2127391e224c5a286fdadfd46125373b13a406833634c990f94f256fa0dbf6cdf2536b93206332b1ca2c55c893c2cfbc735e96a6c1439fddf8bba87359cab313 DIST rust-1.23.0-x86_64-unknown-linux-gnu.tar.xz 82693116 BLAKE2B e327f7b97f7c359f88b4f5a678d8c110c9b50183c96bc8efe767114c83bffcf86a6632d22e9148c48ce97687393f5d5cb5439d66c0ee53853f007b2f730881f0 SHA512 a5a3aa11d04e81305d33ed50fe657dcebb8c3a1f71a0a2b54372439ff6b1b4b7d2abd9c579b27950be67921cbb41586346824faf71495fb4f3f505ed8a48ccc9 DIST rust-1.23.0-x86_64-unknown-linux-musl.tar.xz 74604492 BLAKE2B 6ba1c3e850f4dd3202c0a24fdc13ebce588152eaf61054d5a2f0ed8fffc4ef66a7507400dbb5156b3422cd45e6cbe6bf73a2a21e35bf0df93acf1dceed3c04c7 SHA512 3d3e864691c74c94b79e459ec47f3d4e2f7d2bb1cecb20f7469ac09bf8e0385a8803848c66c5834c1e95bf2888bed883deff236da4fa3c6d854099f57d2e3998 +DIST rust-1.24.1-aarch64-unknown-linux-gnu.tar.xz 80079312 BLAKE2B a9efc2144db041e19c24e442839e0beba7836be03f38b18725b14c51ff317dc63a6babb06c828b72f9fbe161403fe722d25d7220b63c98fa9bc29f9a94befcc1 SHA512 6f74275cd1d2463c0b7b50a54d1365a0518b7fbf01025a9b799019a296e3b81c0ab3e70468216d6e6f6fa59f6a8b20ceff2532aafa5d63661b662616bfa9c21e +DIST rust-1.24.1-aarch64-unknown-linux-musl.tar.xz 78536928 BLAKE2B ad7a433bfd1b9a06af15227c66af8bc0cdedeae37af17b0f261569a7dd17297dc700c9d9dfb9c5c97d07b8511dde98c50ade374bcc548bdcaff05fb1ac202a6b SHA512 5a39b53e7dbaf20d80f82a28476a0729cffb37e31e849dd5653c571a74a65b8589bcf6bcc40041c140b5ac791bc90496de588aea502a72e4a9250af68b0193ed +DIST rust-1.24.1-arm-unknown-linux-gnueabi.tar.xz 82770752 BLAKE2B dbda5149444e17430b4b929a20335dc5093515eb7699c9c50bc81bc1069cba1639e4a37ebf1001c06cd5415fe86f37a28f78c208783aa7d9c34292ca0aaadfef SHA512 2294b24d4024bd991892e0b59dc3a59fc1b2b14282b0cf3d7a55b91062cad4d4278ce835709da1b5544a2980a35714501fafb7d41f29de252c844e51eda51d98 +DIST rust-1.24.1-arm-unknown-linux-musleabi.tar.xz 80504908 BLAKE2B 022e3f5174d3d9564aca2c0573733d39643869cb78df939fa22c519e85cba50da9f293f8523f6313a44f6dc88926e9a0a6c583118b330fa74adcacd9fe79a75f SHA512 8cde83137d605825e8152bafd8c8116344bb8717d62b8eb11144f78ec696b35748b384a49631d433f99157ebe5741371c14f7660f56a7d3640707b47d4578627 +DIST rust-1.24.1-armv7-unknown-linux-gnueabihf.tar.xz 83221868 BLAKE2B 79ae6556f99f61a0aa8c5a708ae6212888942786e3c153147af02aa7c6ca5232fcfdaa5c8f53bec0966344cf21a5334b66b9332a7e632b5719eba3a5674a3e2c SHA512 b5ccf9c38e36deb9102859de977c1a5ab4954d001d78753210d0479facf9242a5ea00ed232f8946abb4175166464bd0ccd07d06be5b5ac3c9bf839cd7ece1c1a +DIST rust-1.24.1-armv7-unknown-linux-musleabihf.tar.xz 80029204 BLAKE2B 2c345a33b6c0752d6845d0032b8dc8c745256f61997c389eab2dd618f0cbbcd7b623b20d0e675ff3dd2bca36a0610304714d21b583ec85baa77a3683c0fec4e8 SHA512 7659a53741baa4dad636e632ba81438b03cc21b3f783ccd524d79399541049a4c4f07a00272ef77252bec4622c40a9998859558b3142d69548898071be18f2da +DIST rust-1.24.1-i686-unknown-linux-gnu.tar.xz 86918664 BLAKE2B 49bc796602c0e4d9879ebf3037b13cf3f7757ee2acfc4d83f603f75171d5737b886e48ff35d144d11099858836d34f2b5eebe32a55c463dbfd691c6148e568b6 SHA512 9ca287ec1ce8ec533faec2f0656902ee41fef1fe62c6e52996e1d0d8e5c6df16cae90127971a99f65de12cc0eb8f46615ab87cc55bc7b6ea62be1fbad9dd18ca +DIST rust-1.24.1-i686-unknown-linux-musl.tar.xz 83970072 BLAKE2B 34700ee73d9ad85571fcd561bc3f5c8e41e8791fbbdab3880167ee989b2ee0e7cc61e000c0cea3930e35d6819b1897521f449671e9ae9e1701d6da39dd354214 SHA512 22a5187ba9011dbddf78fdc5056455e7179f3470341d2287cb5795c7cd8d9a90fed856936a6e486af9119b106efe366221d376520cdd7e4e7a3b8d8e6322db74 +DIST rust-1.24.1-x86_64-unknown-linux-gnu.tar.xz 90298644 BLAKE2B 15430f87cd6351a9bfc4cba3c43a7e36f31b325983bd04138622f23a4fe67b412f874771fe0703b2d6065fe46af28d6a89fb0387636524c46e0cefa75b78c3dc SHA512 f263e8bee6bff1b3a4c8716248aa78c99f86768f03c7f21fc239203ade6e3b466bfec35e138b021e84b7ae8dffb41c4d045e3c98437f4549d801a2f687c4b92d +DIST rust-1.24.1-x86_64-unknown-linux-musl.tar.xz 81773076 BLAKE2B c6d21d5740ca259c98a1a53a40b86cdca939c5b107ff7174b420dca7a1c90f71219e8b498c1485a3881d88e86caca7d19a81100614bd78ad5790f8d36a5beff4 SHA512 7fc3fd6a5a23b7f43ebc9c90401be3182ff9f68ec4910a71e9b1ee1c198508e759a342f9e42eab3b19dc5465e3158a6a8f7fcc2753cc4c88bdb06ae99d66b638 DIST rustc-1.21.0-src.tar.xz 34212448 BLAKE2B 608fa85f4391f3f15db2d1b6f88df8f6811ba460d727c2ed366972f884dd3856711ed50ab0320d939885004d72a8d604be0aa8a65e6d61bd2e1ce33b5aee01be SHA512 63b5c247ef7028c59bb246b96cb9917476d6d13cf68b37956e290248a1e53de3e4dbfad1dcae3c5c2cacc73c9dd212c50e45902c7d913fadeaac81db630bc951 -DIST rustc-1.23.0-src.tar.xz 38490016 BLAKE2B 85baeb5535cb95f7d4ceff71580d59d5ce3a5b13adaa067ffbfc7db26e947d1c0b939dad4846c279cc8d174cbf61bd331b9298236ce03630cedffcd6cc8a4e8c SHA512 2e605121dd5152c1a898b263d634b0ac55c7ea79c7fbc9f72c432e68fb397618a267283f3dfb0f77d5e189720d788b1937e8114a1f71bdb10ddd4cbaae92fa80 +DIST rustc-1.23.0-src.tar.xz 31993 BLAKE2B a9887ac977c60ad9db4ea387c53df3d4f0392676b705bd5ec3640b1290fd3d0dc481815047de50d009a3acd0af720d0485498f1c6399255eae87f5d26b2f30e5 SHA512 2bd8b9af21ffe61b241d86f8725c657f1c70628755fba6e6c2706a296b6495795a615bcfdcb39a8bf25defc8204cf280cc27031c1b5d86906fd4a58501cc2a70 +DIST rustc-1.25.0-src.tar.xz 56108536 BLAKE2B c4a5e56b0e345b5ccde699f68659ac10793670047d2806bdab856d56aa5b960a0df5b947f7c0a7dadfcb7edbe4f9c1a71a94c5f240e91c93296a90d232030645 SHA512 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2 diff --git a/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch new file mode 100644 index 00000000..d307a953 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch @@ -0,0 +1,44 @@ +From 9da9c2f708e0de229a22a2fa8caf34d4c1d6346b Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Fri, 8 Sep 2017 00:05:18 -0500 +Subject: [PATCH 1/8] Require static native libraries when linking static + executables + +--- + src/librustc_trans/back/link.rs | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs +index 87464ab0d0..395ee2a03b 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -1329,8 +1329,8 @@ fn add_upstream_rust_crates(cmd: &mut Linker, + } + } + +-// Link in all of our upstream crates' native dependencies. Remember that +-// all of these upstream native dependencies are all non-static ++// Link in all of our upstream crates' native dependencies. Remember that when ++// linking libraries, these upstream native dependencies are all non-static + // dependencies. We've got two cases then: + // + // 1. The upstream crate is an rlib. In this case we *must* link in the +@@ -1370,7 +1370,14 @@ fn add_upstream_native_libraries(cmd: &mut Linker, + continue + } + match lib.kind { +- NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()), ++ NativeLibraryKind::NativeUnknown => { ++ // When creating executables, match library linkage to that of the executable. ++ if crate_type == config::CrateTypeExecutable && sess.crt_static() { ++ cmd.link_staticlib(&lib.name.as_str()) ++ } else { ++ cmd.link_dylib(&lib.name.as_str()) ++ } ++ }, + NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()), + NativeLibraryKind::NativeStaticNobundle => { + // Link "static-nobundle" native libs only if the crate they originate from +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch new file mode 100644 index 00000000..6b50eda3 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch @@ -0,0 +1,416 @@ +From 618ef1bcd4db1c556d482ee3b4292a3746542e57 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Fri, 8 Sep 2017 22:11:14 -0500 +Subject: [PATCH 2/8] Remove -nostdlib and musl_root from musl targets + +--- + config.toml.example | 6 ----- + src/bootstrap/bin/rustc.rs | 10 ------- + src/bootstrap/cc_detect.rs | 27 +++---------------- + src/bootstrap/compile.rs | 31 ---------------------- + src/bootstrap/config.rs | 7 ----- + src/bootstrap/configure.py | 20 -------------- + src/bootstrap/lib.rs | 8 ------ + src/bootstrap/sanity.rs | 30 +-------------------- + .../docker/dist-i586-gnu-i586-i686-musl/Dockerfile | 2 -- + src/ci/docker/dist-various-1/Dockerfile | 6 ----- + src/ci/docker/dist-x86_64-musl/Dockerfile | 1 - + src/librustc_back/target/linux_musl_base.rs | 15 ----------- + 12 files changed, 4 insertions(+), 159 deletions(-) + +diff --git a/config.toml.example b/config.toml.example +index f153562a53..db08485322 100644 +--- a/config.toml.example ++++ b/config.toml.example +@@ -372,12 +372,6 @@ + # only use static libraries. If unset, the target's default linkage is used. + #crt-static = false + +-# 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 = "..." +- + # Used in testing for configuring where the QEMU images are located, you + # probably don't want to use this. + #qemu-rootfs = "..." +diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs +index 55d104b182..afd28c1b66 100644 +--- a/src/bootstrap/bin/rustc.rs ++++ b/src/bootstrap/bin/rustc.rs +@@ -30,7 +30,6 @@ + extern crate bootstrap; + + use std::env; +-use std::ffi::OsString; + use std::str::FromStr; + use std::path::PathBuf; + use std::process::{Command, ExitStatus}; +@@ -111,15 +110,6 @@ fn main() { + cmd.arg("-Cprefer-dynamic"); + } + +- // Help the libc crate compile by assisting it in finding the MUSL +- // native libraries. +- if let Some(s) = env::var_os("MUSL_ROOT") { +- let mut root = OsString::from("native="); +- root.push(&s); +- root.push("/lib"); +- cmd.arg("-L").arg(&root); +- } +- + // Override linker if necessary. + if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") { + cmd.arg(format!("-Clinker={}", target_linker)); +diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs +index e531fdaf29..3f49a2cfec 100644 +--- a/src/bootstrap/cc_detect.rs ++++ b/src/bootstrap/cc_detect.rs +@@ -84,7 +84,7 @@ pub fn find(build: &mut Build) { + if let Some(cc) = config.and_then(|c| c.cc.as_ref()) { + cfg.compiler(cc); + } else { +- set_compiler(&mut cfg, Language::C, target, config, build); ++ set_compiler(&mut cfg, Language::C, target, config); + } + + let compiler = cfg.get_compiler(); +@@ -112,7 +112,7 @@ pub fn find(build: &mut Build) { + if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) { + cfg.compiler(cxx); + } else { +- set_compiler(&mut cfg, Language::CPlusPlus, host, config, build); ++ set_compiler(&mut cfg, Language::CPlusPlus, host, config); + } + let compiler = cfg.get_compiler(); + build.verbose(&format!("CXX_{} = {:?}", host, compiler.path())); +@@ -123,8 +123,7 @@ pub fn find(build: &mut Build) { + fn set_compiler(cfg: &mut cc::Build, + compiler: Language, + target: Interned<String>, +- config: Option<&Target>, +- build: &Build) { ++ config: Option<&Target>) { + match &*target { + // When compiling for android we may have the NDK configured in the + // config.toml in which case we look there. Otherwise the default +@@ -161,26 +160,6 @@ fn set_compiler(cfg: &mut cc::Build, + } + } + +- "mips-unknown-linux-musl" => { +- if cfg.get_compiler().path().to_str() == Some("gcc") { +- cfg.compiler("mips-linux-musl-gcc"); +- } +- } +- "mipsel-unknown-linux-musl" => { +- if cfg.get_compiler().path().to_str() == Some("gcc") { +- cfg.compiler("mipsel-linux-musl-gcc"); +- } +- } +- +- t if t.contains("musl") => { +- if let Some(root) = build.musl_root(target) { +- let guess = root.join("bin/musl-gcc"); +- if guess.exists() { +- cfg.compiler(guess); +- } +- } +- } +- + _ => {} + } + } +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs +index c85b04ddc0..c01c2341dd 100644 +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -78,13 +78,6 @@ impl Step for Std { + }); + println!("Uplifting stage1 std ({} -> {})", from.host, target); + +- // Even if we're not building std this stage, the new sysroot must +- // still contain the musl startup objects. +- if target.contains("musl") { +- let libdir = builder.sysroot_libdir(compiler, target); +- copy_musl_third_party_objects(build, target, &libdir); +- } +- + builder.ensure(StdLink { + compiler: from, + target_compiler: compiler, +@@ -97,11 +90,6 @@ impl Step for Std { + println!("Building stage{} std artifacts ({} -> {})", compiler.stage, + &compiler.host, target); + +- if target.contains("musl") { +- let libdir = builder.sysroot_libdir(compiler, target); +- copy_musl_third_party_objects(build, target, &libdir); +- } +- + let out_dir = build.stage_out(compiler, Mode::Libstd); + build.clear_if_dirty(&out_dir, &builder.rustc(compiler)); + let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build"); +@@ -119,20 +107,6 @@ impl Step for Std { + } + } + +-/// Copies the crt(1,i,n).o startup objects +-/// +-/// Since musl supports fully static linking, we can cross link for it even +-/// with a glibc-targeting toolchain, given we have the appropriate startup +-/// files. As those shipped with glibc won't work, copy the ones provided by +-/// musl so we have them on linux-gnu hosts. +-fn copy_musl_third_party_objects(build: &Build, +- target: Interned<String>, +- into: &Path) { +- for &obj in &["crt1.o", "crti.o", "crtn.o"] { +- copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj)); +- } +-} +- + /// Configure cargo to compile the standard library, adding appropriate env vars + /// and such. + pub fn std_cargo(build: &Build, +@@ -174,11 +148,6 @@ pub fn std_cargo(build: &Build, + cargo.env("JEMALLOC_OVERRIDE", jemalloc); + } + } +- if target.contains("musl") { +- if let Some(p) = build.musl_root(target) { +- cargo.env("MUSL_ROOT", p); +- } +- } + } + + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index f3810ac869..87f4fb0fae 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -119,8 +119,6 @@ pub struct Config { + pub test_miri: bool, + pub save_toolstates: Option<PathBuf>, + +- // Fallback musl-root for all targets +- pub musl_root: Option<PathBuf>, + pub prefix: Option<PathBuf>, + pub sysconfdir: Option<PathBuf>, + pub datadir: Option<PathBuf>, +@@ -152,7 +150,6 @@ pub struct Target { + pub linker: Option<PathBuf>, + pub ndk: Option<PathBuf>, + pub crt_static: Option<bool>, +- pub musl_root: Option<PathBuf>, + pub qemu_rootfs: Option<PathBuf>, + } + +@@ -277,7 +274,6 @@ struct Rust { + backtrace: Option<bool>, + default_linker: Option<String>, + channel: Option<String>, +- musl_root: Option<String>, + rpath: Option<bool>, + optimize_tests: Option<bool>, + debuginfo_tests: Option<bool>, +@@ -304,7 +300,6 @@ struct TomlTarget { + linker: Option<String>, + android_ndk: Option<String>, + crt_static: Option<bool>, +- musl_root: Option<String>, + qemu_rootfs: Option<String>, + } + +@@ -479,7 +474,6 @@ impl Config { + set(&mut config.wasm_syscall, rust.wasm_syscall); + config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false); + config.rustc_default_linker = rust.default_linker.clone(); +- config.musl_root = rust.musl_root.clone().map(PathBuf::from); + config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from); + + if let Some(ref backends) = rust.codegen_backends { +@@ -513,7 +507,6 @@ impl Config { + target.ar = cfg.ar.clone().map(PathBuf::from); + target.linker = cfg.linker.clone().map(PathBuf::from); + target.crt_static = cfg.crt_static.clone(); +- target.musl_root = cfg.musl_root.clone().map(PathBuf::from); + target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from); + + config.target_config.insert(INTERNER.intern_string(triple.clone()), target); +diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py +index 99a3ee4e4c..5357d3a3fb 100755 +--- a/src/bootstrap/configure.py ++++ b/src/bootstrap/configure.py +@@ -106,26 +106,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk", + "aarch64-linux-android NDK standalone path") + v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk", + "x86_64-linux-android NDK standalone path") +-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root", +- "MUSL root installation directory (deprecated)") +-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root", +- "x86_64-unknown-linux-musl install directory") +-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root", +- "i586-unknown-linux-musl install directory") +-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root", +- "i686-unknown-linux-musl install directory") +-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root", +- "arm-unknown-linux-musleabi install directory") +-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root", +- "arm-unknown-linux-musleabihf install directory") +-v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root", +- "armv7-unknown-linux-musleabihf install directory") +-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root", +- "aarch64-unknown-linux-musl install directory") +-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root", +- "mips-unknown-linux-musl install directory") +-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root", +- "mipsel-unknown-linux-musl install directory") + v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", + "rootfs in qemu testing, you probably don't want to use this") + v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", +diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs +index afd740ce54..428f3ad2ba 100644 +--- a/src/bootstrap/lib.rs ++++ b/src/bootstrap/lib.rs +@@ -700,14 +700,6 @@ impl Build { + } + } + +- /// Returns the "musl root" for this `target`, if defined +- fn musl_root(&self, target: Interned<String>) -> Option<&Path> { +- self.config.target_config.get(&target) +- .and_then(|t| t.musl_root.as_ref()) +- .or(self.config.musl_root.as_ref()) +- .map(|p| &**p) +- } +- + /// Returns whether the target will be tested using the `remote-test-client` + /// and `remote-test-server` binaries. + fn remote_tested(&self, target: Interned<String>) -> bool { +diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs +index 5184cca653..defc85e93f 100644 +--- a/src/bootstrap/sanity.rs ++++ b/src/bootstrap/sanity.rs +@@ -21,7 +21,7 @@ + use std::collections::HashMap; + use std::env; + use std::ffi::{OsString, OsStr}; +-use std::fs::{self, File}; ++use std::fs::File; + use std::io::Read; + use std::path::PathBuf; + use std::process::Command; +@@ -169,34 +169,6 @@ pub fn check(build: &mut Build) { + panic!("the iOS target is only supported on macOS"); + } + +- // Make sure musl-root is valid +- if target.contains("musl") { +- // If this is a native target (host is also musl) and no musl-root is given, +- // fall back to the system toolchain in /usr before giving up +- if build.musl_root(*target).is_none() && build.config.build == *target { +- let target = build.config.target_config.entry(target.clone()) +- .or_insert(Default::default()); +- target.musl_root = Some("/usr".into()); +- } +- match build.musl_root(*target) { +- Some(root) => { +- if fs::metadata(root.join("lib/libc.a")).is_err() { +- panic!("couldn't find libc.a in musl dir: {}", +- root.join("lib").display()); +- } +- if fs::metadata(root.join("lib/libunwind.a")).is_err() { +- panic!("couldn't find libunwind.a in musl dir: {}", +- root.join("lib").display()); +- } +- } +- None => { +- panic!("when targeting MUSL either the rust.musl-root \ +- option or the target.$TARGET.musl-root option must \ +- be specified in config.toml") +- } +- } +- } +- + if target.contains("msvc") { + // There are three builds of cmake on windows: MSVC, MinGW, and + // Cygwin. The Cygwin build does not have generators for Visual +diff --git a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile +index 035846b4f6..5eab5933c5 100644 +--- a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile ++++ b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile +@@ -31,8 +31,6 @@ RUN sh /scripts/sccache.sh + + ENV RUST_CONFIGURE_ARGS \ + --target=i686-unknown-linux-musl,i586-unknown-linux-gnu \ +- --musl-root-i586=/musl-i586 \ +- --musl-root-i686=/musl-i686 \ + --enable-extended + + # Newer binutils broke things on some vms/distros (i.e., linking against +diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile +index c83f101d0a..0b9ec9de86 100644 +--- a/src/ci/docker/dist-various-1/Dockerfile ++++ b/src/ci/docker/dist-various-1/Dockerfile +@@ -90,12 +90,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ + + ENV RUST_CONFIGURE_ARGS \ + --target=$TARGETS \ +- --musl-root-arm=/musl-arm \ +- --musl-root-armhf=/musl-armhf \ +- --musl-root-armv7=/musl-armv7 \ +- --musl-root-aarch64=/musl-aarch64 \ +- --musl-root-mips=/musl-mips \ +- --musl-root-mipsel=/musl-mipsel \ + --enable-emscripten + + ENV SCRIPT python2.7 ../x.py dist --target $TARGETS +diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile +index c1061309c3..2fb9481479 100644 +--- a/src/ci/docker/dist-x86_64-musl/Dockerfile ++++ b/src/ci/docker/dist-x86_64-musl/Dockerfile +@@ -31,7 +31,6 @@ RUN sh /scripts/sccache.sh + + ENV RUST_CONFIGURE_ARGS \ + --target=x86_64-unknown-linux-musl \ +- --musl-root-x86_64=/musl-x86_64 \ + --enable-extended + + # Newer binutils broke things on some vms/distros (i.e., linking against +diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs +index 6e5e139715..d99cb55cc5 100644 +--- a/src/librustc_back/target/linux_musl_base.rs ++++ b/src/librustc_back/target/linux_musl_base.rs +@@ -14,10 +14,6 @@ use target::TargetOptions; + pub fn opts() -> TargetOptions { + let mut base = super::linux_base::opts(); + +- // Make sure that the linker/gcc really don't pull in anything, including +- // default objects, libs, etc. +- base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string()); +- + // At least when this was tested, the linker would not add the + // `GNU_EH_FRAME` program header to executables generated, which is required + // when unwinding to locate the unwinding information. I'm not sure why this +@@ -49,17 +45,6 @@ pub fn opts() -> TargetOptions { + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string()); + base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]); + +- // When generating a statically linked executable there's generally some +- // small setup needed which is listed in these files. These are provided by +- // a musl toolchain and are linked by default by the `musl-gcc` script. Note +- // that `gcc` also does this by default, it just uses some different files. +- // +- // Each target directory for musl has these object files included in it so +- // they'll be included from there. +- base.pre_link_objects_exe.push("crt1.o".to_string()); +- base.pre_link_objects_exe.push("crti.o".to_string()); +- base.post_link_objects.push("crtn.o".to_string()); +- + // These targets statically link libc by default + base.crt_static_default = true; + // These targets allow the user to choose between static and dynamic linking. +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch new file mode 100644 index 00000000..26ecebf9 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch @@ -0,0 +1,25 @@ +From b02bdc170e02f3ee226728ddd912b5d4171677d2 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 30 Nov 2017 08:15:51 -0600 +Subject: [PATCH 3/8] Switch musl targets to link dynamically by default + +--- + src/librustc_back/target/linux_musl_base.rs | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs +index d99cb55cc5..bb786bf0f3 100644 +--- a/src/librustc_back/target/linux_musl_base.rs ++++ b/src/librustc_back/target/linux_musl_base.rs +@@ -45,8 +45,6 @@ pub fn opts() -> TargetOptions { + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string()); + base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]); + +- // These targets statically link libc by default +- base.crt_static_default = true; + // These targets allow the user to choose between static and dynamic linking. + base.crt_static_respected = true; + +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch new file mode 100644 index 00000000..7e992b58 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch @@ -0,0 +1,24 @@ +From a508441f79b41f3de9bc5fd03bcc7c1fce205efb Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sat, 9 Sep 2017 00:14:16 -0500 +Subject: [PATCH 4/8] Prefer libgcc_eh over libunwind for musl + +--- + src/libunwind/lib.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs +index 5347c78121..e9be63f282 100644 +--- a/src/libunwind/lib.rs ++++ b/src/libunwind/lib.rs +@@ -36,6 +36,6 @@ cfg_if! { + } + + #[cfg(target_env = "musl")] +-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] ++#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))] + #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] + extern {} +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch new file mode 100644 index 00000000..ddef113e --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch @@ -0,0 +1,26 @@ +From 2dca67022c550b8ea69623fcaa04bee10112ea77 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Fri, 8 Sep 2017 00:04:29 -0500 +Subject: [PATCH 5/8] Fix LLVM build + +--- + src/bootstrap/lib.rs | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs +index 428f3ad2ba..a3aaa3c57f 100644 +--- a/src/bootstrap/lib.rs ++++ b/src/bootstrap/lib.rs +@@ -642,7 +642,8 @@ impl Build { + // cc-rs because the build scripts will determine that for themselves. + let mut base = self.cc[&target].args().iter() + .map(|s| s.to_string_lossy().into_owned()) +- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) ++ .filter(|s| !s.starts_with("-O") && !s.starts_with("/O") ++ && !s.starts_with("-static")) + .collect::<Vec<_>>(); + + // If we're compiling on macOS then we add a few unconditional flags +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch new file mode 100644 index 00000000..af86047a --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch @@ -0,0 +1,36 @@ +From 7fceddea2b70f3d0e898c8be820cd2d7fb4dfc32 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sat, 2 Dec 2017 17:25:44 -0600 +Subject: [PATCH 6/8] Fix rustdoc for cross targets + +musl can't handle wrong-architecture libraries in LD_LIBRARY_PATH. +--- + src/bootstrap/bin/rustdoc.rs | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs +index 389b504c64..b7b77eb431 100644 +--- a/src/bootstrap/bin/rustdoc.rs ++++ b/src/bootstrap/bin/rustdoc.rs +@@ -34,9 +34,6 @@ fn main() { + Err(_) => 0, + }; + +- let mut dylib_path = bootstrap::util::dylib_path(); +- dylib_path.insert(0, PathBuf::from(libdir)); +- + let mut cmd = Command::new(rustdoc); + cmd.args(&args) + .arg("--cfg") +@@ -46,7 +43,7 @@ fn main() { + .arg("--sysroot") + .arg(sysroot) + .env(bootstrap::util::dylib_path_var(), +- env::join_paths(&dylib_path).unwrap()); ++ PathBuf::from(libdir)); + + // Force all crates compiled by this compiler to (a) be unstable and (b) + // allow the `rustc_private` feature to link to other unstable crates +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch new file mode 100644 index 00000000..8ee65a99 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch @@ -0,0 +1,41 @@ +From 1e9d653ccb0da803b1f30ded65c2dd727c89100c Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Mon, 11 Sep 2017 11:21:56 -0500 +Subject: [PATCH 7/8] Add openssl configuration for musl targets + +--- + src/bootstrap/native.rs | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs +index 3c91cf3ecc..198ac36789 100644 +--- a/src/bootstrap/native.rs ++++ b/src/bootstrap/native.rs +@@ -457,8 +457,11 @@ impl Step for Openssl { + "arm-linux-androideabi" => "android", + "arm-unknown-linux-gnueabi" => "linux-armv4", + "arm-unknown-linux-gnueabihf" => "linux-armv4", +- "armv7-linux-androideabi" => "android-armv7", ++ "arm-unknown-linux-musleabi" => "linux-armv4", ++ "arm-unknown-linux-musleabihf" => "linux-armv4", ++ "armv7-linux-androideabi" => "android-armv4", + "armv7-unknown-linux-gnueabihf" => "linux-armv4", ++ "armv7-unknown-linux-musleabihf" => "linux-armv4", + "i586-unknown-linux-gnu" => "linux-elf", + "i586-unknown-linux-musl" => "linux-elf", + "i686-apple-darwin" => "darwin-i386-cc", +@@ -468,9 +471,11 @@ impl Step for Openssl { + "i686-unknown-linux-musl" => "linux-elf", + "i686-unknown-netbsd" => "BSD-x86-elf", + "mips-unknown-linux-gnu" => "linux-mips32", ++ "mips-unknown-linux-musl" => "linux-mips32", + "mips64-unknown-linux-gnuabi64" => "linux64-mips64", + "mips64el-unknown-linux-gnuabi64" => "linux64-mips64", + "mipsel-unknown-linux-gnu" => "linux-mips32", ++ "mipsel-unknown-linux-musl" => "linux-mips32", + "powerpc-unknown-linux-gnu" => "linux-ppc", + "powerpc64-unknown-linux-gnu" => "linux-ppc64", + "powerpc64le-unknown-linux-gnu" => "linux-ppc64le", +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch new file mode 100644 index 00000000..5a69455b --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch @@ -0,0 +1,36 @@ +From d1cc6048465f4cc7a06495b424693aa0c27f3137 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Wed, 10 Jan 2018 13:36:41 -0600 +Subject: [PATCH 8/8] Don't pass CFLAGS to the C++ compiler + +--- + src/bootstrap/builder.rs | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs +index fcb78c479f..55848d6971 100644 +--- a/src/bootstrap/builder.rs ++++ b/src/bootstrap/builder.rs +@@ -689,7 +689,7 @@ impl<'a> Builder<'a> { + + let cflags = self.cflags(target).join(" "); + cargo.env(format!("CFLAGS_{}", target), cflags.clone()) +- .env("CFLAGS", cflags.clone()); ++ .env("CFLAGS", cflags); + + if let Some(ar) = self.ar(target) { + let ranlib = format!("{} s", ar.display()); +@@ -701,9 +701,7 @@ impl<'a> Builder<'a> { + + if let Ok(cxx) = self.cxx(target) { + cargo.env(format!("CXX_{}", target), cxx) +- .env("CXX", cxx) +- .env(format!("CXXFLAGS_{}", target), cflags.clone()) +- .env("CXXFLAGS", cflags); ++ .env("CXX", cxx); + } + } + +-- +2.16.1 + diff --git a/dev-lang/rust/files/1.25.0/0009-liblibc.patch b/dev-lang/rust/files/1.25.0/0009-liblibc.patch new file mode 100644 index 00000000..f7867ac0 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0009-liblibc.patch @@ -0,0 +1,17 @@ +diff --git a/src/liblibc/src/unix/mod.rs b/src/liblibc/src/unix/mod.rs +index 134f44c5a..7e5c9b6c5 100644 +--- a/src/liblibc/src/unix/mod.rs ++++ b/src/liblibc/src/unix/mod.rs +@@ -277,11 +277,7 @@ cfg_if! { + // cargo build, don't pull in anything extra as the libstd dep + // already pulls in all libs. + } else if #[cfg(target_env = "musl")] { +- #[cfg_attr(feature = "stdbuild", +- link(name = "c", kind = "static", +- cfg(target_feature = "crt-static")))] +- #[cfg_attr(feature = "stdbuild", +- link(name = "c", cfg(not(target_feature = "crt-static"))))] ++ #[link(name = "c")] + extern {} + } else if #[cfg(target_os = "emscripten")] { + #[link(name = "c")] diff --git a/dev-lang/rust/files/1.25.0/0010-llvm.patch b/dev-lang/rust/files/1.25.0/0010-llvm.patch new file mode 100644 index 00000000..3f9f4091 --- /dev/null +++ b/dev-lang/rust/files/1.25.0/0010-llvm.patch @@ -0,0 +1,20 @@ +diff --git a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def +index 579d23004d1..6cd9d2722fb 100644 +--- a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def ++++ b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def +@@ -27,6 +27,15 @@ + #define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr, + #endif + ++// avoid name conflicts with musl-libc ++#undef fopen64 ++#undef fseeko64 ++#undef ftello64 ++#undef fstat64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + /// void *new(unsigned int); + TLI_DEFINE_ENUM_INTERNAL(msvc_new_int) + TLI_DEFINE_STRING_INTERNAL("??2@YAPAXI@Z") diff --git a/dev-lang/rust/rust-1.25.0.ebuild b/dev-lang/rust/rust-1.25.0.ebuild new file mode 100644 index 00000000..2f0b32ac --- /dev/null +++ b/dev-lang/rust/rust-1.25.0.ebuild @@ -0,0 +1,273 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +LLVM_MAX_SLOT=6 +PYTHON_COMPAT=( python2_7 ) + +inherit llvm multiprocessing python-any-r1 versionator toolchain-funcs + +if [[ ${PV} = *beta* ]]; then + betaver=${PV//*beta} + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" + MY_P="rustc-beta" + SLOT="beta/${PV}" + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz" + KEYWORDS="" +else + ABI_VER="$(get_version_component_range 1-2)" + SLOT="stable/${ABI_VER}" + MY_P="rustc-${PV}" + SRC="${MY_P}-src.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64 ~x86" +fi + +case "${CHOST}" in + armv7*) + RUSTARCH=armv7 ;; + arm*) + RUSTARCH=arm ;; + *) + RUSTARCH=${CHOST%%-*} ;; +esac +case "${CHOST}" in + armv7a-hardfloat-*) + RUSTLIBC=${ELIBC/glibc/gnu}eabihf ;; + arm*) + RUSTLIBC=${CHOST##*-} ;; + *) + RUSTLIBC=${ELIBC/glibc/gnu} ;; +esac +RUSTHOST=${RUSTARCH}-unknown-${KERNEL}-${RUSTLIBC} + +RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).1" + +CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0" + +DESCRIPTION="Systems programming language from Mozilla" +HOMEPAGE="http://www.rust-lang.org/" + +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz + amd64? ( + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-gnu.tar.xz ) + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-musl.tar.xz ) + ) + arm? ( + elibc_glibc? ( + https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-gnueabi.tar.xz + https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-gnueabihf.tar.xz + ) + elibc_musl? ( + https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-musleabi.tar.xz + https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-musleabihf.tar.xz + ) + ) + arm64? ( + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-gnu.tar.xz ) + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-musl.tar.xz ) + ) + x86? ( + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-gnu.tar.xz ) + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-musl.tar.xz ) + ) +" + +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" + +IUSE="debug doc extended jemalloc libressl system-llvm" + +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 + jemalloc? ( dev-libs/jemalloc ) + system-llvm? ( sys-devel/llvm ) + extended? ( + libressl? ( + >=dev-libs/libressl-2.5.0:= + <dev-libs/libressl-2.7.0:= + ) + !libressl? ( dev-libs/openssl:0= ) + net-libs/http-parser:0/2.6.2 + net-libs/libssh2:= + net-misc/curl:=[ssl] + sys-libs/zlib:= + !dev-util/rustfmt + !dev-util/cargo + ) +" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + || ( + >=sys-devel/gcc-4.7 + >=sys-devel/clang-3.5 + ) + !system-llvm? ( + dev-util/cmake + dev-util/ninja + ) +" +PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" + +PATCHES=( + "${FILESDIR}/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch" + "${FILESDIR}/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" + "${FILESDIR}/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch" + "${FILESDIR}/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch" + "${FILESDIR}/1.25.0/0005-Fix-LLVM-build.patch" + "${FILESDIR}/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch" + "${FILESDIR}/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch" + "${FILESDIR}/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" + "${FILESDIR}/1.25.0/0009-liblibc.patch" + "${FILESDIR}/1.25.0/0010-llvm.patch" +) + +S="${WORKDIR}/${MY_P}-src" + +toml_usex() { + usex "$1" true false +} + +pkg_setup() { + export RUST_BACKTRACE=1 + if use system-llvm; then + llvm_pkg_setup + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" + + export LLVM_LINK_SHARED=1 + export RUSTFLAGS="$RUSTFLAGS -Lnative=$("$llvm_config" --libdir)" + fi + + python-any-r1_pkg_setup +} + +src_prepare() { + default + + "${WORKDIR}/rust-${RUST_STAGE0_VERSION}-${RUSTHOST}/install.sh" \ + --prefix="${WORKDIR}/stage0" \ + --components=rust-std-${RUSTHOST},rustc,cargo \ + --disable-ldconfig \ + || die +} + +src_configure() { + cat <<- EOF > "${S}"/config.toml + [llvm] + ninja = true + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + [build] + build = "${RUSTHOST}" + host = ["${RUSTHOST}"] + target = ["${RUSTHOST}"] + cargo = "${WORKDIR}/stage0/bin/cargo" + rustc = "${WORKDIR}/stage0/bin/rustc" + docs = $(toml_usex doc) + compiler-docs = $(toml_usex doc) + submodules = false + python = "${EPYTHON}" + locked-deps = true + vendor = true + verbose = 2 + extended = $(toml_usex extended) + [install] + prefix = "${EPREFIX}/usr" + libdir = "$(get_libdir)" + docdir = "share/doc/${P}" + mandir = "share/${P}/man" + [rust] + optimize = $(toml_usex !debug) + debuginfo = $(toml_usex debug) + debug-assertions = $(toml_usex debug) + use-jemalloc = $(toml_usex jemalloc) + default-linker = "$(tc-getCC)" + channel = "${SLOT%%/*}" + rpath = false + optimize-tests = $(toml_usex !debug) + dist-src = false + [dist] + src-tarball = false + [target.${RUSTHOST}] + cc = "$(tc-getBUILD_CC)" + cxx = "$(tc-getBUILD_CXX)" + linker = "$(tc-getCC)" + ar = "$(tc-getAR)" + EOF + use system-llvm && cat <<- EOF >> "${S}"/config.toml + llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" + EOF +} + +src_compile() { + ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die +} + +src_install() { + env DESTDIR="${D}" ./x.py install -j$(makeopts_jobs) || die + + rm "${D}/usr/$(get_libdir)/rustlib/components" || die + rm "${D}/usr/$(get_libdir)/rustlib/install.log" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-std-${RUSTHOST}" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustc" || die + rm "${D}/usr/$(get_libdir)/rustlib/rust-installer-version" || die + rm "${D}/usr/$(get_libdir)/rustlib/uninstall.sh" || die + + mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die + mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die + mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die + mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die + + if use doc; then + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-docs" || die + fi + + if use extended; then + rm "${D}/usr/$(get_libdir)/rustlib/manifest-cargo" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rls-preview" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-analysis-${RUSTHOST}" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-src" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustfmt-preview" || die + fi + + rm "${D}/usr/share/doc/${P}/LICENSE-APACHE" || die + rm "${D}/usr/share/doc/${P}/LICENSE-MIT" || die + + docompress "/usr/share/${P}/man" + + cat <<-EOF > "${T}"/50${P} + MANPATH="/usr/share/${P}/man" + EOF + doenvd "${T}"/50${P} + + cat <<-EOF > "${T}/provider-${P}" + /usr/bin/rustdoc + /usr/bin/rust-gdb + /usr/bin/rust-lldb + EOF + dodir /etc/env.d/rust + insinto /etc/env.d/rust + doins "${T}/provider-${P}" +} + +pkg_postinst() { + eselect rust update --if-unset + + elog "Rust installs a helper script for calling GDB and LLDB," + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." + + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then + elog "install app-emacs/rust-mode to get emacs support for rust." + fi + + if has_version app-editors/gvim || has_version app-editors/vim; then + elog "install app-vim/rust-vim to get vim support for rust." + fi + + if has_version 'app-shells/zsh'; then + elog "install app-shells/rust-zshcomp to get zsh completion for rust." + fi +} + +pkg_postrm() { + eselect rust unset --if-invalid +} |