From 0fbec0846e511e1ffc73201022cdf3eeb371575d Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Mon, 8 Oct 2018 17:50:52 +0200 Subject: [PATCH] rust: fix musl build [ci skip] --- srcpkgs/rust/files/musl.patch | 11 ----------- srcpkgs/rust/patches/musl-dont-use-crt-static.patch | 11 +++++++++++ srcpkgs/rust/template | 6 +----- 3 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 srcpkgs/rust/files/musl.patch create mode 100644 srcpkgs/rust/patches/musl-dont-use-crt-static.patch diff --git a/srcpkgs/rust/files/musl.patch b/srcpkgs/rust/files/musl.patch deleted file mode 100644 index 8bcb259789..0000000000 --- a/srcpkgs/rust/files/musl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- rustc-1.28.0-src/src/librustc_target/spec/x86_64_unknown_linux_musl.rs.orig 2018-08-08 23:21:51.673454236 +0200 -+++ rustc-1.28.0-src/src/librustc_target/spec/x86_64_unknown_linux_musl.rs 2018-08-08 23:23:11.080834122 +0200 -@@ -11,7 +11,7 @@ - use spec::{LinkerFlavor, 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(); - base.max_atomic_width = Some(64); - base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); diff --git a/srcpkgs/rust/patches/musl-dont-use-crt-static.patch b/srcpkgs/rust/patches/musl-dont-use-crt-static.patch new file mode 100644 index 0000000000..b180a9fd05 --- /dev/null +++ b/srcpkgs/rust/patches/musl-dont-use-crt-static.patch @@ -0,0 +1,11 @@ +Reason: https://gist.github.com/ab75b3796a9383423deecc0828494ac5 +--- rustc-1.28.0-src/src/librustc_target/spec/linux_musl_base.rs.orig 2018-10-08 21:02:21.588611506 +0200 ++++ rustc-1.28.0-src/src/librustc_target/spec/linux_musl_base.rs 2018-10-08 21:02:40.846454873 +0200 +@@ -61,7 +61,7 @@ + base.post_link_objects_crt.push("crtn.o".to_string()); + + // These targets statically link libc by default +- base.crt_static_default = true; ++ base.crt_static_default = false; + // These targets allow the user to choose between static and dynamic linking. + base.crt_static_respected = true; diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index b34f5c94e7..68a18bc0a1 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -89,10 +89,6 @@ esac post_extract() { rm -rf src/llvm - case "$XBPS_MACHINE" in - *-musl) patch -p1 < $FILESDIR/musl.patch ;; - esac - if [ -z "$CROSS_BUILD" ]; then mkdir -p stage0 cp -bflr ../rustc-*/rustc/* stage0 @@ -155,7 +151,7 @@ do_configure() { fi case "$XBPS_TARGET_MACHINE" in *-musl) - configure_args+=" --musl-root=/usr" + configure_args+=" --set=target.${_host_triplet}.musl-root=/usr" ;; esac