Gentoo Archives: gentoo-commits

From: Aric Belsito <lluixhi@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: dev-lang/rust/, dev-lang/rust/files/1.25.0/
Date: Fri, 11 May 2018 19:47:46
Message-Id: 1526067233.23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe.lluixhi@gentoo
1 commit: 23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Fri May 11 19:33:53 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Fri May 11 19:33:53 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=23a3ae0b
7
8 dev-lang/rust: version bump to 1.25.0
9
10 dev-lang/rust/Manifest | 13 +-
11 ...tic-native-libraries-when-linking-static-.patch | 44 +++
12 ...-nostdlib-and-musl_root-from-musl-targets.patch | 416 +++++++++++++++++++++
13 ...sl-targets-to-link-dynamically-by-default.patch | 25 ++
14 ...-Prefer-libgcc_eh-over-libunwind-for-musl.patch | 24 ++
15 .../rust/files/1.25.0/0005-Fix-LLVM-build.patch | 26 ++
16 .../0006-Fix-rustdoc-for-cross-targets.patch | 36 ++
17 ...dd-openssl-configuration-for-musl-targets.patch | 41 ++
18 .../0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch | 36 ++
19 dev-lang/rust/files/1.25.0/0009-liblibc.patch | 17 +
20 dev-lang/rust/files/1.25.0/0010-llvm.patch | 20 +
21 dev-lang/rust/rust-1.25.0.ebuild | 273 ++++++++++++++
22 12 files changed, 970 insertions(+), 1 deletion(-)
23
24 diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest
25 index 71e99e1..e7153b0 100644
26 --- a/dev-lang/rust/Manifest
27 +++ b/dev-lang/rust/Manifest
28 @@ -14,5 +14,16 @@ DIST rust-1.23.0-i686-unknown-linux-gnu.tar.xz 79540368 BLAKE2B 5df0fb0fa904e7da
29 DIST rust-1.23.0-i686-unknown-linux-musl.tar.xz 77706812 BLAKE2B d30d4359c94ce8c44a2654e9a41a8fcb5d98d330d46e6e0a98500745895f8ded97a8395970c278078b325648d6ee13af7b538a58b41a6d3b027533a40e270767 SHA512 2127391e224c5a286fdadfd46125373b13a406833634c990f94f256fa0dbf6cdf2536b93206332b1ca2c55c893c2cfbc735e96a6c1439fddf8bba87359cab313
30 DIST rust-1.23.0-x86_64-unknown-linux-gnu.tar.xz 82693116 BLAKE2B e327f7b97f7c359f88b4f5a678d8c110c9b50183c96bc8efe767114c83bffcf86a6632d22e9148c48ce97687393f5d5cb5439d66c0ee53853f007b2f730881f0 SHA512 a5a3aa11d04e81305d33ed50fe657dcebb8c3a1f71a0a2b54372439ff6b1b4b7d2abd9c579b27950be67921cbb41586346824faf71495fb4f3f505ed8a48ccc9
31 DIST rust-1.23.0-x86_64-unknown-linux-musl.tar.xz 74604492 BLAKE2B 6ba1c3e850f4dd3202c0a24fdc13ebce588152eaf61054d5a2f0ed8fffc4ef66a7507400dbb5156b3422cd45e6cbe6bf73a2a21e35bf0df93acf1dceed3c04c7 SHA512 3d3e864691c74c94b79e459ec47f3d4e2f7d2bb1cecb20f7469ac09bf8e0385a8803848c66c5834c1e95bf2888bed883deff236da4fa3c6d854099f57d2e3998
32 +DIST rust-1.24.1-aarch64-unknown-linux-gnu.tar.xz 80079312 BLAKE2B a9efc2144db041e19c24e442839e0beba7836be03f38b18725b14c51ff317dc63a6babb06c828b72f9fbe161403fe722d25d7220b63c98fa9bc29f9a94befcc1 SHA512 6f74275cd1d2463c0b7b50a54d1365a0518b7fbf01025a9b799019a296e3b81c0ab3e70468216d6e6f6fa59f6a8b20ceff2532aafa5d63661b662616bfa9c21e
33 +DIST rust-1.24.1-aarch64-unknown-linux-musl.tar.xz 78536928 BLAKE2B ad7a433bfd1b9a06af15227c66af8bc0cdedeae37af17b0f261569a7dd17297dc700c9d9dfb9c5c97d07b8511dde98c50ade374bcc548bdcaff05fb1ac202a6b SHA512 5a39b53e7dbaf20d80f82a28476a0729cffb37e31e849dd5653c571a74a65b8589bcf6bcc40041c140b5ac791bc90496de588aea502a72e4a9250af68b0193ed
34 +DIST rust-1.24.1-arm-unknown-linux-gnueabi.tar.xz 82770752 BLAKE2B dbda5149444e17430b4b929a20335dc5093515eb7699c9c50bc81bc1069cba1639e4a37ebf1001c06cd5415fe86f37a28f78c208783aa7d9c34292ca0aaadfef SHA512 2294b24d4024bd991892e0b59dc3a59fc1b2b14282b0cf3d7a55b91062cad4d4278ce835709da1b5544a2980a35714501fafb7d41f29de252c844e51eda51d98
35 +DIST rust-1.24.1-arm-unknown-linux-musleabi.tar.xz 80504908 BLAKE2B 022e3f5174d3d9564aca2c0573733d39643869cb78df939fa22c519e85cba50da9f293f8523f6313a44f6dc88926e9a0a6c583118b330fa74adcacd9fe79a75f SHA512 8cde83137d605825e8152bafd8c8116344bb8717d62b8eb11144f78ec696b35748b384a49631d433f99157ebe5741371c14f7660f56a7d3640707b47d4578627
36 +DIST rust-1.24.1-armv7-unknown-linux-gnueabihf.tar.xz 83221868 BLAKE2B 79ae6556f99f61a0aa8c5a708ae6212888942786e3c153147af02aa7c6ca5232fcfdaa5c8f53bec0966344cf21a5334b66b9332a7e632b5719eba3a5674a3e2c SHA512 b5ccf9c38e36deb9102859de977c1a5ab4954d001d78753210d0479facf9242a5ea00ed232f8946abb4175166464bd0ccd07d06be5b5ac3c9bf839cd7ece1c1a
37 +DIST rust-1.24.1-armv7-unknown-linux-musleabihf.tar.xz 80029204 BLAKE2B 2c345a33b6c0752d6845d0032b8dc8c745256f61997c389eab2dd618f0cbbcd7b623b20d0e675ff3dd2bca36a0610304714d21b583ec85baa77a3683c0fec4e8 SHA512 7659a53741baa4dad636e632ba81438b03cc21b3f783ccd524d79399541049a4c4f07a00272ef77252bec4622c40a9998859558b3142d69548898071be18f2da
38 +DIST rust-1.24.1-i686-unknown-linux-gnu.tar.xz 86918664 BLAKE2B 49bc796602c0e4d9879ebf3037b13cf3f7757ee2acfc4d83f603f75171d5737b886e48ff35d144d11099858836d34f2b5eebe32a55c463dbfd691c6148e568b6 SHA512 9ca287ec1ce8ec533faec2f0656902ee41fef1fe62c6e52996e1d0d8e5c6df16cae90127971a99f65de12cc0eb8f46615ab87cc55bc7b6ea62be1fbad9dd18ca
39 +DIST rust-1.24.1-i686-unknown-linux-musl.tar.xz 83970072 BLAKE2B 34700ee73d9ad85571fcd561bc3f5c8e41e8791fbbdab3880167ee989b2ee0e7cc61e000c0cea3930e35d6819b1897521f449671e9ae9e1701d6da39dd354214 SHA512 22a5187ba9011dbddf78fdc5056455e7179f3470341d2287cb5795c7cd8d9a90fed856936a6e486af9119b106efe366221d376520cdd7e4e7a3b8d8e6322db74
40 +DIST rust-1.24.1-x86_64-unknown-linux-gnu.tar.xz 90298644 BLAKE2B 15430f87cd6351a9bfc4cba3c43a7e36f31b325983bd04138622f23a4fe67b412f874771fe0703b2d6065fe46af28d6a89fb0387636524c46e0cefa75b78c3dc SHA512 f263e8bee6bff1b3a4c8716248aa78c99f86768f03c7f21fc239203ade6e3b466bfec35e138b021e84b7ae8dffb41c4d045e3c98437f4549d801a2f687c4b92d
41 +DIST rust-1.24.1-x86_64-unknown-linux-musl.tar.xz 81773076 BLAKE2B c6d21d5740ca259c98a1a53a40b86cdca939c5b107ff7174b420dca7a1c90f71219e8b498c1485a3881d88e86caca7d19a81100614bd78ad5790f8d36a5beff4 SHA512 7fc3fd6a5a23b7f43ebc9c90401be3182ff9f68ec4910a71e9b1ee1c198508e759a342f9e42eab3b19dc5465e3158a6a8f7fcc2753cc4c88bdb06ae99d66b638
42 DIST rustc-1.21.0-src.tar.xz 34212448 BLAKE2B 608fa85f4391f3f15db2d1b6f88df8f6811ba460d727c2ed366972f884dd3856711ed50ab0320d939885004d72a8d604be0aa8a65e6d61bd2e1ce33b5aee01be SHA512 63b5c247ef7028c59bb246b96cb9917476d6d13cf68b37956e290248a1e53de3e4dbfad1dcae3c5c2cacc73c9dd212c50e45902c7d913fadeaac81db630bc951
43 -DIST rustc-1.23.0-src.tar.xz 38490016 BLAKE2B 85baeb5535cb95f7d4ceff71580d59d5ce3a5b13adaa067ffbfc7db26e947d1c0b939dad4846c279cc8d174cbf61bd331b9298236ce03630cedffcd6cc8a4e8c SHA512 2e605121dd5152c1a898b263d634b0ac55c7ea79c7fbc9f72c432e68fb397618a267283f3dfb0f77d5e189720d788b1937e8114a1f71bdb10ddd4cbaae92fa80
44 +DIST rustc-1.23.0-src.tar.xz 31993 BLAKE2B a9887ac977c60ad9db4ea387c53df3d4f0392676b705bd5ec3640b1290fd3d0dc481815047de50d009a3acd0af720d0485498f1c6399255eae87f5d26b2f30e5 SHA512 2bd8b9af21ffe61b241d86f8725c657f1c70628755fba6e6c2706a296b6495795a615bcfdcb39a8bf25defc8204cf280cc27031c1b5d86906fd4a58501cc2a70
45 +DIST rustc-1.25.0-src.tar.xz 56108536 BLAKE2B c4a5e56b0e345b5ccde699f68659ac10793670047d2806bdab856d56aa5b960a0df5b947f7c0a7dadfcb7edbe4f9c1a71a94c5f240e91c93296a90d232030645 SHA512 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2
46
47 diff --git a/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch
48 new file mode 100644
49 index 0000000..d307a95
50 --- /dev/null
51 +++ b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch
52 @@ -0,0 +1,44 @@
53 +From 9da9c2f708e0de229a22a2fa8caf34d4c1d6346b Mon Sep 17 00:00:00 2001
54 +From: Samuel Holland <samuel@××××××××.org>
55 +Date: Fri, 8 Sep 2017 00:05:18 -0500
56 +Subject: [PATCH 1/8] Require static native libraries when linking static
57 + executables
58 +
59 +---
60 + src/librustc_trans/back/link.rs | 13 ++++++++++---
61 + 1 file changed, 10 insertions(+), 3 deletions(-)
62 +
63 +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
64 +index 87464ab0d0..395ee2a03b 100644
65 +--- a/src/librustc_trans/back/link.rs
66 ++++ b/src/librustc_trans/back/link.rs
67 +@@ -1329,8 +1329,8 @@ fn add_upstream_rust_crates(cmd: &mut Linker,
68 + }
69 + }
70 +
71 +-// Link in all of our upstream crates' native dependencies. Remember that
72 +-// all of these upstream native dependencies are all non-static
73 ++// Link in all of our upstream crates' native dependencies. Remember that when
74 ++// linking libraries, these upstream native dependencies are all non-static
75 + // dependencies. We've got two cases then:
76 + //
77 + // 1. The upstream crate is an rlib. In this case we *must* link in the
78 +@@ -1370,7 +1370,14 @@ fn add_upstream_native_libraries(cmd: &mut Linker,
79 + continue
80 + }
81 + match lib.kind {
82 +- NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()),
83 ++ NativeLibraryKind::NativeUnknown => {
84 ++ // When creating executables, match library linkage to that of the executable.
85 ++ if crate_type == config::CrateTypeExecutable && sess.crt_static() {
86 ++ cmd.link_staticlib(&lib.name.as_str())
87 ++ } else {
88 ++ cmd.link_dylib(&lib.name.as_str())
89 ++ }
90 ++ },
91 + NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()),
92 + NativeLibraryKind::NativeStaticNobundle => {
93 + // Link "static-nobundle" native libs only if the crate they originate from
94 +--
95 +2.16.1
96 +
97
98 diff --git a/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
99 new file mode 100644
100 index 0000000..6b50eda
101 --- /dev/null
102 +++ b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
103 @@ -0,0 +1,416 @@
104 +From 618ef1bcd4db1c556d482ee3b4292a3746542e57 Mon Sep 17 00:00:00 2001
105 +From: Samuel Holland <samuel@××××××××.org>
106 +Date: Fri, 8 Sep 2017 22:11:14 -0500
107 +Subject: [PATCH 2/8] Remove -nostdlib and musl_root from musl targets
108 +
109 +---
110 + config.toml.example | 6 -----
111 + src/bootstrap/bin/rustc.rs | 10 -------
112 + src/bootstrap/cc_detect.rs | 27 +++----------------
113 + src/bootstrap/compile.rs | 31 ----------------------
114 + src/bootstrap/config.rs | 7 -----
115 + src/bootstrap/configure.py | 20 --------------
116 + src/bootstrap/lib.rs | 8 ------
117 + src/bootstrap/sanity.rs | 30 +--------------------
118 + .../docker/dist-i586-gnu-i586-i686-musl/Dockerfile | 2 --
119 + src/ci/docker/dist-various-1/Dockerfile | 6 -----
120 + src/ci/docker/dist-x86_64-musl/Dockerfile | 1 -
121 + src/librustc_back/target/linux_musl_base.rs | 15 -----------
122 + 12 files changed, 4 insertions(+), 159 deletions(-)
123 +
124 +diff --git a/config.toml.example b/config.toml.example
125 +index f153562a53..db08485322 100644
126 +--- a/config.toml.example
127 ++++ b/config.toml.example
128 +@@ -372,12 +372,6 @@
129 + # only use static libraries. If unset, the target's default linkage is used.
130 + #crt-static = false
131 +
132 +-# The root location of the MUSL installation directory. The library directory
133 +-# will also need to contain libunwind.a for an unwinding implementation. Note
134 +-# that this option only makes sense for MUSL targets that produce statically
135 +-# linked binaries
136 +-#musl-root = "..."
137 +-
138 + # Used in testing for configuring where the QEMU images are located, you
139 + # probably don't want to use this.
140 + #qemu-rootfs = "..."
141 +diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
142 +index 55d104b182..afd28c1b66 100644
143 +--- a/src/bootstrap/bin/rustc.rs
144 ++++ b/src/bootstrap/bin/rustc.rs
145 +@@ -30,7 +30,6 @@
146 + extern crate bootstrap;
147 +
148 + use std::env;
149 +-use std::ffi::OsString;
150 + use std::str::FromStr;
151 + use std::path::PathBuf;
152 + use std::process::{Command, ExitStatus};
153 +@@ -111,15 +110,6 @@ fn main() {
154 + cmd.arg("-Cprefer-dynamic");
155 + }
156 +
157 +- // Help the libc crate compile by assisting it in finding the MUSL
158 +- // native libraries.
159 +- if let Some(s) = env::var_os("MUSL_ROOT") {
160 +- let mut root = OsString::from("native=");
161 +- root.push(&s);
162 +- root.push("/lib");
163 +- cmd.arg("-L").arg(&root);
164 +- }
165 +-
166 + // Override linker if necessary.
167 + if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") {
168 + cmd.arg(format!("-Clinker={}", target_linker));
169 +diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
170 +index e531fdaf29..3f49a2cfec 100644
171 +--- a/src/bootstrap/cc_detect.rs
172 ++++ b/src/bootstrap/cc_detect.rs
173 +@@ -84,7 +84,7 @@ pub fn find(build: &mut Build) {
174 + if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
175 + cfg.compiler(cc);
176 + } else {
177 +- set_compiler(&mut cfg, Language::C, target, config, build);
178 ++ set_compiler(&mut cfg, Language::C, target, config);
179 + }
180 +
181 + let compiler = cfg.get_compiler();
182 +@@ -112,7 +112,7 @@ pub fn find(build: &mut Build) {
183 + if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
184 + cfg.compiler(cxx);
185 + } else {
186 +- set_compiler(&mut cfg, Language::CPlusPlus, host, config, build);
187 ++ set_compiler(&mut cfg, Language::CPlusPlus, host, config);
188 + }
189 + let compiler = cfg.get_compiler();
190 + build.verbose(&format!("CXX_{} = {:?}", host, compiler.path()));
191 +@@ -123,8 +123,7 @@ pub fn find(build: &mut Build) {
192 + fn set_compiler(cfg: &mut cc::Build,
193 + compiler: Language,
194 + target: Interned<String>,
195 +- config: Option<&Target>,
196 +- build: &Build) {
197 ++ config: Option<&Target>) {
198 + match &*target {
199 + // When compiling for android we may have the NDK configured in the
200 + // config.toml in which case we look there. Otherwise the default
201 +@@ -161,26 +160,6 @@ fn set_compiler(cfg: &mut cc::Build,
202 + }
203 + }
204 +
205 +- "mips-unknown-linux-musl" => {
206 +- if cfg.get_compiler().path().to_str() == Some("gcc") {
207 +- cfg.compiler("mips-linux-musl-gcc");
208 +- }
209 +- }
210 +- "mipsel-unknown-linux-musl" => {
211 +- if cfg.get_compiler().path().to_str() == Some("gcc") {
212 +- cfg.compiler("mipsel-linux-musl-gcc");
213 +- }
214 +- }
215 +-
216 +- t if t.contains("musl") => {
217 +- if let Some(root) = build.musl_root(target) {
218 +- let guess = root.join("bin/musl-gcc");
219 +- if guess.exists() {
220 +- cfg.compiler(guess);
221 +- }
222 +- }
223 +- }
224 +-
225 + _ => {}
226 + }
227 + }
228 +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
229 +index c85b04ddc0..c01c2341dd 100644
230 +--- a/src/bootstrap/compile.rs
231 ++++ b/src/bootstrap/compile.rs
232 +@@ -78,13 +78,6 @@ impl Step for Std {
233 + });
234 + println!("Uplifting stage1 std ({} -> {})", from.host, target);
235 +
236 +- // Even if we're not building std this stage, the new sysroot must
237 +- // still contain the musl startup objects.
238 +- if target.contains("musl") {
239 +- let libdir = builder.sysroot_libdir(compiler, target);
240 +- copy_musl_third_party_objects(build, target, &libdir);
241 +- }
242 +-
243 + builder.ensure(StdLink {
244 + compiler: from,
245 + target_compiler: compiler,
246 +@@ -97,11 +90,6 @@ impl Step for Std {
247 + println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
248 + &compiler.host, target);
249 +
250 +- if target.contains("musl") {
251 +- let libdir = builder.sysroot_libdir(compiler, target);
252 +- copy_musl_third_party_objects(build, target, &libdir);
253 +- }
254 +-
255 + let out_dir = build.stage_out(compiler, Mode::Libstd);
256 + build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
257 + let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
258 +@@ -119,20 +107,6 @@ impl Step for Std {
259 + }
260 + }
261 +
262 +-/// Copies the crt(1,i,n).o startup objects
263 +-///
264 +-/// Since musl supports fully static linking, we can cross link for it even
265 +-/// with a glibc-targeting toolchain, given we have the appropriate startup
266 +-/// files. As those shipped with glibc won't work, copy the ones provided by
267 +-/// musl so we have them on linux-gnu hosts.
268 +-fn copy_musl_third_party_objects(build: &Build,
269 +- target: Interned<String>,
270 +- into: &Path) {
271 +- for &obj in &["crt1.o", "crti.o", "crtn.o"] {
272 +- copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
273 +- }
274 +-}
275 +-
276 + /// Configure cargo to compile the standard library, adding appropriate env vars
277 + /// and such.
278 + pub fn std_cargo(build: &Build,
279 +@@ -174,11 +148,6 @@ pub fn std_cargo(build: &Build,
280 + cargo.env("JEMALLOC_OVERRIDE", jemalloc);
281 + }
282 + }
283 +- if target.contains("musl") {
284 +- if let Some(p) = build.musl_root(target) {
285 +- cargo.env("MUSL_ROOT", p);
286 +- }
287 +- }
288 + }
289 +
290 + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
291 +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
292 +index f3810ac869..87f4fb0fae 100644
293 +--- a/src/bootstrap/config.rs
294 ++++ b/src/bootstrap/config.rs
295 +@@ -119,8 +119,6 @@ pub struct Config {
296 + pub test_miri: bool,
297 + pub save_toolstates: Option<PathBuf>,
298 +
299 +- // Fallback musl-root for all targets
300 +- pub musl_root: Option<PathBuf>,
301 + pub prefix: Option<PathBuf>,
302 + pub sysconfdir: Option<PathBuf>,
303 + pub datadir: Option<PathBuf>,
304 +@@ -152,7 +150,6 @@ pub struct Target {
305 + pub linker: Option<PathBuf>,
306 + pub ndk: Option<PathBuf>,
307 + pub crt_static: Option<bool>,
308 +- pub musl_root: Option<PathBuf>,
309 + pub qemu_rootfs: Option<PathBuf>,
310 + }
311 +
312 +@@ -277,7 +274,6 @@ struct Rust {
313 + backtrace: Option<bool>,
314 + default_linker: Option<String>,
315 + channel: Option<String>,
316 +- musl_root: Option<String>,
317 + rpath: Option<bool>,
318 + optimize_tests: Option<bool>,
319 + debuginfo_tests: Option<bool>,
320 +@@ -304,7 +300,6 @@ struct TomlTarget {
321 + linker: Option<String>,
322 + android_ndk: Option<String>,
323 + crt_static: Option<bool>,
324 +- musl_root: Option<String>,
325 + qemu_rootfs: Option<String>,
326 + }
327 +
328 +@@ -479,7 +474,6 @@ impl Config {
329 + set(&mut config.wasm_syscall, rust.wasm_syscall);
330 + config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
331 + config.rustc_default_linker = rust.default_linker.clone();
332 +- config.musl_root = rust.musl_root.clone().map(PathBuf::from);
333 + config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
334 +
335 + if let Some(ref backends) = rust.codegen_backends {
336 +@@ -513,7 +507,6 @@ impl Config {
337 + target.ar = cfg.ar.clone().map(PathBuf::from);
338 + target.linker = cfg.linker.clone().map(PathBuf::from);
339 + target.crt_static = cfg.crt_static.clone();
340 +- target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
341 + target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
342 +
343 + config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
344 +diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
345 +index 99a3ee4e4c..5357d3a3fb 100755
346 +--- a/src/bootstrap/configure.py
347 ++++ b/src/bootstrap/configure.py
348 +@@ -106,26 +106,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
349 + "aarch64-linux-android NDK standalone path")
350 + v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",
351 + "x86_64-linux-android NDK standalone path")
352 +-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root",
353 +- "MUSL root installation directory (deprecated)")
354 +-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root",
355 +- "x86_64-unknown-linux-musl install directory")
356 +-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root",
357 +- "i586-unknown-linux-musl install directory")
358 +-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root",
359 +- "i686-unknown-linux-musl install directory")
360 +-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root",
361 +- "arm-unknown-linux-musleabi install directory")
362 +-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
363 +- "arm-unknown-linux-musleabihf install directory")
364 +-v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
365 +- "armv7-unknown-linux-musleabihf install directory")
366 +-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
367 +- "aarch64-unknown-linux-musl install directory")
368 +-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root",
369 +- "mips-unknown-linux-musl install directory")
370 +-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root",
371 +- "mipsel-unknown-linux-musl install directory")
372 + v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
373 + "rootfs in qemu testing, you probably don't want to use this")
374 + v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
375 +diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
376 +index afd740ce54..428f3ad2ba 100644
377 +--- a/src/bootstrap/lib.rs
378 ++++ b/src/bootstrap/lib.rs
379 +@@ -700,14 +700,6 @@ impl Build {
380 + }
381 + }
382 +
383 +- /// Returns the "musl root" for this `target`, if defined
384 +- fn musl_root(&self, target: Interned<String>) -> Option<&Path> {
385 +- self.config.target_config.get(&target)
386 +- .and_then(|t| t.musl_root.as_ref())
387 +- .or(self.config.musl_root.as_ref())
388 +- .map(|p| &**p)
389 +- }
390 +-
391 + /// Returns whether the target will be tested using the `remote-test-client`
392 + /// and `remote-test-server` binaries.
393 + fn remote_tested(&self, target: Interned<String>) -> bool {
394 +diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
395 +index 5184cca653..defc85e93f 100644
396 +--- a/src/bootstrap/sanity.rs
397 ++++ b/src/bootstrap/sanity.rs
398 +@@ -21,7 +21,7 @@
399 + use std::collections::HashMap;
400 + use std::env;
401 + use std::ffi::{OsString, OsStr};
402 +-use std::fs::{self, File};
403 ++use std::fs::File;
404 + use std::io::Read;
405 + use std::path::PathBuf;
406 + use std::process::Command;
407 +@@ -169,34 +169,6 @@ pub fn check(build: &mut Build) {
408 + panic!("the iOS target is only supported on macOS");
409 + }
410 +
411 +- // Make sure musl-root is valid
412 +- if target.contains("musl") {
413 +- // If this is a native target (host is also musl) and no musl-root is given,
414 +- // fall back to the system toolchain in /usr before giving up
415 +- if build.musl_root(*target).is_none() && build.config.build == *target {
416 +- let target = build.config.target_config.entry(target.clone())
417 +- .or_insert(Default::default());
418 +- target.musl_root = Some("/usr".into());
419 +- }
420 +- match build.musl_root(*target) {
421 +- Some(root) => {
422 +- if fs::metadata(root.join("lib/libc.a")).is_err() {
423 +- panic!("couldn't find libc.a in musl dir: {}",
424 +- root.join("lib").display());
425 +- }
426 +- if fs::metadata(root.join("lib/libunwind.a")).is_err() {
427 +- panic!("couldn't find libunwind.a in musl dir: {}",
428 +- root.join("lib").display());
429 +- }
430 +- }
431 +- None => {
432 +- panic!("when targeting MUSL either the rust.musl-root \
433 +- option or the target.$TARGET.musl-root option must \
434 +- be specified in config.toml")
435 +- }
436 +- }
437 +- }
438 +-
439 + if target.contains("msvc") {
440 + // There are three builds of cmake on windows: MSVC, MinGW, and
441 + // Cygwin. The Cygwin build does not have generators for Visual
442 +diff --git a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
443 +index 035846b4f6..5eab5933c5 100644
444 +--- a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
445 ++++ b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
446 +@@ -31,8 +31,6 @@ RUN sh /scripts/sccache.sh
447 +
448 + ENV RUST_CONFIGURE_ARGS \
449 + --target=i686-unknown-linux-musl,i586-unknown-linux-gnu \
450 +- --musl-root-i586=/musl-i586 \
451 +- --musl-root-i686=/musl-i686 \
452 + --enable-extended
453 +
454 + # Newer binutils broke things on some vms/distros (i.e., linking against
455 +diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile
456 +index c83f101d0a..0b9ec9de86 100644
457 +--- a/src/ci/docker/dist-various-1/Dockerfile
458 ++++ b/src/ci/docker/dist-various-1/Dockerfile
459 +@@ -90,12 +90,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
460 +
461 + ENV RUST_CONFIGURE_ARGS \
462 + --target=$TARGETS \
463 +- --musl-root-arm=/musl-arm \
464 +- --musl-root-armhf=/musl-armhf \
465 +- --musl-root-armv7=/musl-armv7 \
466 +- --musl-root-aarch64=/musl-aarch64 \
467 +- --musl-root-mips=/musl-mips \
468 +- --musl-root-mipsel=/musl-mipsel \
469 + --enable-emscripten
470 +
471 + ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
472 +diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile
473 +index c1061309c3..2fb9481479 100644
474 +--- a/src/ci/docker/dist-x86_64-musl/Dockerfile
475 ++++ b/src/ci/docker/dist-x86_64-musl/Dockerfile
476 +@@ -31,7 +31,6 @@ RUN sh /scripts/sccache.sh
477 +
478 + ENV RUST_CONFIGURE_ARGS \
479 + --target=x86_64-unknown-linux-musl \
480 +- --musl-root-x86_64=/musl-x86_64 \
481 + --enable-extended
482 +
483 + # Newer binutils broke things on some vms/distros (i.e., linking against
484 +diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs
485 +index 6e5e139715..d99cb55cc5 100644
486 +--- a/src/librustc_back/target/linux_musl_base.rs
487 ++++ b/src/librustc_back/target/linux_musl_base.rs
488 +@@ -14,10 +14,6 @@ use target::TargetOptions;
489 + pub fn opts() -> TargetOptions {
490 + let mut base = super::linux_base::opts();
491 +
492 +- // Make sure that the linker/gcc really don't pull in anything, including
493 +- // default objects, libs, etc.
494 +- base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string());
495 +-
496 + // At least when this was tested, the linker would not add the
497 + // `GNU_EH_FRAME` program header to executables generated, which is required
498 + // when unwinding to locate the unwinding information. I'm not sure why this
499 +@@ -49,17 +45,6 @@ pub fn opts() -> TargetOptions {
500 + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string());
501 + base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]);
502 +
503 +- // When generating a statically linked executable there's generally some
504 +- // small setup needed which is listed in these files. These are provided by
505 +- // a musl toolchain and are linked by default by the `musl-gcc` script. Note
506 +- // that `gcc` also does this by default, it just uses some different files.
507 +- //
508 +- // Each target directory for musl has these object files included in it so
509 +- // they'll be included from there.
510 +- base.pre_link_objects_exe.push("crt1.o".to_string());
511 +- base.pre_link_objects_exe.push("crti.o".to_string());
512 +- base.post_link_objects.push("crtn.o".to_string());
513 +-
514 + // These targets statically link libc by default
515 + base.crt_static_default = true;
516 + // These targets allow the user to choose between static and dynamic linking.
517 +--
518 +2.16.1
519 +
520
521 diff --git a/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch
522 new file mode 100644
523 index 0000000..26ecebf
524 --- /dev/null
525 +++ b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch
526 @@ -0,0 +1,25 @@
527 +From b02bdc170e02f3ee226728ddd912b5d4171677d2 Mon Sep 17 00:00:00 2001
528 +From: Samuel Holland <samuel@××××××××.org>
529 +Date: Thu, 30 Nov 2017 08:15:51 -0600
530 +Subject: [PATCH 3/8] Switch musl targets to link dynamically by default
531 +
532 +---
533 + src/librustc_back/target/linux_musl_base.rs | 2 --
534 + 1 file changed, 2 deletions(-)
535 +
536 +diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs
537 +index d99cb55cc5..bb786bf0f3 100644
538 +--- a/src/librustc_back/target/linux_musl_base.rs
539 ++++ b/src/librustc_back/target/linux_musl_base.rs
540 +@@ -45,8 +45,6 @@ pub fn opts() -> TargetOptions {
541 + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string());
542 + base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]);
543 +
544 +- // These targets statically link libc by default
545 +- base.crt_static_default = true;
546 + // These targets allow the user to choose between static and dynamic linking.
547 + base.crt_static_respected = true;
548 +
549 +--
550 +2.16.1
551 +
552
553 diff --git a/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch
554 new file mode 100644
555 index 0000000..7e992b5
556 --- /dev/null
557 +++ b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch
558 @@ -0,0 +1,24 @@
559 +From a508441f79b41f3de9bc5fd03bcc7c1fce205efb Mon Sep 17 00:00:00 2001
560 +From: Samuel Holland <samuel@××××××××.org>
561 +Date: Sat, 9 Sep 2017 00:14:16 -0500
562 +Subject: [PATCH 4/8] Prefer libgcc_eh over libunwind for musl
563 +
564 +---
565 + src/libunwind/lib.rs | 2 +-
566 + 1 file changed, 1 insertion(+), 1 deletion(-)
567 +
568 +diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
569 +index 5347c78121..e9be63f282 100644
570 +--- a/src/libunwind/lib.rs
571 ++++ b/src/libunwind/lib.rs
572 +@@ -36,6 +36,6 @@ cfg_if! {
573 + }
574 +
575 + #[cfg(target_env = "musl")]
576 +-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
577 ++#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
578 + #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
579 + extern {}
580 +--
581 +2.16.1
582 +
583
584 diff --git a/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch
585 new file mode 100644
586 index 0000000..ddef113
587 --- /dev/null
588 +++ b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch
589 @@ -0,0 +1,26 @@
590 +From 2dca67022c550b8ea69623fcaa04bee10112ea77 Mon Sep 17 00:00:00 2001
591 +From: Samuel Holland <samuel@××××××××.org>
592 +Date: Fri, 8 Sep 2017 00:04:29 -0500
593 +Subject: [PATCH 5/8] Fix LLVM build
594 +
595 +---
596 + src/bootstrap/lib.rs | 3 ++-
597 + 1 file changed, 2 insertions(+), 1 deletion(-)
598 +
599 +diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
600 +index 428f3ad2ba..a3aaa3c57f 100644
601 +--- a/src/bootstrap/lib.rs
602 ++++ b/src/bootstrap/lib.rs
603 +@@ -642,7 +642,8 @@ impl Build {
604 + // cc-rs because the build scripts will determine that for themselves.
605 + let mut base = self.cc[&target].args().iter()
606 + .map(|s| s.to_string_lossy().into_owned())
607 +- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
608 ++ .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")
609 ++ && !s.starts_with("-static"))
610 + .collect::<Vec<_>>();
611 +
612 + // If we're compiling on macOS then we add a few unconditional flags
613 +--
614 +2.16.1
615 +
616
617 diff --git a/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch
618 new file mode 100644
619 index 0000000..af86047
620 --- /dev/null
621 +++ b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch
622 @@ -0,0 +1,36 @@
623 +From 7fceddea2b70f3d0e898c8be820cd2d7fb4dfc32 Mon Sep 17 00:00:00 2001
624 +From: Samuel Holland <samuel@××××××××.org>
625 +Date: Sat, 2 Dec 2017 17:25:44 -0600
626 +Subject: [PATCH 6/8] Fix rustdoc for cross targets
627 +
628 +musl can't handle wrong-architecture libraries in LD_LIBRARY_PATH.
629 +---
630 + src/bootstrap/bin/rustdoc.rs | 5 +----
631 + 1 file changed, 1 insertion(+), 4 deletions(-)
632 +
633 +diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
634 +index 389b504c64..b7b77eb431 100644
635 +--- a/src/bootstrap/bin/rustdoc.rs
636 ++++ b/src/bootstrap/bin/rustdoc.rs
637 +@@ -34,9 +34,6 @@ fn main() {
638 + Err(_) => 0,
639 + };
640 +
641 +- let mut dylib_path = bootstrap::util::dylib_path();
642 +- dylib_path.insert(0, PathBuf::from(libdir));
643 +-
644 + let mut cmd = Command::new(rustdoc);
645 + cmd.args(&args)
646 + .arg("--cfg")
647 +@@ -46,7 +43,7 @@ fn main() {
648 + .arg("--sysroot")
649 + .arg(sysroot)
650 + .env(bootstrap::util::dylib_path_var(),
651 +- env::join_paths(&dylib_path).unwrap());
652 ++ PathBuf::from(libdir));
653 +
654 + // Force all crates compiled by this compiler to (a) be unstable and (b)
655 + // allow the `rustc_private` feature to link to other unstable crates
656 +--
657 +2.16.1
658 +
659
660 diff --git a/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch
661 new file mode 100644
662 index 0000000..8ee65a9
663 --- /dev/null
664 +++ b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch
665 @@ -0,0 +1,41 @@
666 +From 1e9d653ccb0da803b1f30ded65c2dd727c89100c Mon Sep 17 00:00:00 2001
667 +From: Samuel Holland <samuel@××××××××.org>
668 +Date: Mon, 11 Sep 2017 11:21:56 -0500
669 +Subject: [PATCH 7/8] Add openssl configuration for musl targets
670 +
671 +---
672 + src/bootstrap/native.rs | 7 ++++++-
673 + 1 file changed, 6 insertions(+), 1 deletion(-)
674 +
675 +diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
676 +index 3c91cf3ecc..198ac36789 100644
677 +--- a/src/bootstrap/native.rs
678 ++++ b/src/bootstrap/native.rs
679 +@@ -457,8 +457,11 @@ impl Step for Openssl {
680 + "arm-linux-androideabi" => "android",
681 + "arm-unknown-linux-gnueabi" => "linux-armv4",
682 + "arm-unknown-linux-gnueabihf" => "linux-armv4",
683 +- "armv7-linux-androideabi" => "android-armv7",
684 ++ "arm-unknown-linux-musleabi" => "linux-armv4",
685 ++ "arm-unknown-linux-musleabihf" => "linux-armv4",
686 ++ "armv7-linux-androideabi" => "android-armv4",
687 + "armv7-unknown-linux-gnueabihf" => "linux-armv4",
688 ++ "armv7-unknown-linux-musleabihf" => "linux-armv4",
689 + "i586-unknown-linux-gnu" => "linux-elf",
690 + "i586-unknown-linux-musl" => "linux-elf",
691 + "i686-apple-darwin" => "darwin-i386-cc",
692 +@@ -468,9 +471,11 @@ impl Step for Openssl {
693 + "i686-unknown-linux-musl" => "linux-elf",
694 + "i686-unknown-netbsd" => "BSD-x86-elf",
695 + "mips-unknown-linux-gnu" => "linux-mips32",
696 ++ "mips-unknown-linux-musl" => "linux-mips32",
697 + "mips64-unknown-linux-gnuabi64" => "linux64-mips64",
698 + "mips64el-unknown-linux-gnuabi64" => "linux64-mips64",
699 + "mipsel-unknown-linux-gnu" => "linux-mips32",
700 ++ "mipsel-unknown-linux-musl" => "linux-mips32",
701 + "powerpc-unknown-linux-gnu" => "linux-ppc",
702 + "powerpc64-unknown-linux-gnu" => "linux-ppc64",
703 + "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
704 +--
705 +2.16.1
706 +
707
708 diff --git a/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
709 new file mode 100644
710 index 0000000..5a69455
711 --- /dev/null
712 +++ b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
713 @@ -0,0 +1,36 @@
714 +From d1cc6048465f4cc7a06495b424693aa0c27f3137 Mon Sep 17 00:00:00 2001
715 +From: Samuel Holland <samuel@××××××××.org>
716 +Date: Wed, 10 Jan 2018 13:36:41 -0600
717 +Subject: [PATCH 8/8] Don't pass CFLAGS to the C++ compiler
718 +
719 +---
720 + src/bootstrap/builder.rs | 6 ++----
721 + 1 file changed, 2 insertions(+), 4 deletions(-)
722 +
723 +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
724 +index fcb78c479f..55848d6971 100644
725 +--- a/src/bootstrap/builder.rs
726 ++++ b/src/bootstrap/builder.rs
727 +@@ -689,7 +689,7 @@ impl<'a> Builder<'a> {
728 +
729 + let cflags = self.cflags(target).join(" ");
730 + cargo.env(format!("CFLAGS_{}", target), cflags.clone())
731 +- .env("CFLAGS", cflags.clone());
732 ++ .env("CFLAGS", cflags);
733 +
734 + if let Some(ar) = self.ar(target) {
735 + let ranlib = format!("{} s", ar.display());
736 +@@ -701,9 +701,7 @@ impl<'a> Builder<'a> {
737 +
738 + if let Ok(cxx) = self.cxx(target) {
739 + cargo.env(format!("CXX_{}", target), cxx)
740 +- .env("CXX", cxx)
741 +- .env(format!("CXXFLAGS_{}", target), cflags.clone())
742 +- .env("CXXFLAGS", cflags);
743 ++ .env("CXX", cxx);
744 + }
745 + }
746 +
747 +--
748 +2.16.1
749 +
750
751 diff --git a/dev-lang/rust/files/1.25.0/0009-liblibc.patch b/dev-lang/rust/files/1.25.0/0009-liblibc.patch
752 new file mode 100644
753 index 0000000..f7867ac
754 --- /dev/null
755 +++ b/dev-lang/rust/files/1.25.0/0009-liblibc.patch
756 @@ -0,0 +1,17 @@
757 +diff --git a/src/liblibc/src/unix/mod.rs b/src/liblibc/src/unix/mod.rs
758 +index 134f44c5a..7e5c9b6c5 100644
759 +--- a/src/liblibc/src/unix/mod.rs
760 ++++ b/src/liblibc/src/unix/mod.rs
761 +@@ -277,11 +277,7 @@ cfg_if! {
762 + // cargo build, don't pull in anything extra as the libstd dep
763 + // already pulls in all libs.
764 + } else if #[cfg(target_env = "musl")] {
765 +- #[cfg_attr(feature = "stdbuild",
766 +- link(name = "c", kind = "static",
767 +- cfg(target_feature = "crt-static")))]
768 +- #[cfg_attr(feature = "stdbuild",
769 +- link(name = "c", cfg(not(target_feature = "crt-static"))))]
770 ++ #[link(name = "c")]
771 + extern {}
772 + } else if #[cfg(target_os = "emscripten")] {
773 + #[link(name = "c")]
774
775 diff --git a/dev-lang/rust/files/1.25.0/0010-llvm.patch b/dev-lang/rust/files/1.25.0/0010-llvm.patch
776 new file mode 100644
777 index 0000000..3f9f409
778 --- /dev/null
779 +++ b/dev-lang/rust/files/1.25.0/0010-llvm.patch
780 @@ -0,0 +1,20 @@
781 +diff --git a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
782 +index 579d23004d1..6cd9d2722fb 100644
783 +--- a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
784 ++++ b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
785 +@@ -27,6 +27,15 @@
786 + #define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr,
787 + #endif
788 +
789 ++// avoid name conflicts with musl-libc
790 ++#undef fopen64
791 ++#undef fseeko64
792 ++#undef ftello64
793 ++#undef fstat64
794 ++#undef lstat64
795 ++#undef stat64
796 ++#undef tmpfile64
797 ++
798 + /// void *new(unsigned int);
799 + TLI_DEFINE_ENUM_INTERNAL(msvc_new_int)
800 + TLI_DEFINE_STRING_INTERNAL("??2@YAPAXI@Z")
801
802 diff --git a/dev-lang/rust/rust-1.25.0.ebuild b/dev-lang/rust/rust-1.25.0.ebuild
803 new file mode 100644
804 index 0000000..2f0b32a
805 --- /dev/null
806 +++ b/dev-lang/rust/rust-1.25.0.ebuild
807 @@ -0,0 +1,273 @@
808 +# Copyright 1999-2018 Gentoo Foundation
809 +# Distributed under the terms of the GNU General Public License v2
810 +
811 +EAPI=6
812 +
813 +LLVM_MAX_SLOT=6
814 +PYTHON_COMPAT=( python2_7 )
815 +
816 +inherit llvm multiprocessing python-any-r1 versionator toolchain-funcs
817 +
818 +if [[ ${PV} = *beta* ]]; then
819 + betaver=${PV//*beta}
820 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
821 + MY_P="rustc-beta"
822 + SLOT="beta/${PV}"
823 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
824 + KEYWORDS=""
825 +else
826 + ABI_VER="$(get_version_component_range 1-2)"
827 + SLOT="stable/${ABI_VER}"
828 + MY_P="rustc-${PV}"
829 + SRC="${MY_P}-src.tar.xz"
830 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
831 +fi
832 +
833 +case "${CHOST}" in
834 + armv7*)
835 + RUSTARCH=armv7 ;;
836 + arm*)
837 + RUSTARCH=arm ;;
838 + *)
839 + RUSTARCH=${CHOST%%-*} ;;
840 +esac
841 +case "${CHOST}" in
842 + armv7a-hardfloat-*)
843 + RUSTLIBC=${ELIBC/glibc/gnu}eabihf ;;
844 + arm*)
845 + RUSTLIBC=${CHOST##*-} ;;
846 + *)
847 + RUSTLIBC=${ELIBC/glibc/gnu} ;;
848 +esac
849 +RUSTHOST=${RUSTARCH}-unknown-${KERNEL}-${RUSTLIBC}
850 +
851 +RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).1"
852 +
853 +CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"
854 +
855 +DESCRIPTION="Systems programming language from Mozilla"
856 +HOMEPAGE="http://www.rust-lang.org/"
857 +
858 +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
859 + amd64? (
860 + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-gnu.tar.xz )
861 + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-musl.tar.xz )
862 + )
863 + arm? (
864 + elibc_glibc? (
865 + https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-gnueabi.tar.xz
866 + https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-gnueabihf.tar.xz
867 + )
868 + elibc_musl? (
869 + https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-musleabi.tar.xz
870 + https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-musleabihf.tar.xz
871 + )
872 + )
873 + arm64? (
874 + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-gnu.tar.xz )
875 + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-musl.tar.xz )
876 + )
877 + x86? (
878 + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-gnu.tar.xz )
879 + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-musl.tar.xz )
880 + )
881 +"
882 +
883 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
884 +
885 +IUSE="debug doc extended jemalloc libressl system-llvm"
886 +
887 +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
888 + jemalloc? ( dev-libs/jemalloc )
889 + system-llvm? ( sys-devel/llvm )
890 + extended? (
891 + libressl? (
892 + >=dev-libs/libressl-2.5.0:=
893 + <dev-libs/libressl-2.7.0:=
894 + )
895 + !libressl? ( dev-libs/openssl:0= )
896 + net-libs/http-parser:0/2.6.2
897 + net-libs/libssh2:=
898 + net-misc/curl:=[ssl]
899 + sys-libs/zlib:=
900 + !dev-util/rustfmt
901 + !dev-util/cargo
902 + )
903 +"
904 +DEPEND="${RDEPEND}
905 + ${PYTHON_DEPS}
906 + || (
907 + >=sys-devel/gcc-4.7
908 + >=sys-devel/clang-3.5
909 + )
910 + !system-llvm? (
911 + dev-util/cmake
912 + dev-util/ninja
913 + )
914 +"
915 +PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )"
916 +
917 +PATCHES=(
918 + "${FILESDIR}/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch"
919 + "${FILESDIR}/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch"
920 + "${FILESDIR}/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch"
921 + "${FILESDIR}/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch"
922 + "${FILESDIR}/1.25.0/0005-Fix-LLVM-build.patch"
923 + "${FILESDIR}/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch"
924 + "${FILESDIR}/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch"
925 + "${FILESDIR}/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch"
926 + "${FILESDIR}/1.25.0/0009-liblibc.patch"
927 + "${FILESDIR}/1.25.0/0010-llvm.patch"
928 +)
929 +
930 +S="${WORKDIR}/${MY_P}-src"
931 +
932 +toml_usex() {
933 + usex "$1" true false
934 +}
935 +
936 +pkg_setup() {
937 + export RUST_BACKTRACE=1
938 + if use system-llvm; then
939 + llvm_pkg_setup
940 + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
941 +
942 + export LLVM_LINK_SHARED=1
943 + export RUSTFLAGS="$RUSTFLAGS -Lnative=$("$llvm_config" --libdir)"
944 + fi
945 +
946 + python-any-r1_pkg_setup
947 +}
948 +
949 +src_prepare() {
950 + default
951 +
952 + "${WORKDIR}/rust-${RUST_STAGE0_VERSION}-${RUSTHOST}/install.sh" \
953 + --prefix="${WORKDIR}/stage0" \
954 + --components=rust-std-${RUSTHOST},rustc,cargo \
955 + --disable-ldconfig \
956 + || die
957 +}
958 +
959 +src_configure() {
960 + cat <<- EOF > "${S}"/config.toml
961 + [llvm]
962 + ninja = true
963 + optimize = $(toml_usex !debug)
964 + release-debuginfo = $(toml_usex debug)
965 + assertions = $(toml_usex debug)
966 + [build]
967 + build = "${RUSTHOST}"
968 + host = ["${RUSTHOST}"]
969 + target = ["${RUSTHOST}"]
970 + cargo = "${WORKDIR}/stage0/bin/cargo"
971 + rustc = "${WORKDIR}/stage0/bin/rustc"
972 + docs = $(toml_usex doc)
973 + compiler-docs = $(toml_usex doc)
974 + submodules = false
975 + python = "${EPYTHON}"
976 + locked-deps = true
977 + vendor = true
978 + verbose = 2
979 + extended = $(toml_usex extended)
980 + [install]
981 + prefix = "${EPREFIX}/usr"
982 + libdir = "$(get_libdir)"
983 + docdir = "share/doc/${P}"
984 + mandir = "share/${P}/man"
985 + [rust]
986 + optimize = $(toml_usex !debug)
987 + debuginfo = $(toml_usex debug)
988 + debug-assertions = $(toml_usex debug)
989 + use-jemalloc = $(toml_usex jemalloc)
990 + default-linker = "$(tc-getCC)"
991 + channel = "${SLOT%%/*}"
992 + rpath = false
993 + optimize-tests = $(toml_usex !debug)
994 + dist-src = false
995 + [dist]
996 + src-tarball = false
997 + [target.${RUSTHOST}]
998 + cc = "$(tc-getBUILD_CC)"
999 + cxx = "$(tc-getBUILD_CXX)"
1000 + linker = "$(tc-getCC)"
1001 + ar = "$(tc-getAR)"
1002 + EOF
1003 + use system-llvm && cat <<- EOF >> "${S}"/config.toml
1004 + llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
1005 + EOF
1006 +}
1007 +
1008 +src_compile() {
1009 + ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die
1010 +}
1011 +
1012 +src_install() {
1013 + env DESTDIR="${D}" ./x.py install -j$(makeopts_jobs) || die
1014 +
1015 + rm "${D}/usr/$(get_libdir)/rustlib/components" || die
1016 + rm "${D}/usr/$(get_libdir)/rustlib/install.log" || die
1017 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-std-${RUSTHOST}" || die
1018 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustc" || die
1019 + rm "${D}/usr/$(get_libdir)/rustlib/rust-installer-version" || die
1020 + rm "${D}/usr/$(get_libdir)/rustlib/uninstall.sh" || die
1021 +
1022 + mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die
1023 + mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die
1024 + mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die
1025 + mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die
1026 +
1027 + if use doc; then
1028 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-docs" || die
1029 + fi
1030 +
1031 + if use extended; then
1032 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-cargo" || die
1033 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rls-preview" || die
1034 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-analysis-${RUSTHOST}" || die
1035 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-src" || die
1036 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustfmt-preview" || die
1037 + fi
1038 +
1039 + rm "${D}/usr/share/doc/${P}/LICENSE-APACHE" || die
1040 + rm "${D}/usr/share/doc/${P}/LICENSE-MIT" || die
1041 +
1042 + docompress "/usr/share/${P}/man"
1043 +
1044 + cat <<-EOF > "${T}"/50${P}
1045 + MANPATH="/usr/share/${P}/man"
1046 + EOF
1047 + doenvd "${T}"/50${P}
1048 +
1049 + cat <<-EOF > "${T}/provider-${P}"
1050 + /usr/bin/rustdoc
1051 + /usr/bin/rust-gdb
1052 + /usr/bin/rust-lldb
1053 + EOF
1054 + dodir /etc/env.d/rust
1055 + insinto /etc/env.d/rust
1056 + doins "${T}/provider-${P}"
1057 +}
1058 +
1059 +pkg_postinst() {
1060 + eselect rust update --if-unset
1061 +
1062 + elog "Rust installs a helper script for calling GDB and LLDB,"
1063 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
1064 +
1065 + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
1066 + elog "install app-emacs/rust-mode to get emacs support for rust."
1067 + fi
1068 +
1069 + if has_version app-editors/gvim || has_version app-editors/vim; then
1070 + elog "install app-vim/rust-vim to get vim support for rust."
1071 + fi
1072 +
1073 + if has_version 'app-shells/zsh'; then
1074 + elog "install app-shells/rust-zshcomp to get zsh completion for rust."
1075 + fi
1076 +}
1077 +
1078 +pkg_postrm() {
1079 + eselect rust unset --if-invalid
1080 +}