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