aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAric Belsito <lluixhi@gmail.com>2018-06-18 14:55:10 -0700
committerAric Belsito <lluixhi@gmail.com>2018-06-18 14:55:10 -0700
commit7db92da7f962789831783ca8f67f501fcc6a1267 (patch)
treeaa99106a7712c7eac7de60e9bc998203d000f368
parentsys-boot/syslinux: add package (diff)
downloadmusl-7db92da7f962789831783ca8f67f501fcc6a1267.tar.gz
musl-7db92da7f962789831783ca8f67f501fcc6a1267.tar.bz2
musl-7db92da7f962789831783ca8f67f501fcc6a1267.zip
dev-lang/rust: version bump to 1.26.2
Some testing required!!
-rw-r--r--dev-lang/rust/Manifest1
-rw-r--r--dev-lang/rust/files/1.26.2/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch381
-rw-r--r--dev-lang/rust/files/1.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch23
-rw-r--r--dev-lang/rust/metadata.xml6
-rw-r--r--dev-lang/rust/rust-1.26.2.ebuild353
5 files changed, 761 insertions, 3 deletions
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
index 0424663c..7815bff6 100644
--- a/dev-lang/rust/Manifest
+++ b/dev-lang/rust/Manifest
@@ -9,3 +9,4 @@ DIST rust-1.25.0-i686-unknown-linux-musl.tar.xz 100253196 BLAKE2B 2bc6d9d2a1dfab
DIST rust-1.25.0-x86_64-unknown-linux-gnu.tar.xz 111059260 BLAKE2B ae982976a735c2b5226722207a983bb638cb7c0cb0ceb6b438456d54fac86a5d1892b535f01ac463157205c0ae27ae876482f6ac1fa269a9ec3e1177be0cef2e SHA512 aea93ff64f620a1dd6b48d07ec3dcbc126b2f5c17b4697c096ec8cd02a3c7dfec7ae7d5df70a55eceb372897ad12f3d01c67d5aaea0167a80270931c61323f78
DIST rust-1.25.0-x86_64-unknown-linux-musl.tar.xz 97724224 BLAKE2B ad0accfb670acf2a02f9bb1c8e6a80ab7be2d1e0f01bc2da13744ab164774cc318255d78a657b84ad0f97ab1ee3fc4a53b4cf1ee71ba52984cbcd52bd64f2387 SHA512 ee250193db5e20edb80fe864609b1c16ca5da5f2ca16700f5f938195d43dd5d3de8cd138f64feebd73f77fbf4f61196459c13420ba6c4f451b9db266db92219a
DIST rustc-1.25.0-src.tar.xz 56108536 BLAKE2B c4a5e56b0e345b5ccde699f68659ac10793670047d2806bdab856d56aa5b960a0df5b947f7c0a7dadfcb7edbe4f9c1a71a94c5f240e91c93296a90d232030645 SHA512 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2
+DIST rustc-1.26.2-src.tar.xz 54613640 BLAKE2B f361b7a0ed40ccb026750b4a70b99931f1abf52024e907b588e339902de2fbbd15501d237ac048d0537005834b0a2f49935f654a8c75d40ed95c65894f611481 SHA512 a598858ddce0e05d1d431be383400f44fc551eb2e368f37b01670c0b65ea5da6a7d5b2b68bb6ef806d2107cfa0d5007008442ad4d5ddb17d18d04e0ab31600b0
diff --git a/dev-lang/rust/files/1.26.2/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/1.26.2/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
new file mode 100644
index 00000000..53de5675
--- /dev/null
+++ b/dev-lang/rust/files/1.26.2/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
@@ -0,0 +1,381 @@
+diff -Naur rustc-1.26.2-src.orig/config.toml.example rustc-1.26.2-src/config.toml.example
+--- rustc-1.26.2-src.orig/config.toml.example 2018-06-16 11:22:33.396391832 -0700
++++ rustc-1.26.2-src/config.toml.example 2018-06-16 11:22:53.998391463 -0700
+@@ -385,12 +385,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 -Naur rustc-1.26.2-src.orig/src/bootstrap/bin/rustc.rs rustc-1.26.2-src/src/bootstrap/bin/rustc.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/bin/rustc.rs 2018-06-16 11:22:29.172391908 -0700
++++ rustc-1.26.2-src/src/bootstrap/bin/rustc.rs 2018-06-16 11:23:27.848390857 -0700
+@@ -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;
+@@ -119,15 +118,6 @@
+ 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 -Naur rustc-1.26.2-src.orig/src/bootstrap/cc_detect.rs rustc-1.26.2-src/src/bootstrap/cc_detect.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/cc_detect.rs 2018-06-16 11:22:29.173391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/cc_detect.rs 2018-06-16 11:24:29.726389749 -0700
+@@ -87,7 +87,7 @@
+ 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();
+@@ -115,7 +115,7 @@
+ 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()));
+@@ -126,8 +126,7 @@
+ 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
+@@ -164,26 +163,6 @@
+ }
+ }
+
+- "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 -Naur rustc-1.26.2-src.orig/src/bootstrap/compile.rs rustc-1.26.2-src/src/bootstrap/compile.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/compile.rs 2018-06-16 11:22:29.173391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/compile.rs 2018-06-16 11:25:15.744388925 -0700
+@@ -79,13 +79,6 @@
+ });
+ 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,
+@@ -94,11 +87,6 @@
+ return;
+ }
+
+- if target.contains("musl") {
+- let libdir = builder.sysroot_libdir(compiler, target);
+- copy_musl_third_party_objects(build, target, &libdir);
+- }
+-
+ let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
+ build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
+ let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
+@@ -120,20 +108,6 @@
+ }
+ }
+
+-/// 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: &Builder,
+@@ -179,11 +153,6 @@
+ 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 -Naur rustc-1.26.2-src.orig/src/bootstrap/config.rs rustc-1.26.2-src/src/bootstrap/config.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/config.rs 2018-06-16 11:22:29.173391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/config.rs 2018-06-16 11:25:42.883388439 -0700
+@@ -124,8 +124,6 @@
+ 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>,
+@@ -157,7 +155,6 @@
+ pub linker: Option<PathBuf>,
+ pub ndk: Option<PathBuf>,
+ pub crt_static: Option<bool>,
+- pub musl_root: Option<PathBuf>,
+ pub qemu_rootfs: Option<PathBuf>,
+ }
+
+@@ -283,7 +280,6 @@
+ 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>,
+@@ -312,7 +308,6 @@
+ linker: Option<String>,
+ android_ndk: Option<String>,
+ crt_static: Option<bool>,
+- musl_root: Option<String>,
+ qemu_rootfs: Option<String>,
+ }
+
+@@ -491,7 +486,6 @@
+ set(&mut config.lld_enabled, rust.lld);
+ 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 {
+@@ -527,7 +521,6 @@
+ 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 -Naur rustc-1.26.2-src.orig/src/bootstrap/configure.py rustc-1.26.2-src/src/bootstrap/configure.py
+--- rustc-1.26.2-src.orig/src/bootstrap/configure.py 2018-06-16 11:22:29.174391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/configure.py 2018-06-16 11:26:09.751387957 -0700
+@@ -107,26 +107,6 @@
+ "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 -Naur rustc-1.26.2-src.orig/src/bootstrap/lib.rs rustc-1.26.2-src/src/bootstrap/lib.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/lib.rs 2018-06-16 11:22:29.173391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/lib.rs 2018-06-16 11:26:19.201387788 -0700
+@@ -701,14 +701,6 @@
+ }
+ }
+
+- /// 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 -Naur rustc-1.26.2-src.orig/src/bootstrap/sanity.rs rustc-1.26.2-src/src/bootstrap/sanity.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/sanity.rs 2018-06-16 11:22:29.174391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/sanity.rs 2018-06-16 11:26:47.473387282 -0700
+@@ -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 @@
+ 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 -Naur rustc-1.26.2-src.orig/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile rustc-1.26.2-src/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
+--- rustc-1.26.2-src.orig/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile 2018-06-16 11:22:23.405392011 -0700
++++ rustc-1.26.2-src/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile 2018-06-16 11:27:03.296386998 -0700
+@@ -30,8 +30,6 @@
+ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-i586=/musl-i586 \
+- --musl-root-i686=/musl-i686 \
+ --enable-extended \
+ --disable-docs
+
+diff -Naur rustc-1.26.2-src.orig/src/ci/docker/dist-various-1/Dockerfile rustc-1.26.2-src/src/ci/docker/dist-various-1/Dockerfile
+--- rustc-1.26.2-src.orig/src/ci/docker/dist-various-1/Dockerfile 2018-06-16 11:22:23.407392011 -0700
++++ rustc-1.26.2-src/src/ci/docker/dist-various-1/Dockerfile 2018-06-16 11:27:20.337386693 -0700
+@@ -89,12 +89,6 @@
+ CFLAGS_armv5te_unknown_linux_gnueabi="-march=armv5te -marm -mfloat-abi=soft"
+
+ ENV RUST_CONFIGURE_ARGS \
+- --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 -Naur rustc-1.26.2-src.orig/src/ci/docker/dist-x86_64-musl/Dockerfile rustc-1.26.2-src/src/ci/docker/dist-x86_64-musl/Dockerfile
+--- rustc-1.26.2-src.orig/src/ci/docker/dist-x86_64-musl/Dockerfile 2018-06-16 11:22:23.408392011 -0700
++++ rustc-1.26.2-src/src/ci/docker/dist-x86_64-musl/Dockerfile 2018-06-16 11:27:35.208386427 -0700
+@@ -30,7 +30,6 @@
+ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-x86_64=/musl-x86_64 \
+ --enable-extended \
+ --disable-docs
+
+diff -Naur rustc-1.26.2-src.orig/src/librustc_back/target/linux_musl_base.rs rustc-1.26.2-src/src/librustc_back/target/linux_musl_base.rs
+--- rustc-1.26.2-src.orig/src/librustc_back/target/linux_musl_base.rs 2018-06-16 11:22:29.170391908 -0700
++++ rustc-1.26.2-src/src/librustc_back/target/linux_musl_base.rs 2018-06-16 11:28:09.763385808 -0700
+@@ -14,10 +14,6 @@
+ 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 @@
+ 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.
diff --git a/dev-lang/rust/files/1.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch b/dev-lang/rust/files/1.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
new file mode 100644
index 00000000..99e992a8
--- /dev/null
+++ b/dev-lang/rust/files/1.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
@@ -0,0 +1,23 @@
+diff -Naur rustc-1.26.2-src.orig/src/bootstrap/builder.rs rustc-1.26.2-src/src/bootstrap/builder.rs
+--- rustc-1.26.2-src.orig/src/bootstrap/builder.rs 2018-06-16 11:22:29.173391907 -0700
++++ rustc-1.26.2-src/src/bootstrap/builder.rs 2018-06-16 11:31:32.573382176 -0700
+@@ -709,7 +709,7 @@
+
+ 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());
+@@ -722,9 +722,7 @@
+ if let Ok(cxx) = self.cxx(target) {
+ 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);
+ }
+ }
+
diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml
index 3769f574..c03ce153 100644
--- a/dev-lang/rust/metadata.xml
+++ b/dev-lang/rust/metadata.xml
@@ -8,9 +8,9 @@
<use>
<flag name="extended">Build and install rls, rustfmt and cargo
alongside the compiler and stdlib</flag>
- <flag name="system-llvm">Use system <pkg>sys-devel/llvm</pkg> in
- place of the bundled one</flag>
- <flag name="jemalloc">Use <pkg>sys-libs/jemalloc</pkg> as the
+ <flag name="jemalloc">Use <pkg>dev-libs/jemalloc</pkg> as the
standard memory allocator</flag>
+ <flag name="wasm">Build support for the wasm32-unknown-unknown
+ target</flag>
</use>
</pkgmetadata>
diff --git a/dev-lang/rust/rust-1.26.2.ebuild b/dev-lang/rust/rust-1.26.2.ebuild
new file mode 100644
index 00000000..314db78e
--- /dev/null
+++ b/dev-lang/rust/rust-1.26.2.ebuild
@@ -0,0 +1,353 @@
+# 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)).0"
+
+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-${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-2.5.0:=
+ <dev-libs/libressl-2.7.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.26.2/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.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"
+)
+
+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
+ fi
+
+ rm "${D}/usr/share/doc/${P}/LICENSE-APACHE{,.old}" || die
+ rm "${D}/usr/share/doc/${P}/LICENSE-MIT{,.old}" || 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
+}