tdev-lang/rust: Add necessary patches. - parlay - yet another gentoo overlay (HTM) git clone https://git.parazyd.org/parlay (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) commit e92c4cd94c7c8910fbedd8e8fe9c0837243a5961 (DIR) parent d9c03dfb572faf3bd3ed49c48ac12a4c3fa02b12 (HTM) Author: parazyd <parazyd@dyne.org> Date: Sat, 6 Oct 2018 09:36:08 +0200 dev-lang/rust: Add necessary patches. Diffstat: M dev-lang/rust/Manifest | 18 +++++++++++++++--- A dev-lang/rust/files/0001-Require-s… | 32 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0002-Remove-no… | 420 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0003-Switch-mu… | 25 +++++++++++++++++++++++++ A dev-lang/rust/files/0004-Prefer-li… | 24 ++++++++++++++++++++++++ A dev-lang/rust/files/0005-Fix-LLVM-… | 26 ++++++++++++++++++++++++++ A dev-lang/rust/files/0006-Fix-rustd… | 34 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0007-Add-opens… | 42 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0008-Don-t-pas… | 36 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0009-Update-li… | 421 +++++++++++++++++++++++++++++++ A dev-lang/rust/files/0010-liblibc.p… | 29 +++++++++++++++++++++++++++++ A dev-lang/rust/files/0011-Avoid-nam… | 32 +++++++++++++++++++++++++++++++ A dev-lang/rust/rust-1.27.0.ebuild | 354 +++++++++++++++++++++++++++++++ D dev-lang/rust/rust-1.28.0-r1.ebuild | 278 ------------------------------ A dev-lang/rust/rust-1.29.1.ebuild | 318 +++++++++++++++++++++++++++++++ D virtual/cargo/cargo-1.27.0.ebuild | 20 -------------------- D virtual/cargo/metadata.xml | 8 -------- D virtual/rust/rust-1.27.0.ebuild | 15 --------------- 18 files changed, 1808 insertions(+), 324 deletions(-) --- (DIR) diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest t@@ -1,3 +1,15 @@ -DIST rust-1.27.2-x86_64-unknown-linux-gnu.tar.xz 144218956 BLAKE2B 40834086f211dd64ec76be37eb477697ff44783f261f0b9bfc10b46cc340cf3c15adf80d39a9df642b4985ea1239ad7f1d1803a44f3bd3d53f073bdc38a1de0e SHA512 14861392dad81d2c040d0deb64d5dd34652d5cc2875e404609a0f13c8fb6bdc38f9bc7b1e309829365a00c42b610f2b7a73cffa232ecfdf0618b5508a8667198 -DIST rust-1.28.0-x86_64-unknown-linux-musl.tar.xz 112552728 BLAKE2B 5f3a4432f94f5b31462978201b83f92b124f467d999ed574362735911c74d5a4cb6c90a2f8f13d87b16646d5a4d9ba11b4b8f3b7a40cf470b778d76e7d02db10 SHA512 da7861577b13aa8cef38d8a4893f09c474e32857a488bdf14ce0a2a43ba9afb077d04ce0804c75afd8466b8b2813049150ee4b8804dc8eb80a11a7e531c19c7f -DIST rustc-1.28.0-src.tar.xz 55838968 BLAKE2B 1ff1f54dbae8c6481a6467d35b7c7dc340eba5e8c34f08ecb7b2300239c98a70c8459dacb8c8932ab6d9b3e2770e5b3508e23db7b01ff6014b7dbc076cf1de94 SHA512 a4885cd42a1006738cca2f0d8c0d5e4fd4014fc4629cbf691935bd36ffb896c553717022e67532359b5f1bd8e5050fc38b9dffed7c45cc76f7089ec134dfb980 +DIST rust-1.26.2-aarch64-unknown-linux-gnu.tar.xz 90964988 BLAKE2B 7e5de737ff2b4711e0a5b3085f10c3f2918fc5823dcb52bc5f897a5617b65d648d5e59664dbfaa904ff08923d1bbd11aae21349760fefef6ff18ea0e45391e07 SHA512 b565ec988d3b946dabc8902eba60b446070e77b7c27aa98d981b7ba5e9285bda95565627600e6be057970de5006d9640ef77fa920849160f5cf98508b48d1673 +DIST rust-1.26.2-aarch64-unknown-linux-musl.tar.xz 96634640 BLAKE2B fe74fec5c20d7d74e261b30cc3e3eb375da35332ab54e528eca78270608c6830fc4ed15bfa0f8126fc4e77f8476ab9c008565191667ba278713194e38c2d7b59 SHA512 2643021d99bafc3da58bab7a40aeb9c0127b099b26b59c4ebb073d7f807262e65ec8b12618fb8fe5d75fa8809319c3b08518371c04f406cb7fcdbf795b3bdb35 +DIST rust-1.26.2-arm-unknown-linux-gnueabi.tar.xz 98267104 BLAKE2B ae44fcead124e5e3993240be0c8a46e545df5d045d39184cfada86d9a820fa30a771396a2ced86c2454aef224951e85cf0b6965c13ed98a3024e07d4ca1ec6a9 SHA512 a96295ef2d0eca5a682e3b3bcfe3b3ffeb5bbe45bc949f467cfd1e7ac7252d74e86d2d8f25e5722e75e7f537afeb3b0ae9054bd3908916ea461623f8c13ba5bf +DIST rust-1.26.2-arm-unknown-linux-musleabi.tar.xz 97679732 BLAKE2B e5bdd376c1a5a1d8ebf3e8cacd80f0a8165e24ed8c7ed3755cf2ca7f3688f3f278534021e8d1487875cab657ad9391023577692afaff45f001e52d76d9417058 SHA512 a1e20e2a93b40ec8bc8a90d9e5b57801e7fa79649b45ae6ca1133ec24779edc00ff73b5f8a1836856b2cdd78b643390518d58694e5661834b6091a5d6e924660 +DIST rust-1.26.2-armv7-unknown-linux-gnueabihf.tar.xz 98828932 BLAKE2B 2f60e65128bd32d97422d82d99f5c5447d1c1e77582028089d52208e3ede4af5e72c278a3fb5001348c864087f3e85af05604a0b6078891c5ed812d745840d93 SHA512 7b8e3f39a62b7b5fdaa6d53e5638de26968799d97b5d53e09bf49456b02f968495cff4757f25d38bc3393ca33dc1b9da353ec290ba9416770e082548aa5079ac +DIST rust-1.26.2-armv7-unknown-linux-musleabihf.tar.xz 97326548 BLAKE2B c955fe3fd4dbdc12c6c8101538a930169dc62e7461964b8f900e8afd3973fea783116ed25aff5db15eded8173377db412c67232b12e0cba6a3278793f08de2ae SHA512 ed1d9828d2f12e782fd73865a0403c7b26c11cab665c635308e8e1cd23e6101402b448f0334f33b33193162bb9e6b30eba8a541b3d128925407f17b9d8f4f9f3 +DIST rust-1.26.2-i686-unknown-linux-gnu.tar.xz 143090096 BLAKE2B 7871fa4e4d0f320ff949cd31cefa116bc7b741927626958e1d10197f05fc9a662b8d6c21ddd4d2910700e6f7273e4fc18738e6ff58cd85b9af4ed25eceea31d9 SHA512 859b5b72c78cca8cd473012599ca12539ef9a5ee38d1aaaad024019fd84220e344e1cd0efd2b027ef333555b158b23529f35ceb5d59d76c35e7946b5fe4a8a52 +DIST rust-1.26.2-i686-unknown-linux-musl.tar.xz 103964468 BLAKE2B f1bcc5be07239917517302389c91ca68427f4f50f98ca38832606377b011f4c7d50159b0481fe9075b497d1493b4d40445d8026e115fbae1c970f459d6e8a63a SHA512 528a761a22ee22007de4511a46d97db3cab625622d4f94de5305fbbefb6a5f7582826aae3bcb459f91a3f57d535153b8cb35b692806060ced92655cdf9c81e2a +DIST rust-1.26.2-x86_64-unknown-linux-gnu.tar.xz 138609432 BLAKE2B 54507a8ce3ab2676e6e66852b6d3f1a47ca07ad4b56383f6247149309a0f60f67fbf0a6ba27d968c24340c07d7d5074942c6eaccbc1207c5e75fd9a6f47b2481 SHA512 29e474b0eab4dd2ffa0b964d83f52ffce530e75c4193e307410ef6d20ef9ad2b300a4f467bdf06b3311157340e9295cb9b1efdcf08dafee66979b076c2afba7e +DIST rust-1.26.2-x86_64-unknown-linux-musl.tar.xz 101703244 BLAKE2B d69fafba82b9e98f5c9d45c606a732c1a698141f543f7d8671a715cd95dbb4948def4e8593f7355ec88b0c7aa7199dec65d7af0acec0857095641dab6df19f0c SHA512 563ed60897c5df26a407b288a44bd1d09c53ab08901fe3660426d0744f81ab32c144494af134edeea0f4c915d5844819f5987d9291622cccc7de0691e8eb4a8c +DIST rust-1.28.0-aarch64-unknown-linux-gnu.tar.xz 98937652 BLAKE2B 836d3dd4e583fa50dd317c3bea56257e6ea19defdb38c16be6debb2854e147c8a92c4832263e4ac314136022a176526fe7d3774a3c5a84cd8d364cd2a1532860 SHA512 8d9acbc90ddaa1e0de0234a21798b19b5365ea371a12f9a143c6ebacbb48f57344da6e827e867513be502bce2801de27a0dbbacdf8618c653aeb58026b6c469c +DIST rust-1.28.0-i686-unknown-linux-gnu.tar.xz 136925948 BLAKE2B 85d9239533920c3f16d7c61bada0caeabceceade29032b70bb4562bfd04fa0158cdd85b8a0a1119506416fa5916ade8a0466bf6c10da457299a6319aa25f9dd6 SHA512 ffdfab46db14f07354b553e02fdb9dc6602c2c52b78d8f17c499f4ddb1e257aa53479df836eb3f06a2548d34296b0277cdb6b4c6f3cec57265823df22752c135 +DIST rust-1.28.0-x86_64-unknown-linux-musl.tar.xz 141237344 BLAKE2B 7f10f6b8fd9d800767711ce8d66f288727514808ad40a9c75ca9bf5befa301e6a7d6d0e1cb7c60e01b3f03bf2e4517193cd297e191e6c2d3baaf34dcbfd7ef2e SHA512 939d43281ae4c90a55d7c0be85b33a0da73b6a9b84766dc83ee3817883d0f3d92f27c882b119a0db2adc60770ec8dc5353a7d2df99a3bf037983c86312d8884b +DIST rustc-1.27.0-src.tar.xz 55455772 BLAKE2B 5c1b26a3e8c6e45aaa43b3ccb5819089cf03c32807ac1adc46ec4f9ff8cf803ec444587ccb737b5d701c4ef5fa634fc4c89de3d71e6202b64ec125f986e54ffd SHA512 b80af48c637741add1d2846e6e3153b0125fb22ed587036fb9d27ad3961419af64802aa91a79258277b1be20718281558989ea0283db0c482fe1512354ba79d8 +DIST rustc-1.29.1-src.tar.xz 61937676 BLAKE2B 6a60249538e1ec62471f4d0e3fc31c0a648433aa6f85ca7341657ea07772e338eb92a629941685808f4b80e84cb025d78aee9d0d6fa71c6635a1647c61bca9bc SHA512 1ded651b4c460e11e5e44c26de88a80fb13c2000097de2ee1e5af89638e12a7e8f43dd756689d4cc4fad45c52d4d43a3c70dd6a3ae550735b9dad5f8defea6a7 (DIR) diff --git a/dev-lang/rust/files/0001-Require-static-native-libraries-when-linking-static-.patch b/dev-lang/rust/files/0001-Require-static-native-libraries-when-linking-static-.patch t@@ -0,0 +1,32 @@ +From 8a7a0a8e2161b81d22233ccf8af4ca5763f1535c Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 00:02:39 +0200 +Subject: [PATCH 01/11] Require static native libraries when linking static + executables + +--- + src/librustc_codegen_llvm/back/link.rs | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs +index 845a66c6e..1b3185c02 100644 +--- a/src/librustc_codegen_llvm/back/link.rs ++++ b/src/librustc_codegen_llvm/back/link.rs +@@ -1597,6 +1597,14 @@ fn add_upstream_native_libraries(cmd: &mut dyn Linker, + } + match lib.kind { + NativeLibraryKind::NativeUnknown => cmd.link_dylib(&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(&name.as_str()), + NativeLibraryKind::NativeStaticNobundle => { + // Link "static-nobundle" native libs only if the crate they originate from +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/files/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch t@@ -0,0 +1,420 @@ +From ad5ce81e82e931feb764ee8422230e56b37f3b3b Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 00:03:57 +0200 +Subject: [PATCH 02/11] 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 | 22 ------------- + src/bootstrap/lib.rs | 8 ----- + src/bootstrap/sanity.rs | 30 +----------------- + .../dist-i586-gnu-i586-i686-musl/Dockerfile | 2 -- + src/ci/docker/dist-various-1/Dockerfile | 7 ----- + src/ci/docker/dist-x86_64-musl/Dockerfile | 1 - + src/librustc_target/spec/linux_musl_base.rs | 16 ---------- + 12 files changed, 4 insertions(+), 163 deletions(-) + +diff --git a/config.toml.example b/config.toml.example +index 990734163..6f8b52e23 100644 +--- a/config.toml.example ++++ b/config.toml.example +@@ -409,12 +409,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 7192cae89..71435f930 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::io; + use std::path::PathBuf; + use std::process::Command; +@@ -126,15 +125,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 698903f12..629cedf01 100644 +--- a/src/bootstrap/cc_detect.rs ++++ b/src/bootstrap/cc_detect.rs +@@ -95,7 +95,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(); +@@ -124,7 +124,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())); +@@ -135,8 +135,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 +@@ -173,26 +172,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 04e8e133b..7767956cd 100644 +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -87,13 +87,6 @@ impl Step for Std { + }); + builder.info(&format!("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(builder, target, &libdir); +- } +- + builder.ensure(StdLink { + compiler: from, + target_compiler: compiler, +@@ -102,11 +95,6 @@ impl Step for Std { + return; + } + +- if target.contains("musl") { +- let libdir = builder.sysroot_libdir(compiler, target); +- copy_musl_third_party_objects(builder, target, &libdir); +- } +- + let out_dir = builder.cargo_out(compiler, Mode::Std, target); + builder.clear_if_dirty(&out_dir, &builder.rustc(compiler)); + let mut cargo = builder.cargo(compiler, Mode::Std, target, "build"); +@@ -128,20 +116,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(builder: &Builder, +- target: Interned<String>, +- into: &Path) { +- for &obj in &["crt1.o", "crti.o", "crtn.o"] { +- builder.copy(&builder.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(builder: &Builder, +@@ -196,11 +170,6 @@ pub fn std_cargo(builder: &Builder, + cargo.env("JEMALLOC_OVERRIDE", jemalloc); + } + } +- if target.contains("musl") { +- if let Some(p) = builder.musl_root(target) { +- cargo.env("MUSL_ROOT", p); +- } +- } + } + } + +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs +index 0a8a5c87d..9fdf8690c 100644 +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -131,8 +131,6 @@ pub struct Config { + pub save_toolstates: Option<PathBuf>, + pub print_step_timings: bool, + +- // Fallback musl-root for all targets +- pub musl_root: Option<PathBuf>, + pub prefix: Option<PathBuf>, + pub sysconfdir: Option<PathBuf>, + pub datadir: Option<PathBuf>, +@@ -165,7 +163,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>, + pub no_std: bool, + } +@@ -294,7 +291,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>, +@@ -328,7 +324,6 @@ struct TomlTarget { + linker: Option<String>, + android_ndk: Option<String>, + crt_static: Option<bool>, +- musl_root: Option<String>, + qemu_rootfs: Option<String>, + } + +@@ -541,7 +536,6 @@ impl Config { + set(&mut config.llvm_tools_enabled, rust.llvm_tools); + 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); + set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings)); + set(&mut config.backtrace_on_ice, rust.backtrace_on_ice); +@@ -580,7 +574,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 9fdba044f..513935e4c 100755 +--- a/src/bootstrap/configure.py ++++ b/src/bootstrap/configure.py +@@ -108,28 +108,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-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root", +- "armv5te-unknown-linux-musleabi 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 1efff19df..e0fa46f8b 100644 +--- a/src/bootstrap/lib.rs ++++ b/src/bootstrap/lib.rs +@@ -802,14 +802,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 true if this is a no-std `target`, if defined + fn no_std(&self, target: Interned<String>) -> Option<bool> { + self.config.target_config.get(&target) +diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs +index c7f514da9..617a3c239 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; +@@ -186,34 +186,6 @@ pub fn check(build: &mut Build) { + } + } + +- // 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 ba2d32a92..412c37fdd 100644 +--- a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile ++++ b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile +@@ -30,8 +30,6 @@ COPY scripts/sccache.sh /scripts/ + RUN sh /scripts/sccache.sh + + ENV RUST_CONFIGURE_ARGS \ +- --musl-root-i586=/musl-i586 \ +- --musl-root-i686=/musl-i686 \ + --enable-extended \ + --disable-docs + +diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile +index 6302f5500..e04fdaa22 100644 +--- a/src/ci/docker/dist-various-1/Dockerfile ++++ b/src/ci/docker/dist-various-1/Dockerfile +@@ -109,13 +109,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ + CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc + + ENV RUST_CONFIGURE_ARGS \ +- --musl-root-armv5te=/musl-armv5te \ +- --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 \ + --disable-docs + +diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile +index 06f8a2fbb..f5dd37952 100644 +--- a/src/ci/docker/dist-x86_64-musl/Dockerfile ++++ b/src/ci/docker/dist-x86_64-musl/Dockerfile +@@ -30,7 +30,6 @@ COPY scripts/sccache.sh /scripts/ + RUN sh /scripts/sccache.sh + + ENV RUST_CONFIGURE_ARGS \ +- --musl-root-x86_64=/musl-x86_64 \ + --enable-extended \ + --disable-docs + +diff --git a/src/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs +index 7a3f3c2a5..b512af9b5 100644 +--- a/src/librustc_target/spec/linux_musl_base.rs ++++ b/src/librustc_target/spec/linux_musl_base.rs +@@ -13,11 +13,6 @@ use spec::{LinkerFlavor, 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_crt.insert(LinkerFlavor::Gcc, Vec::new()); +- base.pre_link_args_crt.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 +44,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_crt.push("crt1.o".to_string()); +- base.pre_link_objects_exe_crt.push("crti.o".to_string()); +- base.post_link_objects_crt.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.19.1 + (DIR) diff --git a/dev-lang/rust/files/0003-Switch-musl-targets-to-link-dynamically-by-default.patch b/dev-lang/rust/files/0003-Switch-musl-targets-to-link-dynamically-by-default.patch t@@ -0,0 +1,25 @@ +From 9b1a4c44f62a41bc8a35c76539d2fda2a674ac41 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:32:32 +0200 +Subject: [PATCH 03/11] Switch musl targets to link dynamically by default + +--- + src/librustc_target/spec/linux_musl_base.rs | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs +index b512af9b5..7581a64b1 100644 +--- a/src/librustc_target/spec/linux_musl_base.rs ++++ b/src/librustc_target/spec/linux_musl_base.rs +@@ -44,8 +44,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.19.1 + (DIR) diff --git a/dev-lang/rust/files/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/dev-lang/rust/files/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch t@@ -0,0 +1,24 @@ +From a315a269713bd18e10f0ad22b38867d63c85712c Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:33:14 +0200 +Subject: [PATCH 04/11] 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 2b3c19c06..8233beada 100644 +--- a/src/libunwind/lib.rs ++++ b/src/libunwind/lib.rs +@@ -35,6 +35,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.19.1 + (DIR) diff --git a/dev-lang/rust/files/0005-Fix-LLVM-build.patch b/dev-lang/rust/files/0005-Fix-LLVM-build.patch t@@ -0,0 +1,26 @@ +From b22e016d89a954278e6b9b0d22ea53b689b186a6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:34:19 +0200 +Subject: [PATCH 05/11] 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 e0fa46f8b..dd785124d 100644 +--- a/src/bootstrap/lib.rs ++++ b/src/bootstrap/lib.rs +@@ -742,7 +742,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.19.1 + (DIR) diff --git a/dev-lang/rust/files/0006-Fix-rustdoc-for-cross-targets.patch b/dev-lang/rust/files/0006-Fix-rustdoc-for-cross-targets.patch t@@ -0,0 +1,34 @@ +From 9f5b94c0cfccf135176dda63671539b02ebccdd1 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:35:44 +0200 +Subject: [PATCH 06/11] Fix rustdoc for cross targets + +--- + src/bootstrap/bin/rustdoc.rs | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs +index a54e58665..efa627413 100644 +--- a/src/bootstrap/bin/rustdoc.rs ++++ b/src/bootstrap/bin/rustdoc.rs +@@ -34,8 +34,6 @@ fn main() { + Err(_) => 0, + }; + +- let mut dylib_path = bootstrap::util::dylib_path(); +- dylib_path.insert(0, PathBuf::from(libdir.clone())); + + let mut cmd = Command::new(rustdoc); + cmd.args(&args) +@@ -46,7 +44,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.19.1 + (DIR) diff --git a/dev-lang/rust/files/0007-Add-openssl-configuration-for-musl-targets.patch b/dev-lang/rust/files/0007-Add-openssl-configuration-for-musl-targets.patch t@@ -0,0 +1,42 @@ +From 3560f6c43064c63f121f8c4d7382a3adfd51faba Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:36:46 +0200 +Subject: [PATCH 07/11] 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 9aeb4e0ed..329ca4f16 100644 +--- a/src/bootstrap/native.rs ++++ b/src/bootstrap/native.rs +@@ -610,9 +610,12 @@ impl Step for Openssl { + "arm-linux-androideabi" => "android", + "arm-unknown-linux-gnueabi" => "linux-armv4", + "arm-unknown-linux-gnueabihf" => "linux-armv4", ++ "arm-unknown-linux-musleabi" => "linux-armv4", ++ "arm-unknown-linux-musleabihf" => "linux-armv4", + "armv6-unknown-netbsd-eabihf" => "BSD-generic32", +- "armv7-linux-androideabi" => "android-armv7", ++ "armv7-linux-androideabi" => "android-armv4", + "armv7-unknown-linux-gnueabihf" => "linux-armv4", ++ "armv7-unknown-linux-musleabihf" => "linux-armv4", + "armv7-unknown-netbsd-eabihf" => "BSD-generic32", + "i586-unknown-linux-gnu" => "linux-elf", + "i586-unknown-linux-musl" => "linux-elf", +@@ -623,9 +626,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", + "powerpc-unknown-linux-gnuspe" => "linux-ppc", + "powerpc-unknown-netbsd" => "BSD-generic32", +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/files/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch b/dev-lang/rust/files/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch t@@ -0,0 +1,36 @@ +From 70fd5118619bf40d123162358ad0c556a99b0cdd Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:37:33 +0200 +Subject: [PATCH 08/11] 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 dc0b0aaf0..257d36975 100644 +--- a/src/bootstrap/builder.rs ++++ b/src/bootstrap/builder.rs +@@ -966,7 +966,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()); +@@ -981,9 +981,7 @@ impl<'a> Builder<'a> { + let cxx = ccacheify(&cxx); + cargo + .env(format!("CXX_{}", target), &cxx) +- .env("CXX", &cxx) +- .env(format!("CXXFLAGS_{}", target), cflags.clone()) +- .env("CXXFLAGS", cflags); ++ .env("CXX", &cxx); + } + } + +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/files/0009-Update-libc-to-0.2.43.patch b/dev-lang/rust/files/0009-Update-libc-to-0.2.43.patch t@@ -0,0 +1,421 @@ +From 5c76429e3757f9ea0e37335372dab41276e0abb7 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Thu, 18 Oct 2018 09:48:42 +0200 +Subject: [PATCH 09/11] Update libc to 0.2.43 + +--- + src/Cargo.lock | 90 +++++++++++++++++++++++++------------------------- + 1 file changed, 45 insertions(+), 45 deletions(-) + +diff --git a/src/Cargo.lock b/src/Cargo.lock +index 64f6b718f..1386e3bc4 100644 +--- a/src/Cargo.lock ++++ b/src/Cargo.lock +@@ -90,7 +90,7 @@ name = "atty" + version = "0.2.11" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -113,7 +113,7 @@ version = "0.1.24" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -136,7 +136,7 @@ dependencies = [ + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -196,7 +196,7 @@ dependencies = [ + "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -243,7 +243,7 @@ dependencies = [ + "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -425,7 +425,7 @@ name = "commoncrypto-sys" + version = "0.2.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -445,7 +445,7 @@ dependencies = [ + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -464,7 +464,7 @@ dependencies = [ + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -487,7 +487,7 @@ version = "0.5.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -496,7 +496,7 @@ version = "0.6.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -504,7 +504,7 @@ name = "core-foundation-sys" + version = "0.5.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -626,7 +626,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "curl-sys 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -640,7 +640,7 @@ version = "0.4.7" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -789,7 +789,7 @@ version = "0.2.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -803,7 +803,7 @@ name = "flate2" + version = "1.0.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -834,7 +834,7 @@ name = "fs2" + version = "0.4.3" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -891,7 +891,7 @@ version = "0.7.3" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1039,7 +1039,7 @@ name = "isatty" + version = "0.1.8" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -1062,7 +1062,7 @@ name = "jobserver" + version = "0.1.11" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -1133,7 +1133,7 @@ dependencies = [ + + [[package]] + name = "libc" +-version = "0.2.42" ++version = "0.2.43" + source = "registry+https://github.com/rust-lang/crates.io-index" + + [[package]] +@@ -1144,7 +1144,7 @@ dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libssh2-sys 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1157,7 +1157,7 @@ version = "0.2.8" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1170,7 +1170,7 @@ version = "1.0.18" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -1210,7 +1210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -1277,7 +1277,7 @@ name = "memchr" + version = "2.0.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -1285,7 +1285,7 @@ name = "memmap" + version = "0.6.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -1308,7 +1308,7 @@ version = "0.1.10" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -1376,7 +1376,7 @@ name = "num_cpus" + version = "1.8.0" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -1393,7 +1393,7 @@ dependencies = [ + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -1416,7 +1416,7 @@ version = "0.9.35" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-src 110.0.5+1.1.0h (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1474,7 +1474,7 @@ name = "parking_lot_core" + version = "0.2.14" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -1670,7 +1670,7 @@ version = "0.4.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] + +@@ -1681,7 +1681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -1707,7 +1707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -2129,7 +2129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -2202,7 +2202,7 @@ dependencies = [ + "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", +@@ -2342,7 +2342,7 @@ dependencies = [ + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "build_helper 0.1.0", + "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_cratesio_shim 0.0.0", + ] + +@@ -2702,7 +2702,7 @@ version = "0.3.7" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -2889,7 +2889,7 @@ version = "0.4.16" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ + "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -2899,7 +2899,7 @@ name = "tempfile" + version = "3.0.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -2950,7 +2950,7 @@ name = "termion" + version = "1.5.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -2994,7 +2994,7 @@ name = "time" + version = "0.1.40" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -3194,7 +3194,7 @@ name = "xattr" + version = "0.2.2" + source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ++ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -3307,7 +3307,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" + "checksum lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fb497c35d362b6a331cfd94956a07fc2c78a4604cdbee844a81170386b996dd3" + "checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" + "checksum lazycell 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d33a48d0365c96081958cc663eef834975cb1e8d8bea3378513fc72bdbf11e50" +-"checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1" ++"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" + "checksum libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c9051a4b288ba6f8728e9e52bb2510816946b8bcb2e20259e4d4cdc93b9ecafd" + "checksum libssh2-sys 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c628b499e8d1a4f4bd09a95d6cb1f8aeb231b46a9d40959bbd0408f14dd63adf" + "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/files/0010-liblibc.patch b/dev-lang/rust/files/0010-liblibc.patch t@@ -0,0 +1,29 @@ +From 553f0366e2f14135c05afa9c544f563cdd2b12c1 Mon Sep 17 00:00:00 2001 +From: parazyd <parazyd@dyne.org> +Date: Thu, 18 Oct 2018 09:49:43 +0200 +Subject: [PATCH 10/11] liblibc + +--- + src/liblibc/src/unix/mod.rs | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/liblibc/src/unix/mod.rs b/src/liblibc/src/unix/mod.rs +index 15c7821fa..5c5ae19aa 100644 +--- a/src/liblibc/src/unix/mod.rs ++++ b/src/liblibc/src/unix/mod.rs +@@ -285,11 +285,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")] +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/files/0011-Avoid-name-conflicts-with-musl-libc.patch b/dev-lang/rust/files/0011-Avoid-name-conflicts-with-musl-libc.patch t@@ -0,0 +1,32 @@ +From 90268dc82de90c46555f4ff8e0b794a746e40545 Mon Sep 17 00:00:00 2001 +From: parazyd <parazyd@dyne.org> +Date: Thu, 18 Oct 2018 09:50:10 +0200 +Subject: [PATCH 11/11] Avoid name conflicts with musl-libc + +--- + src/llvm/include/llvm/Analysis/TargetLibraryInfo.def | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def +index 24608af38..600c51ff1 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") +-- +2.19.1 + (DIR) diff --git a/dev-lang/rust/rust-1.27.0.ebuild b/dev-lang/rust/rust-1.27.0.ebuild t@@ -0,0 +1,354 @@ +# 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 python3_{5,6} pypy ) + +inherit llvm multiprocessing multilib-build 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 + +RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).2" + +# there is no cargo 0.28 tag, so use 0.27 +CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2))).0" + +DESCRIPTION="Systems programming language from Mozilla" +HOMEPAGE="https://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 ) + ) +" + +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC Sparc SystemZ X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} + +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" + +IUSE="debug doc extended jemalloc libressl system-llvm wasm ${ALL_LLVM_TARGETS[*]}" + +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 + jemalloc? ( dev-libs/jemalloc ) + system-llvm? ( sys-devel/llvm ) + extended? ( + libressl? ( dev-libs/libressl:0= ) + !libressl? ( dev-libs/openssl:0= ) + net-libs/http-parser:0/2.8.0 + 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} )" + +REQUIRED_USE="!system-llvm? ( || ( ${ALL_LLVM_TARGETS[*]} ) )" + +PATCHES=( + "${FILESDIR}/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch" + "${FILESDIR}/1.27.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" + "${FILESDIR}/1.27.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.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" + "${FILESDIR}/1.25.0/0009-liblibc.patch" + "${FILESDIR}/1.25.0/0010-llvm.patch" + "${FILESDIR}/rust-1.27.0-libressl-2.7.0.patch" +) + +S="${WORKDIR}/${MY_P}-src" + +toml_usex() { + usex "$1" true false +} + +rust_host() { + case "${1}" in + arm) + if [[ ${1} == ${DEFAULT_ABI} ]]; then + if [[ ${CHOST} == armv7* ]]; then + RUSTARCH=armv7 + else + RUSTARCH=arm + fi + else + RUSTARCH=arm + fi ;; + amd64) + RUSTARCH=x86_64 ;; + arm64) + RUSTARCH=aarch64 ;; + x86) + RUSTARCH=i686 ;; + esac + case "${1}" in + arm) + if [[ ${1} == ${DEFAULT_ABI} ]]; then + if [[ ${CHOST} == armv7a-hardfloat* ]]; then + RUSTLIBC=${ELIBC/glibc/gnu}eabihf + else + RUSTLIBC=${CHOST##*-} + fi + else + RUSTLIBC=${ELIBC/glibc/gnu} + fi ;; + *) + RUSTLIBC=${ELIBC/glibc/gnu} ;; + esac + RUSTHOST=${RUSTARCH}-unknown-${KERNEL}-${RUSTLIBC} + echo "${RUSTHOST}" +} + +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 -L native=$("$llvm_config" --libdir)" + fi + + python-any-r1_pkg_setup +} + +src_prepare() { + "${WORKDIR}/rust-${RUST_STAGE0_VERSION}-$(rust_host ${ARCH})/install.sh" \ + --destdir="${WORKDIR}/stage0" \ + --prefix=/ \ + --components=rust-std-$(rust_host ${ARCH}),rustc,cargo \ + --disable-ldconfig \ + || die + + default +} + +src_configure() { + local rust_target="" rust_targets="" rust_target_name arch_cflags + + # Collect rust target names to compile standard libs for all ABIs. + for v in $(multilib_get_enabled_abi_pairs); do + rust_targets="${rust_targets},\"$(rust_host ${v##*.})\"" + done + if use wasm; then + rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" + fi + rust_targets="${rust_targets#,}" + + rust_target=$(rust_host $ARCH) + + cat <<- EOF > "${S}"/config.toml + [llvm] + ninja = true + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + targets = "${LLVM_TARGETS// /;}" + [build] + build = "${rust_target}" + host = ["${rust_target}"] + target = [${rust_targets}] + 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 + lld = $(toml_usex wasm) + optimize-tests = $(toml_usex !debug) + dist-src = false + [dist] + src-tarball = false + EOF + + for v in $(multilib_get_enabled_abi_pairs); do + rust_target=$(rust_host ${v##*.}) + arch_cflags="$(get_abi_CFLAGS ${v##*.})" + + cat <<- EOF >> "${S}"/config.env + CFLAGS_${rust_target}=${arch_cflags} + EOF + + cat <<- EOF >> "${S}"/config.toml + [target.${rust_target}] + 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 + done + + if use wasm; then + cat <<- EOF >> "${S}"/config.toml + [target.wasm32-unknown-unknown] + linker = "lld" + EOF + fi +} + +src_compile() { + env $(cat "${S}"/config.env)\ + ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die +} + +src_install() { + local rust_target abi_libdir + + env DESTDIR="${D}" ./x.py install || 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 + + # Copy shared library versions of standard libraries for all targets + # into the system's abi-dependent lib directories because the rust + # installer only does so for the native ABI. + for v in $(multilib_get_enabled_abi_pairs); do + if [ ${v##*.} = ${DEFAULT_ABI} ]; then + continue + fi + abi_libdir=$(get_abi_LIBDIR ${v##*.}) + rust_target=$(rust_host ${v##*.}) + mkdir -p "${D}/usr/${abi_libdir}" + cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ + "${D}/usr/${abi_libdir}" || die + done + + 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-$(rust_host ${ARCH})" || 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 + + 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-$(rust_host ${ARCH})" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-src" || die + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustfmt-preview" || die + + rm "${D}/usr/share/doc/${P}/LICENSE-APACHE.old" || die + rm "${D}/usr/share/doc/${P}/LICENSE-MIT.old" || 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 +} (DIR) diff --git a/dev-lang/rust/rust-1.28.0-r1.ebuild b/dev-lang/rust/rust-1.28.0-r1.ebuild t@@ -1,278 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) - -inherit multiprocessing multilib-build python-any-r1 toolchain-funcs versionator - -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="amd64" -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 ~arm64 ~x86" -fi - -CHOST_amd64=x86_64-unknown-linux-gnu -CHOST_x86=i686-unknown-linux-gnu -CHOST_arm64=aarch64-unknown-linux-gnu - -RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).2" - -CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0" - -DESCRIPTION="Systems programming language from Mozilla" -HOMEPAGE="https://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-1.28.0-x86_64-unknown-linux-musl.tar.xz - ) - ) -" - - - -ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 - NVPTX PowerPC Sparc SystemZ X86 XCore ) -ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) -LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} - -LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" - -IUSE="cargo debug doc +jemalloc libressl rls rustfmt wasm ${ALL_LLVM_TARGETS[*]}" - -RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 - jemalloc? ( dev-libs/jemalloc ) - cargo? ( - sys-libs/zlib - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) - net-libs/libssh2 - net-libs/http-parser - net-misc/curl[ssl] - )" -DEPEND="${RDEPEND} - ${PYTHON_DEPS} - || ( - >=sys-devel/gcc-4.7 - >=sys-devel/clang-3.5 - ) - cargo? ( !dev-util/cargo ) - rustfmt? ( !dev-util/rustfmt ) - dev-util/cmake -" -PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" - -REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )" - -S="${WORKDIR}/${MY_P}-src" - -toml_usex() { - usex "$1" true false -} - -src_prepare() { - local rust_stage0_root="${WORKDIR}"/rust-stage0 - - local rust_stage0_name="RUST_STAGE0_${ARCH}" - local rust_stage0="${!rust_stage0_name}" - - "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die - - default -} - -src_configure() { - local rust_target="" rust_targets="" rust_target_name arch_cflags - - # Collect rust target names to compile standard libs for all ABIs. - for v in $(multilib_get_enabled_abi_pairs); do - rust_target_name="CHOST_${v##*.}" - rust_targets="${rust_targets},\"${!rust_target_name}\"" - done - if use wasm; then - rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" - fi - rust_targets="${rust_targets#,}" - - local extended="false" tools="" - if use cargo; then - extended="true" - tools="\"cargo\"," - fi - if use rls; then - extended="true" - tools="\"rls\",$tools" - fi - if use rustfmt; then - extended="true" - tools="\"rustfmt\",$tools" - fi - - local rust_stage0_root="${WORKDIR}"/rust-stage0 - - rust_target_name="CHOST_${ARCH}" - rust_target="${!rust_target_name}" - - cat <<- EOF > "${S}"/config.toml - [llvm] - optimize = $(toml_usex !debug) - release-debuginfo = $(toml_usex debug) - assertions = $(toml_usex debug) - targets = "${LLVM_TARGETS// /;}" - [build] - build = "${rust_target}" - host = ["${rust_target}"] - target = [${rust_targets}] - cargo = "${rust_stage0_root}/bin/cargo" - rustc = "${rust_stage0_root}/bin/rustc" - docs = $(toml_usex doc) - submodules = false - python = "${EPYTHON}" - locked-deps = true - vendor = true - extended = ${extended} - tools = [${tools}] - [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)" - rpath = false - lld = $(toml_usex wasm) - EOF - - for v in $(multilib_get_enabled_abi_pairs); do - rust_target=$(get_abi_CHOST ${v##*.}) - arch_cflags="$(get_abi_CFLAGS ${v##*.})" - - cat <<- EOF >> "${S}"/config.env - CFLAGS_${rust_target}=${arch_cflags} - EOF - - cat <<- EOF >> "${S}"/config.toml - [target.${rust_target}] - cc = "$(tc-getBUILD_CC)" - cxx = "$(tc-getBUILD_CXX)" - linker = "$(tc-getCC)" - ar = "$(tc-getAR)" - EOF - done - - if use wasm; then - cat <<- EOF >> "${S}"/config.toml - [target.wasm32-unknown-unknown] - linker = "lld" - EOF - fi -} - -src_compile() { - env $(cat "${S}"/config.env)\ - ./x.py build --config="${S}"/config.toml -j$(makeopts_jobs) \ - --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305 -} - -src_install() { - local rust_target abi_libdir - - env DESTDIR="${D}" ./x.py install || 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 cargo; then - mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die - fi - if use rls; then - mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die - fi - if use rustfmt; then - mv "${D}/usr/bin/rustfmt" "${D}/usr/bin/rustfmt-${PV}" || die - mv "${D}/usr/bin/cargo-fmt" "${D}/usr/bin/cargo-fmt-${PV}" || die - fi - - # Copy shared library versions of standard libraries for all targets - # into the system's abi-dependent lib directories because the rust - # installer only does so for the native ABI. - for v in $(multilib_get_enabled_abi_pairs); do - if [ ${v##*.} = ${DEFAULT_ABI} ]; then - continue - fi - abi_libdir=$(get_abi_LIBDIR ${v##*.}) - rust_target=$(get_abi_CHOST ${v##*.}) - mkdir -p "${D}/usr/${abi_libdir}" - cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ - "${D}/usr/${abi_libdir}" || die - done - - dodoc COPYRIGHT - - # FIXME: - # Really not sure if that env is needed, specailly LDPATH - cat <<-EOF > "${T}"/50${P} - LDPATH="/usr/$(get_libdir)/${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 - if use cargo; then - echo /usr/bin/cargo >> "${T}/provider-${P}" - fi - if use rls; then - echo /usr/bin/rls >> "${T}/provider-${P}" - fi - if use rustfmt; then - echo /usr/bin/rustfmt >> "${T}/provider-${P}" - echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" - fi - 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 -} (DIR) diff --git a/dev-lang/rust/rust-1.29.1.ebuild b/dev-lang/rust/rust-1.29.1.ebuild t@@ -0,0 +1,318 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +LLVM_MAX_SLOT=6 +PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) + +inherit llvm eapi7-ver multiprocessing multilib-build python-any-r1 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" +else + ABI_VER="$(ver_cut 1-2)" + SLOT="stable/${ABI_VER}" + MY_P="rustc-${PV}" + SRC="${MY_P}-src.tar.xz" + KEYWORDS="amd64 ~arm64 x86" +fi + +CHOST_amd64=x86_64-unknown-linux-musl +CHOST_x86=i686-unknown-linux-gnu +CHOST_arm64=aarch64-unknown-linux-gnu + +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" +RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}" +RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}" +RUST_STAGE0_arm64="rust-${RUST_STAGE0_VERSION}-${CHOST_arm64}" + +CARGO_DEPEND_VERSION="0.$(($(ver_cut 2) + 1)).0" + +DESCRIPTION="Systems programming language from Mozilla" +HOMEPAGE="https://www.rust-lang.org/" + +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz + amd64? ( https://portage.smaeul.xyz/distfiles/${RUST_STAGE0_amd64}.tar.xz ) + x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.xz ) + arm64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_arm64}.tar.xz ) +" + +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC Sparc SystemZ X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} + +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" + +IUSE="cargo clippy cpu_flags_x86_sse2 debug doc +jemalloc libressl rls rustfmt wasm ${ALL_LLVM_TARGETS[*]}" + +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 + jemalloc? ( dev-libs/jemalloc ) + cargo? ( + sys-libs/zlib + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + net-libs/libssh2 + net-libs/http-parser:= + net-misc/curl[ssl] + )" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + || ( + >=sys-devel/gcc-4.7 + >=sys-devel/clang-3.5 + ) + cargo? ( !dev-util/cargo ) + rustfmt? ( !dev-util/rustfmt ) + dev-util/cmake +" +PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" + +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) + x86? ( cpu_flags_x86_sse2 )" + +S="${WORKDIR}/${MY_P}-src" + +PATCHES=( + "${FILESDIR}/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" + "${FILESDIR}/0003-Switch-musl-targets-to-link-dynamically-by-default.patch" + "${FILESDIR}/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch" + "${FILESDIR}/0005-Fix-LLVM-build.patch" + "${FILESDIR}/0007-Add-openssl-configuration-for-musl-targets.patch" + "${FILESDIR}/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" + "${FILESDIR}/0010-liblibc.patch" + "${FILESDIR}/0011-Avoid-name-conflicts-with-musl-libc.patch" +) + + #"${FILESDIR}/0001-Require-static-native-libraries-when-linking-static-.patch" + #"${FILESDIR}/0006-Fix-rustdoc-for-cross-targets.patch" + #"${FILESDIR}/0009-Update-libc-to-0.2.43.patch" + +toml_usex() { + usex "$1" true false +} + +pkg_setup() { + export RUST_BACKTRACE=1 + 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)" + + python-any-r1_pkg_setup +} + +src_prepare() { + local rust_stage0_root="${WORKDIR}"/rust-stage0 + + local rust_stage0_name="RUST_STAGE0_${ARCH}" + local rust_stage0="${!rust_stage0_name}" + + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die + + default +} + +src_configure() { + local rust_target="" rust_targets="" rust_target_name arch_cflags + + # Collect rust target names to compile standard libs for all ABIs. + for v in $(multilib_get_enabled_abi_pairs); do + rust_target_name="CHOST_${v##*.}" + rust_targets="${rust_targets},\"${!rust_target_name}\"" + done + if use wasm; then + rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" + fi + rust_targets="${rust_targets#,}" + + local extended="false" tools="" + if use cargo; then + extended="true" + tools="\"cargo\"," + fi + if use clippy; then + extended="true" + tools="\"clippy\",$tools" + fi + if use rls; then + extended="true" + tools="\"rls\",\"analysis\",\"src\",$tools" + fi + if use rustfmt; then + extended="true" + tools="\"rustfmt\",$tools" + fi + + local rust_stage0_root="${WORKDIR}"/rust-stage0 + + rust_target_name="CHOST_${ARCH}" + rust_target="${!rust_target_name}" + + cat <<- EOF > "${S}"/config.toml + [llvm] + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + targets = "${LLVM_TARGETS// /;}" + [build] + build = "${rust_target}" + host = ["${rust_target}"] + target = [${rust_targets}] + cargo = "${rust_stage0_root}/bin/cargo" + rustc = "${rust_stage0_root}/bin/rustc" + docs = $(toml_usex doc) + submodules = false + python = "${EPYTHON}" + locked-deps = true + vendor = true + extended = ${extended} + tools = [${tools}] + [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 = "stable" + rpath = false + lld = $(toml_usex wasm) + EOF + + for v in $(multilib_get_enabled_abi_pairs); do + rust_target=$(get_abi_CHOST ${v##*.}) + arch_cflags="$(get_abi_CFLAGS ${v##*.})" + + cat <<- EOF >> "${S}"/config.env + CFLAGS_${rust_target}=${arch_cflags} + EOF + + cat <<- EOF >> "${S}"/config.toml + [target.${rust_target}] + cc = "$(tc-getBUILD_CC)" + cxx = "$(tc-getBUILD_CXX)" + linker = "$(tc-getCC)" + ar = "$(tc-getAR)" + llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" + EOF + done + + if use wasm; then + cat <<- EOF >> "${S}"/config.toml + [target.wasm32-unknown-unknown] + linker = "rust-lld" + EOF + fi +} + +src_compile() { + env $(cat "${S}"/config.env)\ + "${EPYTHON}" ./x.py build --config="${S}"/config.toml -j$(makeopts_jobs) \ + --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305 +} + +src_install() { + local rust_target abi_libdir + + env DESTDIR="${D}" "${EPYTHON}" ./x.py install || 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 cargo; then + mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die + fi + if use clippy; then + mv "${D}/usr/bin/clippy-driver" "${D}/usr/bin/clippy-driver-${PV}" || die + mv "${D}/usr/bin/cargo-clippy" "${D}/usr/bin/cargo-clippy-${PV}" || die + fi + if use rls; then + mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die + fi + if use rustfmt; then + mv "${D}/usr/bin/rustfmt" "${D}/usr/bin/rustfmt-${PV}" || die + mv "${D}/usr/bin/cargo-fmt" "${D}/usr/bin/cargo-fmt-${PV}" || die + fi + + # Copy shared library versions of standard libraries for all targets + # into the system's abi-dependent lib directories because the rust + # installer only does so for the native ABI. + for v in $(multilib_get_enabled_abi_pairs); do + if [ ${v##*.} = ${DEFAULT_ABI} ]; then + continue + fi + abi_libdir=$(get_abi_LIBDIR ${v##*.}) + rust_target=$(get_abi_CHOST ${v##*.}) + mkdir -p "${D}/usr/${abi_libdir}" + cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ + "${D}/usr/${abi_libdir}" || die + done + + dodoc COPYRIGHT + + # FIXME: + # Really not sure if that env is needed, specailly LDPATH + cat <<-EOF > "${T}"/50${P} + LDPATH="/usr/$(get_libdir)/${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 + if use cargo; then + echo /usr/bin/cargo >> "${T}/provider-${P}" + fi + if use clippy; then + echo /usr/bin/clippy-driver >> "${T}/provider-${P}" + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" + fi + if use rls; then + echo /usr/bin/rls >> "${T}/provider-${P}" + fi + if use rustfmt; then + echo /usr/bin/rustfmt >> "${T}/provider-${P}" + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" + fi + 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 +} (DIR) diff --git a/virtual/cargo/cargo-1.27.0.ebuild b/virtual/cargo/cargo-1.27.0.ebuild t@@ -1,20 +0,0 @@ -# Copyright 1999-2018 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="Package manager for Rust" -HOMEPAGE="" -SRC_URI="" - -LICENSE="" -SLOT="0" -KEYWORDS="amd64 ~arm64 x86" - -CARGO_DEPEND_VERSION="0.$(($(ver_cut 2) + 1)).0" - -RDEPEND="|| ( - =dev-lang/rust-${PV}*[cargo] - =dev-lang/rust-bin-${PV}*[cargo] - =dev-util/cargo-${CARGO_DEPEND_VERSION}* - )" (DIR) diff --git a/virtual/cargo/metadata.xml b/virtual/cargo/metadata.xml t@@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> -<pkgmetadata> - <maintainer type="project"> - <email>rust@gentoo.org</email> - <name>Rust Project</name> - </maintainer> -</pkgmetadata> (DIR) diff --git a/virtual/rust/rust-1.27.0.ebuild b/virtual/rust/rust-1.27.0.ebuild t@@ -1,15 +0,0 @@ -# Copyright 1999-2018 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="Virtual for Rust language compiler" -HOMEPAGE="" -SRC_URI="" - -LICENSE="" -SLOT="0" -KEYWORDS="amd64 ~arm64 x86" - -BDEPEND="" -RDEPEND="|| ( =dev-lang/rust-${PV}* =dev-lang/rust-bin-${PV}* )"