X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by lists.alpinelinux.org (Postfix) with ESMTP id 18C215C4D5D for ; Mon, 23 Oct 2017 12:01:24 +0000 (GMT) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id ADD1D9E302F; Mon, 23 Oct 2017 12:01:23 +0000 (GMT) Received: from ncopa-macbook.copa.dup.pw (176.84.213.193.static.cust.telenor.com [193.213.84.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 3B7BA9E0126; Mon, 23 Oct 2017 12:01:22 +0000 (GMT) Date: Mon, 23 Oct 2017 14:01:16 +0200 From: Natanael Copa To: Marat Safin Cc: alpine-aports@lists.alpinelinux.org, Jakub Jirutka Subject: Re: [alpine-aports] [PATCH] community/rust: upgrade to 1.8 Message-ID: <20171023140116.413ec154@ncopa-macbook.copa.dup.pw> In-Reply-To: <20171018124500.27823-1-jeizsm@gmail.com> References: <20171018124500.27823-1-jeizsm@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-alpine-linux-musl) X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Jakub, ok to push this? (with fixed commit message 1.8 -> 1.18) -nc On Wed, 18 Oct 2017 15:45:00 +0300 Marat Safin wrote: > Signed-off-by: Marat Safin > --- > community/rust/APKBUILD | 13 ++-- > community/rust/alpine-target.patch | 8 +- > community/rust/fix-build.patch | 92 +++++++++++++++++++++++ > community/rust/musl-fix-jemalloc.patch | 61 --------------- > community/rust/musl-fix-linux_musl_base.patch | 8 +- > community/rust/musl-fix-static-linking.patch | 42 +++++++---- > community/rust/musl-support-dynamic-linking.patch | 12 ++- > 7 files changed, 142 insertions(+), 94 deletions(-) > create mode 100644 community/rust/fix-build.patch > delete mode 100644 community/rust/musl-fix-jemalloc.patch > > diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD > index 48ce4e7ffa..80f8ad0c4e 100644 > --- a/community/rust/APKBUILD > +++ b/community/rust/APKBUILD > @@ -2,7 +2,7 @@ > # Contributor: Shiz > # Maintainer: Jakub Jirutka > pkgname=rust > -pkgver=1.17.0 > +pkgver=1.18.0 > _llvmver=3.9 > _bootver=1.16.0 > pkgrel=3 > @@ -29,7 +29,6 @@ source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz > musl-support-dynamic-linking.patch > musl-fix-static-linking.patch > musl-fix-linux_musl_base.patch > - musl-fix-jemalloc.patch > llvm-with-ffi.patch > static-pie.patch > need-rpath.patch > @@ -38,6 +37,7 @@ source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz > alpine-move-py-scripts-to-share.patch > alpine-change-rpath-to-rustlib.patch > alpine-target.patch > + fix-build.patch > check-rustc > " > builddir="$srcdir/rustc-$pkgver-src" > @@ -169,11 +169,10 @@ _mv() { > mv $@ > } > > -sha512sums="781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eacafe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 rustc-1.17.0-src.tar.gz > -b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b49456098507503832c20619d4bd74246dbc99c78116634a68a6df994793e9a94 musl-support-dynamic-linking.patch > -292c1cb4f751d830f5f1300d7ef94f573f698ac51e18243d7ff0d5a47bb1729bb2cbe8fb456e7a479213df5e5fbf49e360c9439d0f5ad7126cb72d161c91566a musl-fix-static-linking.patch > -f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef musl-fix-linux_musl_base.patch > -c913d04ef419b2b6d8e453f72894070f263c9292abf97114a51884d475d03ce5b032053f1676ba9364800b4b35e394f707995058530ad5e4122c60f65ddd3db7 musl-fix-jemalloc.patch > +sha512sums="eff0460b647dfb3490e28d4dec4f9781d31a942f22de75d9bd1ba31591597226b6862ec5132e8b4fcdbcf6e6ffa085ca5dda7ff8260cd82388fc13e8d3b4a2eb rustc-1.18.0-src.tar.gz > +b5db9ed04eac26c6fc62cde3f19d29837a5feea68e79165c23b5b5cade2e1d193f2399d27f7622b230996da9565f78825be154574f1cd59189ded8a03a766cfb musl-support-dynamic-linking.patch > +a6071aab49a7fcd38189a73b0c49ee0808e2063b4e6531643ef154b65bae699e8b42537a9c4400bf2662169d2350ad25f1166de03438efaf9578d9422dffdd8f musl-fix-static-linking.patch > +9ebfb10abb50d74ff08d257d85257ce70ac3ce834aa95a8901808497b14acf3ea898fb197de64d13554eb5feedabe9fd04fec2cc6a7bea9b1335684bfcdcd88b musl-fix-linux_musl_base.patch > dc6432293bd060d5e3a73f25870867654fae61995dcd919e244a2dc686b6107556deed8c59ca6002182bfeff5ebc1ca2b89c4028ab0fbfb79e65defe47c9b4b0 llvm-with-ffi.patch > 5aaf6715b27b8b786740a55b91216d47985fbef3ccb0ef7e6a81696a2823671f8306143f7ecf77e66af91ef1500072524b9b4c7569508922ad5268df6080fda1 static-pie.patch > ff633f2a46c683ad698d1c09c98c06ce9ee9b8d55fa5593cdd485b439ebca3273794d29b5ff32b887be8666f52913a23af6e133c782bd0c4e2c88e306dd3a494 need-rpath.patch > diff --git a/community/rust/alpine-target.patch b/community/rust/alpine-target.patch > index e013a6bc2e..fc79b45b9a 100644 > --- a/community/rust/alpine-target.patch > +++ b/community/rust/alpine-target.patch > @@ -8,7 +8,7 @@ and distribution-specific quirks instead of polluting the main musl target of > > --- /dev/null > +++ b/src/librustc_back/target/i586_alpine_linux_musl.rs > -@@ -0,0 +1,32 @@ > +@@ -0,0 +1,34 @@ > +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT > +// file at the top-level directory of this distribution and at > +// http://rust-lang.org/COPYRIGHT. > @@ -19,6 +19,7 @@ and distribution-specific quirks instead of polluting the main musl target of > +// option. This file may not be copied, modified, or distributed > +// except according to those terms. > + > ++use LinkerFlavor; > +use target::{Target, TargetResult}; > + > +pub fn target() -> TargetResult { > @@ -38,6 +39,7 @@ and distribution-specific quirks instead of polluting the main musl target of > + target_os: "linux".to_string(), > + target_env: "musl".to_string(), > + target_vendor: "alpine".to_string(), > ++ linker_flavor: LinkerFlavor::Gcc, > + options: base, > + }) > +} > @@ -55,7 +57,7 @@ and distribution-specific quirks instead of polluting the main musl target of > /// Everything `rustc` knows about how to compile for a specific target. > --- /dev/null > +++ b/src/librustc_back/target/x86_64_alpine_linux_musl.rs > -@@ -0,0 +1,32 @@ > +@@ -0,0 +1,34 @@ > +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT > +// file at the top-level directory of this distribution and at > +// http://rust-lang.org/COPYRIGHT. > @@ -66,6 +68,7 @@ and distribution-specific quirks instead of polluting the main musl target of > +// option. This file may not be copied, modified, or distributed > +// except according to those terms. > + > ++use LinkerFlavor; > +use target::{Target, TargetResult}; > + > +pub fn target() -> TargetResult { > @@ -85,6 +88,7 @@ and distribution-specific quirks instead of polluting the main musl target of > + target_os: "linux".to_string(), > + target_env: "musl".to_string(), > + target_vendor: "alpine".to_string(), > ++ linker_flavor: LinkerFlavor::Gcc, > + options: base, > + }) > +} > diff --git a/community/rust/fix-build.patch b/community/rust/fix-build.patch > new file mode 100644 > index 0000000000..0a8482d731 > --- /dev/null > +++ b/community/rust/fix-build.patch > @@ -0,0 +1,92 @@ > +diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs > +index 56cbb4cecf2a..dc9dac736278 100644 > +--- a/src/bootstrap/flags.rs > ++++ b/src/bootstrap/flags.rs > +@@ -242,11 +242,18 @@ Arguments: > + let cwd = t!(env::current_dir()); > + let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::>(); > + > ++ let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| { > ++ if fs::metadata("config.toml").is_ok() { > ++ Some(PathBuf::from("config.toml")) > ++ } else { > ++ None > ++ } > ++ }); > + > + // All subcommands can have an optional "Available paths" section > + if matches.opt_present("verbose") { > + let flags = Flags::parse(&["build".to_string()]); > +- let mut config = Config::default(); > ++ let mut config = Config::parse(&flags.build, cfg_file.clone()); > + config.build = flags.build.clone(); > + let mut build = Build::new(flags, config); > + metadata::build(&mut build); > +@@ -307,14 +314,6 @@ Arguments: > + }; > + > + > +- let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| { > +- if fs::metadata("config.toml").is_ok() { > +- Some(PathBuf::from("config.toml")) > +- } else { > +- None > +- } > +- }); > +- > + let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap()); > + > + if matches.opt_present("incremental") { > +diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs > +index 5ca5ce1648f2..5ef18b89841f 100644 > +--- a/src/bootstrap/bin/main.rs > ++++ b/src/bootstrap/bin/main.rs > +@@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build}; > + fn main() { > + let args = env::args().skip(1).collect::>(); > + let flags = Flags::parse(&args); > +- let mut config = Config::parse(&flags.build, flags.config.clone()); > +- > +- // compat with `./configure` while we're still using that > +- if std::fs::metadata("config.mk").is_ok() { > +- config.update_with_config_mk(); > +- } > +- > ++ let config = Config::parse(&flags.build, flags.config.clone()); > + Build::new(flags, config).build(); > + } > +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs > +index fd8aa320fb3d..902cd0997a8e 100644 > +--- a/src/bootstrap/config.rs > ++++ b/src/bootstrap/config.rs > +@@ -15,7 +15,7 @@ > + > + use std::collections::HashMap; > + use std::env; > +-use std::fs::File; > ++use std::fs::{self, File}; > + use std::io::prelude::*; > + use std::path::PathBuf; > + use std::process; > +@@ -410,6 +410,12 @@ impl Config { > + set(&mut config.rust_dist_src, t.src_tarball); > + } > + > ++ > ++ // compat with `./configure` while we're still using that > ++ if fs::metadata("config.mk").is_ok() { > ++ config.update_with_config_mk(); > ++ } > ++ > + return config > + } > + > +@@ -418,7 +424,7 @@ impl Config { > + /// While we still have `./configure` this implements the ability to decode > + /// that configuration into this. This isn't exactly a full-blown makefile > + /// parser, but hey it gets the job done! > +- pub fn update_with_config_mk(&mut self) { > ++ fn update_with_config_mk(&mut self) { > + let mut config = String::new(); > + File::open("config.mk").unwrap().read_to_string(&mut config).unwrap(); > + for line in config.lines() { > diff --git a/community/rust/musl-fix-jemalloc.patch b/community/rust/musl-fix-jemalloc.patch > deleted file mode 100644 > index 345398a301..0000000000 > --- a/community/rust/musl-fix-jemalloc.patch > +++ /dev/null > @@ -1,61 +0,0 @@ > -From 536011d929ecbd1170baf34e09580e567c971f95 Mon Sep 17 00:00:00 2001 > -From: Shiz > -Date: Sat, 8 Apr 2017 20:36:00 +0200 > -Subject: [PATCH] Fix jemalloc support for musl > - > -Just like DragonFlyBSD, using the same symbols as the system allocator will > -result in a segmentation fault at runtime due to allocator mismatches. > -As such, prefix the jemalloc symbols instead. > - > -Upstream-Issue: https://github.com/rust-lang/rust/pull/41168 > ---- > - src/liballoc_jemalloc/build.rs | 2 +- > - src/liballoc_jemalloc/lib.rs | 10 +++++----- > - 2 files changed, 6 insertions(+), 6 deletions(-) > - > -diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs > -index ae040a2..f3a0eeb 100644 > ---- a/src/liballoc_jemalloc/build.rs > -+++ b/src/liballoc_jemalloc/build.rs > -@@ -138,7 +138,7 @@ fn main() { > - // should be good to go! > - cmd.arg("--with-jemalloc-prefix=je_"); > - cmd.arg("--disable-tls"); > -- } else if target.contains("dragonfly") { > -+ } else if target.contains("dragonfly") || target.contains("musl") { > - cmd.arg("--with-jemalloc-prefix=je_"); > - } > - > -diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs > -index a7a67ef..83cc1ef 100644 > ---- a/src/liballoc_jemalloc/lib.rs > -+++ b/src/liballoc_jemalloc/lib.rs > -@@ -51,23 +51,23 @@ mod imp { > - // request it as unprefixing cause segfaults (mismatches in allocators). > - extern "C" { > - #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", > -- target_os = "dragonfly", target_os = "windows"), > -+ target_os = "dragonfly", target_os = "windows", target_env = "musl"), > - link_name = "je_mallocx")] > - fn mallocx(size: size_t, flags: c_int) -> *mut c_void; > - #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", > -- target_os = "dragonfly", target_os = "windows"), > -+ target_os = "dragonfly", target_os = "windows", target_env = "musl"), > - link_name = "je_rallocx")] > - fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void; > - #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", > -- target_os = "dragonfly", target_os = "windows"), > -+ target_os = "dragonfly", target_os = "windows", target_env = "musl"), > - link_name = "je_xallocx")] > - fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t; > - #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", > -- target_os = "dragonfly", target_os = "windows"), > -+ target_os = "dragonfly", target_os = "windows", target_env = "musl"), > - link_name = "je_sdallocx")] > - fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); > - #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios", > -- target_os = "dragonfly", target_os = "windows"), > -+ target_os = "dragonfly", target_os = "windows", target_env = "musl"), > - link_name = "je_nallocx")] > - fn nallocx(size: size_t, flags: c_int) -> size_t; > - } > diff --git a/community/rust/musl-fix-linux_musl_base.patch b/community/rust/musl-fix-linux_musl_base.patch > index 38194290cb..f2efb065e0 100644 > --- a/community/rust/musl-fix-linux_musl_base.patch > +++ b/community/rust/musl-fix-linux_musl_base.patch > @@ -12,13 +12,13 @@ See https://github.com/rust-lang/rust/pull/40113 > > - // Make sure that the linker/gcc really don't pull in anything, including > - // default objects, libs, etc. > -- base.pre_link_args.push("-nostdlib".to_string()); > +- 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 > // argument is *not* necessary for normal builds, but it can't hurt! > - base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string()); > + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-frame-hdr".to_string()); > > - // There's a whole bunch of circular dependencies when dealing with MUSL > - // unfortunately. To put this in perspective libc is statically linked to > @@ -42,8 +42,8 @@ See https://github.com/rust-lang/rust/pull/40113 > - // link everything as a group, not stripping anything out until everything > - // is processed. The linker will still perform a pass to strip out object > - // files but it won't do so until all objects/archives have been processed. > -- base.pre_link_args.push("-Wl,-(".to_string()); > -- base.post_link_args.push("-Wl,-)".to_string()); > +- 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 > diff --git a/community/rust/musl-fix-static-linking.patch b/community/rust/musl-fix-static-linking.patch > index 85de05e542..93fe79d15f 100644 > --- a/community/rust/musl-fix-static-linking.patch > +++ b/community/rust/musl-fix-static-linking.patch > @@ -100,22 +100,20 @@ static linking is requested, instead of dynamically as before. > > // # Telling the linker what we're doing > > -@@ -983,11 +983,14 @@ > - cmd.link_whole_staticlib(&l.name.as_str(), &search_path); > - } > - > -- cmd.hint_dynamic(); > -+ let fully_static = sess.fully_static(); > -+ if !fully_static { > -+ cmd.hint_dynamic(); > -+ } > - > - for lib in others { > +@@ -983,13 +983,13 @@ > + let relevant_libs = sess.cstore.used_libraries().into_iter().filter(|l| { > + relevant_lib(sess, l) > + }); > + > + let search_path = archive_search_paths(sess); > + for lib in relevant_libs { > match lib.kind { > - NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()), > -+ NativeLibraryKind::NativeUnknown => if fully_static { cmd.link_staticlib(&lib.name.as_str()) } else { cmd.link_dylib(&lib.name.as_str()) }, > ++ NativeLibraryKind::NativeUnknown => if sess.fully_static() { cmd.link_staticlib(&lib.name.as_str()) } else { cmd.link_dylib(&lib.name.as_str()) }, > NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()), > - NativeLibraryKind::NativeStatic => bug!(), > + NativeLibraryKind::NativeStaticNobundle => cmd.link_staticlib(&lib.name.as_str()), > + NativeLibraryKind::NativeStatic => cmd.link_whole_staticlib(&lib.name.as_str(), > + &search_path) > } > --- a/src/librustc_trans/back/linker.rs > +++ b/src/librustc_trans/back/linker.rs > @@ -127,16 +125,18 @@ static linking is requested, instead of dynamically as before. > fn optimize(&mut self); > fn debuginfo(&mut self); > fn no_default_libraries(&mut self); > -@@ -93,6 +93,8 @@ > +@@ -93,8 +93,10 @@ > fn no_whole_archives(&mut self); > fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType); > fn subsystem(&mut self, subsystem: &str); > + // Should have been finalize(self), but we don't support self-by-value on trait objects (yet?). > + fn finalize(&mut self) -> Command; > + fn start_group(&mut self); > + fn end_group(&mut self); > } > > - pub struct GnuLinker<'a> { > -@@ -116,6 +117,9 @@ > + pub struct GccLinker<'a> { > +@@ -116,6 +117,9 @@ > fn output_filename(&mut self, path: &Path) { self.cmd.arg("-o").arg(path); } > fn add_object(&mut self, path: &Path) { self.cmd.arg(path); } > fn position_independent_executable(&mut self) { self.cmd.arg("-pie"); } > @@ -198,3 +198,13 @@ static linking is requested, instead of dynamically as before. > } > } > > +--- a/src/librustc_trans/back/linker.rs > ++++ b/src/librustc_trans/back/linker.rs > +@@ -158,6 +158,7 @@ impl<'a> GccLinker<'a> { > + } > + > + fn hint_dynamic(&mut self) { > ++ if self.sess.fully_static() { return } > + if !self.takes_hints() { return } > + if self.hinted_static { > + self.linker_arg("-Bdynamic"); > diff --git a/community/rust/musl-support-dynamic-linking.patch b/community/rust/musl-support-dynamic-linking.patch > index 7c4e93681b..efbbd7f0b0 100644 > --- a/community/rust/musl-support-dynamic-linking.patch > +++ b/community/rust/musl-support-dynamic-linking.patch > @@ -303,10 +303,12 @@ index defbb44448..f10c7d5c83 100644 > } > > { > -@@ -718,8 +720,10 @@ fn link_natively(sess: &Session, > - objects, out_filename, outputs, trans); > +@@ -718,12 +720,14 @@ fn link_natively(sess: &Session, > + cmd = linker.finalize(); > + } > + if let Some(args) = sess.target.target.options.late_link_args.get(&flavor) { > + cmd.args(args); > } > - cmd.args(&sess.target.target.options.late_link_args); > - for obj in &sess.target.target.options.post_link_objects { > - cmd.arg(root.join(obj)); > + if sess.crt_static() { > @@ -314,7 +316,9 @@ index defbb44448..f10c7d5c83 100644 > + cmd.arg(root.join(obj)); > + } > } > - cmd.args(&sess.target.target.options.post_link_args); > + if let Some(args) = sess.target.target.options.post_link_args.get(&flavor) { > + cmd.args(args); > + } > > diff --git a/src/libstd/build.rs b/src/libstd/build.rs > index 9504194393..dd2008c206 100644 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---