From d5ca5aec77f670936eae049143b7ecd0beaec353 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 30 Sep 2016 15:14:41 +0200 Subject: [PATCH] rust: update to 1.12.0. Use self-built Rust for musl for bootstrapping for now. --- .../rust/patches/dont-require-filecheck.patch | 4 +-- srcpkgs/rust/patches/link-llvm-static.patch | 10 ++++++ .../rust/patches/link-musl-dynamically.patch | 24 +++++++------- srcpkgs/rust/patches/llvm-with-ffi.patch | 26 +++++----------- srcpkgs/rust/template | 31 +++++++++++-------- 5 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 srcpkgs/rust/patches/link-llvm-static.patch diff --git a/srcpkgs/rust/patches/dont-require-filecheck.patch b/srcpkgs/rust/patches/dont-require-filecheck.patch index 430cc9320ca..c1f5a110725 100644 --- a/srcpkgs/rust/patches/dont-require-filecheck.patch +++ b/srcpkgs/rust/patches/dont-require-filecheck.patch @@ -2,8 +2,8 @@ From: Jakub Jirutka Date: Thu, 04 Aug 2016 17:53:00 +0200 Subject: [PATCH] Do not require FileCheck ---- a/src/bootstrap/build/sanity.rs -+++ b/src/bootstrap/build/sanity.rs +--- a/src/bootstrap/sanity.rs ++++ b/src/bootstrap/sanity.rs @@ -76,12 +76,6 @@ need_cmd(build.cxx(host).as_ref()); } diff --git a/srcpkgs/rust/patches/link-llvm-static.patch b/srcpkgs/rust/patches/link-llvm-static.patch new file mode 100644 index 00000000000..52d7622c8d1 --- /dev/null +++ b/srcpkgs/rust/patches/link-llvm-static.patch @@ -0,0 +1,10 @@ +--- rustc-1.12.0/src/librustc_llvm/build.rs.orig ++++ rustc-1.12.0/src/librustc_llvm/build.rs +@@ -128,6 +128,7 @@ + // of llvm-config, not the target that we're attempting to link. + let mut cmd = Command::new(&llvm_config); + cmd.arg("--libs"); ++ cmd.arg("--link-static"); + if !is_crossed { + cmd.arg("--system-libs"); + } diff --git a/srcpkgs/rust/patches/link-musl-dynamically.patch b/srcpkgs/rust/patches/link-musl-dynamically.patch index d15eb91ded2..3f75f4a257d 100644 --- a/srcpkgs/rust/patches/link-musl-dynamically.patch +++ b/srcpkgs/rust/patches/link-musl-dynamically.patch @@ -7,14 +7,14 @@ Static linking of rustc on Alpine doesn't work yet. This patch is ported from https://gist.github.com/japaric/52b8816a4c86f5a4699bcc50ebc3e020. ---- a/src/bootstrap/build/sanity.rs -+++ b/src/bootstrap/build/sanity.rs +--- a/src/bootstrap/sanity.rs ++++ b/src/bootstrap/sanity.rs @@ -97,26 +91,6 @@ panic!("the iOS target is only supported on OSX"); } - + - // Make sure musl-root is valid if specified -- if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) { +- if target.contains("musl") && !target.contains("mips") { - match build.config.musl_root { - Some(ref root) => { - if fs::metadata(root.join("lib/libc.a")).is_err() { @@ -38,13 +38,11 @@ https://gist.github.com/japaric/52b8816a4c86f5a4699bcc50ebc3e020. // Cygwin. The Cygwin build does not have generators for Visual --- a/src/liblibc/src/unix/mod.rs +++ b/src/liblibc/src/unix/mod.rs -@@ -187,11 +187,6 @@ +@@ -197,9 +197,6 @@ } else if #[cfg(all(not(stdbuild), feature = "use_std"))] { // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. -- } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips")), -- target_env = "musleabi", -- target_env = "musleabihf"))] { +- } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { - #[link(name = "c", kind = "static")] - extern {} } else if #[cfg(target_os = "emscripten")] { @@ -53,9 +51,9 @@ https://gist.github.com/japaric/52b8816a4c86f5a4699bcc50ebc3e020. --- a/src/librustc_back/target/x86_64_unknown_linux_musl.rs +++ b/src/librustc_back/target/x86_64_unknown_linux_musl.rs @@ -11,7 +11,7 @@ - use target::Target; - - pub fn target() -> Target { + use target::{Target, TargetResult}; + + pub fn target() -> TargetResult { - let mut base = super::linux_musl_base::opts(); + let mut base = super::linux_base::opts(); base.cpu = "x86-64".to_string(); @@ -65,9 +63,9 @@ https://gist.github.com/japaric/52b8816a4c86f5a4699bcc50ebc3e020. +++ b/src/libunwind/build.rs @@ -16,9 +16,7 @@ let target = env::var("TARGET").unwrap(); - + if target.contains("linux") { -- if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) { +- if target.contains("musl") && !target.contains("mips") { - println!("cargo:rustc-link-lib=static=unwind"); - } else if !target.contains("android") { + if !target.contains("android") { diff --git a/srcpkgs/rust/patches/llvm-with-ffi.patch b/srcpkgs/rust/patches/llvm-with-ffi.patch index 23504eac715..22ba1eb7615 100644 --- a/srcpkgs/rust/patches/llvm-with-ffi.patch +++ b/srcpkgs/rust/patches/llvm-with-ffi.patch @@ -1,19 +1,9 @@ -From: Jakub Jirutka -Date: Thu, 04 Aug 2016 17:53:00 +0200 -Subject: [PATCH] Workaround for external LLVM built with LLVM_ENABLE_FFI - -Workaround for problem with LLVM_ENABLE_FFI described in -https://github.com/rust-lang/rust/issues/34486. - ---- a/src/librustc_llvm/lib.rs -+++ b/src/librustc_llvm/lib.rs -@@ -577,6 +577,9 @@ - #[cfg(not(cargobuild))] - extern {} - -+#[link(name = "ffi")] -+extern {} +--- rustc-1.12.0/src/librustc_llvm/lib.rs.orig ++++ rustc-1.12.0/src/librustc_llvm/lib.rs +@@ -481,3 +481,6 @@ + mod llvmdeps { + include! { env!("CFG_LLVM_LINKAGE_FILE") } + } + - #[linked_from = "rustllvm"] // not quite true but good enough - extern { - /* Create and destroy contexts. */ ++#[link(name = "ffi")] ++extern {} diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index c40d3417500..8e3bfd2c001 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -1,6 +1,6 @@ # Template file for 'rust' pkgname=rust -version=1.11.0 +version=1.12.0 revision=1 wrksrc="rustc-${version}" lib32disabled=yes @@ -15,27 +15,27 @@ maintainer="Juan RP " homepage="http://www.rust-lang.org/" license="MIT, Apache-2.0" distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz" -checksum=3685034a78e70637bdfa3117619f759f2481002fd9abbc78cc0f737c9974de6a +checksum=ac5907d6fa96c19bd5901d8d99383fb8755127571ead3d4070cce9c1fb5f337a case "$XBPS_MACHINE" in x86_64-musl) distfiles+=" - https://alpine.geeknet.cz/distfiles/rustc-1.10.0-x86_64-unknown-linux-musl.tar.gz - https://alpine.geeknet.cz/distfiles/rust-std-1.10.0-x86_64-unknown-linux-musl.tar.gz + https://repo.voidlinux.eu/distfiles/rustc-1.11.0-x86_64-unknown-linux-musl.tar.gz + https://repo.voidlinux.eu/distfiles/rust-std-1.11.0-x86_64-unknown-linux-musl.tar.gz https://alpine.geeknet.cz/distfiles/cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz" checksum+=" - a7d8baacfa2225c923de28ecef2c9550c1d82cef3b90f6a1b8431359da7e7e69 - 335527615fc1a5f53d41c1d8556645bfe0b4f3a39f72ad859b392392066d9239 + 6f1cfcab1760573f949265726951e9032f9f3ce8a202d727c1f84026341b8c33 + fbb6398b8537f9435d9c362f5e79be000df9df090d5d2bc6113c69bc050aa1fa 587172026c0565e839d96b0c1d4c68c000927817398241f96682dca47fa8c3b9" ;; x86_64) distfiles+=" - https://static.rust-lang.org/dist/2016-07-05/rustc-1.10.0-x86_64-unknown-linux-gnu.tar.gz - https://static.rust-lang.org/dist/2016-07-05/rust-std-1.10.0-x86_64-unknown-linux-gnu.tar.gz - https://static.rust-lang.org/cargo-dist/2016-05-22/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz" + https://static.rust-lang.org/dist/2016-08-16/rustc-1.11.0-x86_64-unknown-linux-gnu.tar.gz + https://static.rust-lang.org/dist/2016-08-16/rust-std-1.11.0-x86_64-unknown-linux-gnu.tar.gz + https://static.rust-lang.org/cargo-dist/2016-07-05/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz" checksum+=" - 4301f9a09f2b88ac1238d886dfa14d864be7401f4d8a31277303eebe0c7a56c3 - 41b541148a2f595c6b6d5b26e1aabfc3c090fe45686bb272c13e20d4aba03c44 + e9d27a72900da33c1bbd0e59dd42fd6414c6bcdfa33593fb7c7360068406394a + 893a53b5f78ec9eb7ac4ad3b3bd375d2ddad8ca1687ed5867621ec157eddbea5 274df0e18ce91c53145df31ebb82c1886ce0e149fc27081210c85f37b2c05adf" ;; esac @@ -53,6 +53,7 @@ post_extract() { # but since we're basically rebuilding rustc with the same version, # it's actually safe. # Note: --enable-local-rebuild from #33787 didn't work, don't know why. + export LD_LIBRARY_PATH="$wrksrc/stage0/lib" rustc_ver="$($wrksrc/stage0/bin/rustc --version | cut -f2 -d ' ')" rustc_key="$(printf "$rustc_ver" | md5sum | cut -c1-8)" sed -Ei \ @@ -67,10 +68,13 @@ post_extract() { cargo = "$wrksrc/stage0/bin/cargo" rustc = "$wrksrc/stage0/bin/rustc" EOF + + sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py } pre_build() { export CARGO_HOME="$wrksrc/.cargo" + export LD_LIBRARY_PATH="$wrksrc/stage0/lib" } do_configure() { @@ -81,6 +85,7 @@ do_configure() { x86_64-musl) _triplet=x86_64-unknown-linux-musl;; *) _triplet=$XBPS_TARGET_MACHINE;; esac + export LD_LIBRARY_PATH="$wrksrc/stage0/lib" configure_args=" --prefix=/usr --host=${_triplet} @@ -102,8 +107,8 @@ do_configure() { } do_install() { vmkdir usr - tar xf build/dist/rustc-*.tar.gz -C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in - tar xf build/dist/rust-std-*.tar.gz -C "$DESTDIR/usr/lib" --strip-components=3 --exclude=manifest.in + tar xf build/dist/rustc-*-*-*.tar.gz -C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in + tar xf build/dist/rust-std-*-*-*.tar.gz -C "$DESTDIR/usr/lib" --strip-components=3 --exclude=manifest.in vlicense COPYRIGHT vlicense LICENSE-APACHE