1 |
commit: 6f11b191798b06fdb8f13c7f2f3d38416db15a96 |
2 |
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Jun 27 17:22:21 2018 +0000 |
4 |
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Jun 27 17:22:21 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=6f11b191 |
7 |
|
8 |
dev-lang/rust: version bump to 1.27.0 |
9 |
|
10 |
dev-lang/rust/Manifest | 13 +- |
11 |
...-nostdlib-and-musl_root-from-musl-targets.patch | 384 +++++++++++++++++++++ |
12 |
...sl-targets-to-link-dynamically-by-default.patch | 12 + |
13 |
.../rust/files/rust-1.27.0-libressl-2.7.0.patch | 24 ++ |
14 |
dev-lang/rust/rust-1.27.0.ebuild | 355 +++++++++++++++++++ |
15 |
5 files changed, 787 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest |
18 |
index 7815bff..1d79155 100644 |
19 |
--- a/dev-lang/rust/Manifest |
20 |
+++ b/dev-lang/rust/Manifest |
21 |
@@ -8,5 +8,16 @@ DIST rust-1.25.0-i686-unknown-linux-gnu.tar.xz 102453124 BLAKE2B 8986ebab6a7a9d0 |
22 |
DIST rust-1.25.0-i686-unknown-linux-musl.tar.xz 100253196 BLAKE2B 2bc6d9d2a1dfabd8d88733921c3f1a5558174e8e915bc6f2a38f71097603796480d88bfb40c4ebcc2a877290906079099a1f7c965931a5378fffde556193905f SHA512 93eb29d86e209e0bc2aa92f3e534393ad37658a6b4f91ae3da7f3aaf05e82a5c04376f2e6d24410f0a1647ba3d7c6945254c74704084d53bf6be806a064754c1 |
23 |
DIST rust-1.25.0-x86_64-unknown-linux-gnu.tar.xz 111059260 BLAKE2B ae982976a735c2b5226722207a983bb638cb7c0cb0ceb6b438456d54fac86a5d1892b535f01ac463157205c0ae27ae876482f6ac1fa269a9ec3e1177be0cef2e SHA512 aea93ff64f620a1dd6b48d07ec3dcbc126b2f5c17b4697c096ec8cd02a3c7dfec7ae7d5df70a55eceb372897ad12f3d01c67d5aaea0167a80270931c61323f78 |
24 |
DIST rust-1.25.0-x86_64-unknown-linux-musl.tar.xz 97724224 BLAKE2B ad0accfb670acf2a02f9bb1c8e6a80ab7be2d1e0f01bc2da13744ab164774cc318255d78a657b84ad0f97ab1ee3fc4a53b4cf1ee71ba52984cbcd52bd64f2387 SHA512 ee250193db5e20edb80fe864609b1c16ca5da5f2ca16700f5f938195d43dd5d3de8cd138f64feebd73f77fbf4f61196459c13420ba6c4f451b9db266db92219a |
25 |
+DIST rust-1.26.2-aarch64-unknown-linux-gnu.tar.xz 90964988 BLAKE2B 7e5de737ff2b4711e0a5b3085f10c3f2918fc5823dcb52bc5f897a5617b65d648d5e59664dbfaa904ff08923d1bbd11aae21349760fefef6ff18ea0e45391e07 SHA512 b565ec988d3b946dabc8902eba60b446070e77b7c27aa98d981b7ba5e9285bda95565627600e6be057970de5006d9640ef77fa920849160f5cf98508b48d1673 |
26 |
+DIST rust-1.26.2-aarch64-unknown-linux-musl.tar.xz 96634640 BLAKE2B fe74fec5c20d7d74e261b30cc3e3eb375da35332ab54e528eca78270608c6830fc4ed15bfa0f8126fc4e77f8476ab9c008565191667ba278713194e38c2d7b59 SHA512 2643021d99bafc3da58bab7a40aeb9c0127b099b26b59c4ebb073d7f807262e65ec8b12618fb8fe5d75fa8809319c3b08518371c04f406cb7fcdbf795b3bdb35 |
27 |
+DIST rust-1.26.2-arm-unknown-linux-gnueabi.tar.xz 98267104 BLAKE2B ae44fcead124e5e3993240be0c8a46e545df5d045d39184cfada86d9a820fa30a771396a2ced86c2454aef224951e85cf0b6965c13ed98a3024e07d4ca1ec6a9 SHA512 a96295ef2d0eca5a682e3b3bcfe3b3ffeb5bbe45bc949f467cfd1e7ac7252d74e86d2d8f25e5722e75e7f537afeb3b0ae9054bd3908916ea461623f8c13ba5bf |
28 |
+DIST rust-1.26.2-arm-unknown-linux-musleabi.tar.xz 97679732 BLAKE2B e5bdd376c1a5a1d8ebf3e8cacd80f0a8165e24ed8c7ed3755cf2ca7f3688f3f278534021e8d1487875cab657ad9391023577692afaff45f001e52d76d9417058 SHA512 a1e20e2a93b40ec8bc8a90d9e5b57801e7fa79649b45ae6ca1133ec24779edc00ff73b5f8a1836856b2cdd78b643390518d58694e5661834b6091a5d6e924660 |
29 |
+DIST rust-1.26.2-armv7-unknown-linux-gnueabihf.tar.xz 98828932 BLAKE2B 2f60e65128bd32d97422d82d99f5c5447d1c1e77582028089d52208e3ede4af5e72c278a3fb5001348c864087f3e85af05604a0b6078891c5ed812d745840d93 SHA512 7b8e3f39a62b7b5fdaa6d53e5638de26968799d97b5d53e09bf49456b02f968495cff4757f25d38bc3393ca33dc1b9da353ec290ba9416770e082548aa5079ac |
30 |
+DIST rust-1.26.2-armv7-unknown-linux-musleabihf.tar.xz 97326548 BLAKE2B c955fe3fd4dbdc12c6c8101538a930169dc62e7461964b8f900e8afd3973fea783116ed25aff5db15eded8173377db412c67232b12e0cba6a3278793f08de2ae SHA512 ed1d9828d2f12e782fd73865a0403c7b26c11cab665c635308e8e1cd23e6101402b448f0334f33b33193162bb9e6b30eba8a541b3d128925407f17b9d8f4f9f3 |
31 |
+DIST rust-1.26.2-i686-unknown-linux-gnu.tar.xz 143090096 BLAKE2B 7871fa4e4d0f320ff949cd31cefa116bc7b741927626958e1d10197f05fc9a662b8d6c21ddd4d2910700e6f7273e4fc18738e6ff58cd85b9af4ed25eceea31d9 SHA512 859b5b72c78cca8cd473012599ca12539ef9a5ee38d1aaaad024019fd84220e344e1cd0efd2b027ef333555b158b23529f35ceb5d59d76c35e7946b5fe4a8a52 |
32 |
+DIST rust-1.26.2-i686-unknown-linux-musl.tar.xz 103964468 BLAKE2B f1bcc5be07239917517302389c91ca68427f4f50f98ca38832606377b011f4c7d50159b0481fe9075b497d1493b4d40445d8026e115fbae1c970f459d6e8a63a SHA512 528a761a22ee22007de4511a46d97db3cab625622d4f94de5305fbbefb6a5f7582826aae3bcb459f91a3f57d535153b8cb35b692806060ced92655cdf9c81e2a |
33 |
+DIST rust-1.26.2-x86_64-unknown-linux-gnu.tar.xz 138609432 BLAKE2B 54507a8ce3ab2676e6e66852b6d3f1a47ca07ad4b56383f6247149309a0f60f67fbf0a6ba27d968c24340c07d7d5074942c6eaccbc1207c5e75fd9a6f47b2481 SHA512 29e474b0eab4dd2ffa0b964d83f52ffce530e75c4193e307410ef6d20ef9ad2b300a4f467bdf06b3311157340e9295cb9b1efdcf08dafee66979b076c2afba7e |
34 |
+DIST rust-1.26.2-x86_64-unknown-linux-musl.tar.xz 101703244 BLAKE2B d69fafba82b9e98f5c9d45c606a732c1a698141f543f7d8671a715cd95dbb4948def4e8593f7355ec88b0c7aa7199dec65d7af0acec0857095641dab6df19f0c SHA512 563ed60897c5df26a407b288a44bd1d09c53ab08901fe3660426d0744f81ab32c144494af134edeea0f4c915d5844819f5987d9291622cccc7de0691e8eb4a8c |
35 |
DIST rustc-1.25.0-src.tar.xz 56108536 BLAKE2B c4a5e56b0e345b5ccde699f68659ac10793670047d2806bdab856d56aa5b960a0df5b947f7c0a7dadfcb7edbe4f9c1a71a94c5f240e91c93296a90d232030645 SHA512 45baaaa47d8b6433f61b1a6f2637d8f4fe013b534a8a94365025dfcf786815c95111b9bd3beb2544ba8587fb4c8b38431765c4d68bc9c19285da4ccf7c7eeda2 |
36 |
-DIST rustc-1.26.2-src.tar.xz 54613640 BLAKE2B f361b7a0ed40ccb026750b4a70b99931f1abf52024e907b588e339902de2fbbd15501d237ac048d0537005834b0a2f49935f654a8c75d40ed95c65894f611481 SHA512 a598858ddce0e05d1d431be383400f44fc551eb2e368f37b01670c0b65ea5da6a7d5b2b68bb6ef806d2107cfa0d5007008442ad4d5ddb17d18d04e0ab31600b0 |
37 |
+DIST rustc-1.26.2-src.tar.xz 8975336 BLAKE2B 8003e48f406262b7579593219ddec2d34372af6db1a3d4751a3e058ab63a8c7d4a1db5421973c14ef391c244081aec278274e5163cb0cc0acce49d96d83289fa SHA512 9fa421fb682e8fe4b0f01d5dfb1491adb2249ed98060b805c74af222f12b551260f473dca8bd186e1c1d095567b66dc33b812daba80329f607d1a2aa5e3145d5 |
38 |
+DIST rustc-1.27.0-src.tar.xz 55455772 BLAKE2B 5c1b26a3e8c6e45aaa43b3ccb5819089cf03c32807ac1adc46ec4f9ff8cf803ec444587ccb737b5d701c4ef5fa634fc4c89de3d71e6202b64ec125f986e54ffd SHA512 b80af48c637741add1d2846e6e3153b0125fb22ed587036fb9d27ad3961419af64802aa91a79258277b1be20718281558989ea0283db0c482fe1512354ba79d8 |
39 |
|
40 |
diff --git a/dev-lang/rust/files/1.27.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/1.27.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch |
41 |
new file mode 100644 |
42 |
index 0000000..bd63773 |
43 |
--- /dev/null |
44 |
+++ b/dev-lang/rust/files/1.27.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch |
45 |
@@ -0,0 +1,384 @@ |
46 |
+diff -Naur rustc-1.27.0-src.orig/config.toml.example rustc-1.27.0-src/config.toml.example |
47 |
+--- rustc-1.27.0-src.orig/config.toml.example 2018-06-27 09:52:27.113947671 -0700 |
48 |
++++ rustc-1.27.0-src/config.toml.example 2018-06-27 09:53:12.820946852 -0700 |
49 |
+@@ -395,12 +395,6 @@ |
50 |
+ # only use static libraries. If unset, the target's default linkage is used. |
51 |
+ #crt-static = false |
52 |
+ |
53 |
+-# The root location of the MUSL installation directory. The library directory |
54 |
+-# will also need to contain libunwind.a for an unwinding implementation. Note |
55 |
+-# that this option only makes sense for MUSL targets that produce statically |
56 |
+-# linked binaries |
57 |
+-#musl-root = "..." |
58 |
+- |
59 |
+ # Used in testing for configuring where the QEMU images are located, you |
60 |
+ # probably don't want to use this. |
61 |
+ #qemu-rootfs = "..." |
62 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/bin/rustc.rs rustc-1.27.0-src/src/bootstrap/bin/rustc.rs |
63 |
+--- rustc-1.27.0-src.orig/src/bootstrap/bin/rustc.rs 2018-06-27 09:52:24.438947719 -0700 |
64 |
++++ rustc-1.27.0-src/src/bootstrap/bin/rustc.rs 2018-06-27 09:53:37.396946412 -0700 |
65 |
+@@ -30,7 +30,6 @@ |
66 |
+ extern crate bootstrap; |
67 |
+ |
68 |
+ use std::env; |
69 |
+-use std::ffi::OsString; |
70 |
+ use std::io; |
71 |
+ use std::path::PathBuf; |
72 |
+ use std::process::Command; |
73 |
+@@ -126,15 +125,6 @@ |
74 |
+ cmd.arg("-Cprefer-dynamic"); |
75 |
+ } |
76 |
+ |
77 |
+- // Help the libc crate compile by assisting it in finding the MUSL |
78 |
+- // native libraries. |
79 |
+- if let Some(s) = env::var_os("MUSL_ROOT") { |
80 |
+- let mut root = OsString::from("native="); |
81 |
+- root.push(&s); |
82 |
+- root.push("/lib"); |
83 |
+- cmd.arg("-L").arg(&root); |
84 |
+- } |
85 |
+- |
86 |
+ // Override linker if necessary. |
87 |
+ if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") { |
88 |
+ cmd.arg(format!("-Clinker={}", target_linker)); |
89 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/cc_detect.rs rustc-1.27.0-src/src/bootstrap/cc_detect.rs |
90 |
+--- rustc-1.27.0-src.orig/src/bootstrap/cc_detect.rs 2018-06-27 09:52:24.438947719 -0700 |
91 |
++++ rustc-1.27.0-src/src/bootstrap/cc_detect.rs 2018-06-27 09:55:01.019944915 -0700 |
92 |
+@@ -95,7 +95,7 @@ |
93 |
+ if let Some(cc) = config.and_then(|c| c.cc.as_ref()) { |
94 |
+ cfg.compiler(cc); |
95 |
+ } else { |
96 |
+- set_compiler(&mut cfg, Language::C, target, config, build); |
97 |
++ set_compiler(&mut cfg, Language::C, target, config); |
98 |
+ } |
99 |
+ |
100 |
+ let compiler = cfg.get_compiler(); |
101 |
+@@ -124,7 +124,7 @@ |
102 |
+ if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) { |
103 |
+ cfg.compiler(cxx); |
104 |
+ } else { |
105 |
+- set_compiler(&mut cfg, Language::CPlusPlus, host, config, build); |
106 |
++ set_compiler(&mut cfg, Language::CPlusPlus, host, config); |
107 |
+ } |
108 |
+ let compiler = cfg.get_compiler(); |
109 |
+ build.verbose(&format!("CXX_{} = {:?}", host, compiler.path())); |
110 |
+@@ -135,8 +135,7 @@ |
111 |
+ fn set_compiler(cfg: &mut cc::Build, |
112 |
+ compiler: Language, |
113 |
+ target: Interned<String>, |
114 |
+- config: Option<&Target>, |
115 |
+- build: &Build) { |
116 |
++ config: Option<&Target>) { |
117 |
+ match &*target { |
118 |
+ // When compiling for android we may have the NDK configured in the |
119 |
+ // config.toml in which case we look there. Otherwise the default |
120 |
+@@ -173,26 +172,6 @@ |
121 |
+ } |
122 |
+ } |
123 |
+ |
124 |
+- "mips-unknown-linux-musl" => { |
125 |
+- if cfg.get_compiler().path().to_str() == Some("gcc") { |
126 |
+- cfg.compiler("mips-linux-musl-gcc"); |
127 |
+- } |
128 |
+- } |
129 |
+- "mipsel-unknown-linux-musl" => { |
130 |
+- if cfg.get_compiler().path().to_str() == Some("gcc") { |
131 |
+- cfg.compiler("mipsel-linux-musl-gcc"); |
132 |
+- } |
133 |
+- } |
134 |
+- |
135 |
+- t if t.contains("musl") => { |
136 |
+- if let Some(root) = build.musl_root(target) { |
137 |
+- let guess = root.join("bin/musl-gcc"); |
138 |
+- if guess.exists() { |
139 |
+- cfg.compiler(guess); |
140 |
+- } |
141 |
+- } |
142 |
+- } |
143 |
+- |
144 |
+ _ => {} |
145 |
+ } |
146 |
+ } |
147 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/compile.rs rustc-1.27.0-src/src/bootstrap/compile.rs |
148 |
+--- rustc-1.27.0-src.orig/src/bootstrap/compile.rs 2018-06-27 09:52:24.438947719 -0700 |
149 |
++++ rustc-1.27.0-src/src/bootstrap/compile.rs 2018-06-27 09:55:41.457944191 -0700 |
150 |
+@@ -78,13 +78,6 @@ |
151 |
+ }); |
152 |
+ builder.info(&format!("Uplifting stage1 std ({} -> {})", from.host, target)); |
153 |
+ |
154 |
+- // Even if we're not building std this stage, the new sysroot must |
155 |
+- // still contain the musl startup objects. |
156 |
+- if target.contains("musl") { |
157 |
+- let libdir = builder.sysroot_libdir(compiler, target); |
158 |
+- copy_musl_third_party_objects(builder, target, &libdir); |
159 |
+- } |
160 |
+- |
161 |
+ builder.ensure(StdLink { |
162 |
+ compiler: from, |
163 |
+ target_compiler: compiler, |
164 |
+@@ -93,11 +86,6 @@ |
165 |
+ return; |
166 |
+ } |
167 |
+ |
168 |
+- if target.contains("musl") { |
169 |
+- let libdir = builder.sysroot_libdir(compiler, target); |
170 |
+- copy_musl_third_party_objects(builder, target, &libdir); |
171 |
+- } |
172 |
+- |
173 |
+ let out_dir = builder.cargo_out(compiler, Mode::Libstd, target); |
174 |
+ builder.clear_if_dirty(&out_dir, &builder.rustc(compiler)); |
175 |
+ let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build"); |
176 |
+@@ -119,20 +107,6 @@ |
177 |
+ } |
178 |
+ } |
179 |
+ |
180 |
+-/// Copies the crt(1,i,n).o startup objects |
181 |
+-/// |
182 |
+-/// Since musl supports fully static linking, we can cross link for it even |
183 |
+-/// with a glibc-targeting toolchain, given we have the appropriate startup |
184 |
+-/// files. As those shipped with glibc won't work, copy the ones provided by |
185 |
+-/// musl so we have them on linux-gnu hosts. |
186 |
+-fn copy_musl_third_party_objects(builder: &Builder, |
187 |
+- target: Interned<String>, |
188 |
+- into: &Path) { |
189 |
+- for &obj in &["crt1.o", "crti.o", "crtn.o"] { |
190 |
+- builder.copy(&builder.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj)); |
191 |
+- } |
192 |
+-} |
193 |
+- |
194 |
+ /// Configure cargo to compile the standard library, adding appropriate env vars |
195 |
+ /// and such. |
196 |
+ pub fn std_cargo(builder: &Builder, |
197 |
+@@ -187,11 +161,6 @@ |
198 |
+ cargo.env("JEMALLOC_OVERRIDE", jemalloc); |
199 |
+ } |
200 |
+ } |
201 |
+- if target.contains("musl") { |
202 |
+- if let Some(p) = builder.musl_root(target) { |
203 |
+- cargo.env("MUSL_ROOT", p); |
204 |
+- } |
205 |
+- } |
206 |
+ } |
207 |
+ } |
208 |
+ |
209 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/config.rs rustc-1.27.0-src/src/bootstrap/config.rs |
210 |
+--- rustc-1.27.0-src.orig/src/bootstrap/config.rs 2018-06-27 09:52:24.438947719 -0700 |
211 |
++++ rustc-1.27.0-src/src/bootstrap/config.rs 2018-06-27 09:56:06.336943745 -0700 |
212 |
+@@ -129,8 +129,6 @@ |
213 |
+ pub save_toolstates: Option<PathBuf>, |
214 |
+ pub print_step_timings: bool, |
215 |
+ |
216 |
+- // Fallback musl-root for all targets |
217 |
+- pub musl_root: Option<PathBuf>, |
218 |
+ pub prefix: Option<PathBuf>, |
219 |
+ pub sysconfdir: Option<PathBuf>, |
220 |
+ pub datadir: Option<PathBuf>, |
221 |
+@@ -163,7 +161,6 @@ |
222 |
+ pub linker: Option<PathBuf>, |
223 |
+ pub ndk: Option<PathBuf>, |
224 |
+ pub crt_static: Option<bool>, |
225 |
+- pub musl_root: Option<PathBuf>, |
226 |
+ pub qemu_rootfs: Option<PathBuf>, |
227 |
+ pub no_std: bool, |
228 |
+ } |
229 |
+@@ -291,7 +288,6 @@ |
230 |
+ backtrace: Option<bool>, |
231 |
+ default_linker: Option<String>, |
232 |
+ channel: Option<String>, |
233 |
+- musl_root: Option<String>, |
234 |
+ rpath: Option<bool>, |
235 |
+ optimize_tests: Option<bool>, |
236 |
+ debuginfo_tests: Option<bool>, |
237 |
+@@ -322,7 +318,6 @@ |
238 |
+ linker: Option<String>, |
239 |
+ android_ndk: Option<String>, |
240 |
+ crt_static: Option<bool>, |
241 |
+- musl_root: Option<String>, |
242 |
+ qemu_rootfs: Option<String>, |
243 |
+ } |
244 |
+ |
245 |
+@@ -530,7 +525,6 @@ |
246 |
+ set(&mut config.lld_enabled, rust.lld); |
247 |
+ config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false); |
248 |
+ config.rustc_default_linker = rust.default_linker.clone(); |
249 |
+- config.musl_root = rust.musl_root.clone().map(PathBuf::from); |
250 |
+ config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from); |
251 |
+ set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings)); |
252 |
+ set(&mut config.backtrace_on_ice, rust.backtrace_on_ice); |
253 |
+@@ -568,7 +562,6 @@ |
254 |
+ target.ar = cfg.ar.clone().map(PathBuf::from); |
255 |
+ target.linker = cfg.linker.clone().map(PathBuf::from); |
256 |
+ target.crt_static = cfg.crt_static.clone(); |
257 |
+- target.musl_root = cfg.musl_root.clone().map(PathBuf::from); |
258 |
+ target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from); |
259 |
+ |
260 |
+ config.target_config.insert(INTERNER.intern_string(triple.clone()), target); |
261 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/configure.py rustc-1.27.0-src/src/bootstrap/configure.py |
262 |
+--- rustc-1.27.0-src.orig/src/bootstrap/configure.py 2018-06-27 09:52:24.438947719 -0700 |
263 |
++++ rustc-1.27.0-src/src/bootstrap/configure.py 2018-06-27 09:56:30.159943318 -0700 |
264 |
+@@ -108,28 +108,6 @@ |
265 |
+ "aarch64-linux-android NDK standalone path") |
266 |
+ v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk", |
267 |
+ "x86_64-linux-android NDK standalone path") |
268 |
+-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root", |
269 |
+- "MUSL root installation directory (deprecated)") |
270 |
+-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root", |
271 |
+- "x86_64-unknown-linux-musl install directory") |
272 |
+-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root", |
273 |
+- "i586-unknown-linux-musl install directory") |
274 |
+-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root", |
275 |
+- "i686-unknown-linux-musl install directory") |
276 |
+-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root", |
277 |
+- "arm-unknown-linux-musleabi install directory") |
278 |
+-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root", |
279 |
+- "arm-unknown-linux-musleabihf install directory") |
280 |
+-v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root", |
281 |
+- "armv5te-unknown-linux-musleabi install directory") |
282 |
+-v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root", |
283 |
+- "armv7-unknown-linux-musleabihf install directory") |
284 |
+-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root", |
285 |
+- "aarch64-unknown-linux-musl install directory") |
286 |
+-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root", |
287 |
+- "mips-unknown-linux-musl install directory") |
288 |
+-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root", |
289 |
+- "mipsel-unknown-linux-musl install directory") |
290 |
+ v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", |
291 |
+ "rootfs in qemu testing, you probably don't want to use this") |
292 |
+ v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", |
293 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/lib.rs rustc-1.27.0-src/src/bootstrap/lib.rs |
294 |
+--- rustc-1.27.0-src.orig/src/bootstrap/lib.rs 2018-06-27 09:52:24.438947719 -0700 |
295 |
++++ rustc-1.27.0-src/src/bootstrap/lib.rs 2018-06-27 09:56:40.317943136 -0700 |
296 |
+@@ -751,14 +751,6 @@ |
297 |
+ } |
298 |
+ } |
299 |
+ |
300 |
+- /// Returns the "musl root" for this `target`, if defined |
301 |
+- fn musl_root(&self, target: Interned<String>) -> Option<&Path> { |
302 |
+- self.config.target_config.get(&target) |
303 |
+- .and_then(|t| t.musl_root.as_ref()) |
304 |
+- .or(self.config.musl_root.as_ref()) |
305 |
+- .map(|p| &**p) |
306 |
+- } |
307 |
+- |
308 |
+ /// Returns true if this is a no-std `target`, if defined |
309 |
+ fn no_std(&self, target: Interned<String>) -> Option<bool> { |
310 |
+ self.config.target_config.get(&target) |
311 |
+diff -Naur rustc-1.27.0-src.orig/src/bootstrap/sanity.rs rustc-1.27.0-src/src/bootstrap/sanity.rs |
312 |
+--- rustc-1.27.0-src.orig/src/bootstrap/sanity.rs 2018-06-27 09:52:24.438947719 -0700 |
313 |
++++ rustc-1.27.0-src/src/bootstrap/sanity.rs 2018-06-27 09:57:09.096942621 -0700 |
314 |
+@@ -21,7 +21,7 @@ |
315 |
+ use std::collections::HashMap; |
316 |
+ use std::env; |
317 |
+ use std::ffi::{OsString, OsStr}; |
318 |
+-use std::fs::{self, File}; |
319 |
++use std::fs::File; |
320 |
+ use std::io::Read; |
321 |
+ use std::path::PathBuf; |
322 |
+ use std::process::Command; |
323 |
+@@ -186,34 +186,6 @@ |
324 |
+ } |
325 |
+ } |
326 |
+ |
327 |
+- // Make sure musl-root is valid |
328 |
+- if target.contains("musl") { |
329 |
+- // If this is a native target (host is also musl) and no musl-root is given, |
330 |
+- // fall back to the system toolchain in /usr before giving up |
331 |
+- if build.musl_root(*target).is_none() && build.config.build == *target { |
332 |
+- let target = build.config.target_config.entry(target.clone()) |
333 |
+- .or_insert(Default::default()); |
334 |
+- target.musl_root = Some("/usr".into()); |
335 |
+- } |
336 |
+- match build.musl_root(*target) { |
337 |
+- Some(root) => { |
338 |
+- if fs::metadata(root.join("lib/libc.a")).is_err() { |
339 |
+- panic!("couldn't find libc.a in musl dir: {}", |
340 |
+- root.join("lib").display()); |
341 |
+- } |
342 |
+- if fs::metadata(root.join("lib/libunwind.a")).is_err() { |
343 |
+- panic!("couldn't find libunwind.a in musl dir: {}", |
344 |
+- root.join("lib").display()); |
345 |
+- } |
346 |
+- } |
347 |
+- None => { |
348 |
+- panic!("when targeting MUSL either the rust.musl-root \ |
349 |
+- option or the target.$TARGET.musl-root option must \ |
350 |
+- be specified in config.toml") |
351 |
+- } |
352 |
+- } |
353 |
+- } |
354 |
+- |
355 |
+ if target.contains("msvc") { |
356 |
+ // There are three builds of cmake on windows: MSVC, MinGW, and |
357 |
+ // Cygwin. The Cygwin build does not have generators for Visual |
358 |
+diff -Naur rustc-1.27.0-src.orig/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile rustc-1.27.0-src/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile |
359 |
+--- rustc-1.27.0-src.orig/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile 2018-06-27 09:52:23.560947734 -0700 |
360 |
++++ rustc-1.27.0-src/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile 2018-06-27 09:57:22.478942381 -0700 |
361 |
+@@ -30,8 +30,6 @@ |
362 |
+ RUN sh /scripts/sccache.sh |
363 |
+ |
364 |
+ ENV RUST_CONFIGURE_ARGS \ |
365 |
+- --musl-root-i586=/musl-i586 \ |
366 |
+- --musl-root-i686=/musl-i686 \ |
367 |
+ --enable-extended \ |
368 |
+ --disable-docs |
369 |
+ |
370 |
+diff -Naur rustc-1.27.0-src.orig/src/ci/docker/dist-various-1/Dockerfile rustc-1.27.0-src/src/ci/docker/dist-various-1/Dockerfile |
371 |
+--- rustc-1.27.0-src.orig/src/ci/docker/dist-various-1/Dockerfile 2018-06-27 09:52:23.561947734 -0700 |
372 |
++++ rustc-1.27.0-src/src/ci/docker/dist-various-1/Dockerfile 2018-06-27 09:57:47.163941939 -0700 |
373 |
+@@ -110,13 +110,6 @@ |
374 |
+ CFLAGS_armv5te_unknown_linux_musleabi="-march=armv5te -marm -mfloat-abi=soft" |
375 |
+ |
376 |
+ ENV RUST_CONFIGURE_ARGS \ |
377 |
+- --musl-root-armv5te=/musl-armv5te \ |
378 |
+- --musl-root-arm=/musl-arm \ |
379 |
+- --musl-root-armhf=/musl-armhf \ |
380 |
+- --musl-root-armv7=/musl-armv7 \ |
381 |
+- --musl-root-aarch64=/musl-aarch64 \ |
382 |
+- --musl-root-mips=/musl-mips \ |
383 |
+- --musl-root-mipsel=/musl-mipsel \ |
384 |
+ --enable-emscripten \ |
385 |
+ --disable-docs |
386 |
+ |
387 |
+diff -Naur rustc-1.27.0-src.orig/src/ci/docker/dist-x86_64-musl/Dockerfile rustc-1.27.0-src/src/ci/docker/dist-x86_64-musl/Dockerfile |
388 |
+--- rustc-1.27.0-src.orig/src/ci/docker/dist-x86_64-musl/Dockerfile 2018-06-27 09:52:23.559947734 -0700 |
389 |
++++ rustc-1.27.0-src/src/ci/docker/dist-x86_64-musl/Dockerfile 2018-06-27 09:58:00.620941698 -0700 |
390 |
+@@ -30,7 +30,6 @@ |
391 |
+ RUN sh /scripts/sccache.sh |
392 |
+ |
393 |
+ ENV RUST_CONFIGURE_ARGS \ |
394 |
+- --musl-root-x86_64=/musl-x86_64 \ |
395 |
+ --enable-extended \ |
396 |
+ --disable-docs |
397 |
+ |
398 |
+diff -Naur rustc-1.27.0-src.orig/src/librustc_target/spec/linux_musl_base.rs rustc-1.27.0-src/src/librustc_target/spec/linux_musl_base.rs |
399 |
+--- rustc-1.27.0-src.orig/src/librustc_target/spec/linux_musl_base.rs 2018-06-27 09:52:22.322947757 -0700 |
400 |
++++ rustc-1.27.0-src/src/librustc_target/spec/linux_musl_base.rs 2018-06-27 09:59:09.776940460 -0700 |
401 |
+@@ -13,10 +13,6 @@ |
402 |
+ pub fn opts() -> TargetOptions { |
403 |
+ let mut base = super::linux_base::opts(); |
404 |
+ |
405 |
+- // Make sure that the linker/gcc really don't pull in anything, including |
406 |
+- // default objects, libs, etc. |
407 |
+- base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string()); |
408 |
+- |
409 |
+ // At least when this was tested, the linker would not add the |
410 |
+ // `GNU_EH_FRAME` program header to executables generated, which is required |
411 |
+ // when unwinding to locate the unwinding information. I'm not sure why this |
412 |
+@@ -48,17 +44,6 @@ |
413 |
+ base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string()); |
414 |
+ base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]); |
415 |
+ |
416 |
+- // When generating a statically linked executable there's generally some |
417 |
+- // small setup needed which is listed in these files. These are provided by |
418 |
+- // a musl toolchain and are linked by default by the `musl-gcc` script. Note |
419 |
+- // that `gcc` also does this by default, it just uses some different files. |
420 |
+- // |
421 |
+- // Each target directory for musl has these object files included in it so |
422 |
+- // they'll be included from there. |
423 |
+- base.pre_link_objects_exe.push("crt1.o".to_string()); |
424 |
+- base.pre_link_objects_exe.push("crti.o".to_string()); |
425 |
+- base.post_link_objects.push("crtn.o".to_string()); |
426 |
+- |
427 |
+ // These targets statically link libc by default |
428 |
+ base.crt_static_default = true; |
429 |
+ // These targets allow the user to choose between static and dynamic linking. |
430 |
|
431 |
diff --git a/dev-lang/rust/files/1.27.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch b/dev-lang/rust/files/1.27.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch |
432 |
new file mode 100644 |
433 |
index 0000000..f0b4b74 |
434 |
--- /dev/null |
435 |
+++ b/dev-lang/rust/files/1.27.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch |
436 |
@@ -0,0 +1,12 @@ |
437 |
+diff -Naur rustc-1.27.0-src.orig/src/librustc_target/spec/linux_musl_base.rs rustc-1.27.0-src/src/librustc_target/spec/linux_musl_base.rs |
438 |
+--- rustc-1.27.0-src.orig/src/librustc_target/spec/linux_musl_base.rs 2018-06-27 09:52:22.322947757 -0700 |
439 |
++++ rustc-1.27.0-src/src/librustc_target/spec/linux_musl_base.rs 2018-06-27 10:08:26.989930481 -0700 |
440 |
+@@ -59,8 +59,6 @@ |
441 |
+ base.pre_link_objects_exe.push("crti.o".to_string()); |
442 |
+ base.post_link_objects.push("crtn.o".to_string()); |
443 |
+ |
444 |
+- // These targets statically link libc by default |
445 |
+- base.crt_static_default = true; |
446 |
+ // These targets allow the user to choose between static and dynamic linking. |
447 |
+ base.crt_static_respected = true; |
448 |
+ |
449 |
|
450 |
diff --git a/dev-lang/rust/files/rust-1.27.0-libressl-2.7.0.patch b/dev-lang/rust/files/rust-1.27.0-libressl-2.7.0.patch |
451 |
new file mode 100644 |
452 |
index 0000000..d794284 |
453 |
--- /dev/null |
454 |
+++ b/dev-lang/rust/files/rust-1.27.0-libressl-2.7.0.patch |
455 |
@@ -0,0 +1,24 @@ |
456 |
+--- a/src/vendor/libgit2-sys/libgit2/src/streams/openssl.c 2018-05-07 18:50:07 UTC |
457 |
++++ b/src/vendor/libgit2-sys/libgit2/src/streams/openssl.c |
458 |
+@@ -104,7 +104,8 @@ int git_openssl_stream_global_init(void) |
459 |
+ ssl_opts |= SSL_OP_NO_COMPRESSION; |
460 |
+ #endif |
461 |
+ |
462 |
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
463 |
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ |
464 |
++ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) |
465 |
+ SSL_load_error_strings(); |
466 |
+ OpenSSL_add_ssl_algorithms(); |
467 |
+ #else |
468 |
+--- a/src/vendor/libgit2-sys/libgit2/src/streams/openssl.h 2018-05-07 18:50:07 UTC |
469 |
++++ b/src/vendor/libgit2-sys/libgit2/src/streams/openssl.h |
470 |
+@@ -31,7 +31,8 @@ extern int git_openssl__set_cert_location(const char * |
471 |
+ |
472 |
+ |
473 |
+ |
474 |
+-# if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
475 |
++# if OPENSSL_VERSION_NUMBER < 0x10100000L || \ |
476 |
++ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) |
477 |
+ |
478 |
+ GIT_INLINE(BIO_METHOD*) BIO_meth_new(int type, const char *name) |
479 |
+ { |
480 |
|
481 |
diff --git a/dev-lang/rust/rust-1.27.0.ebuild b/dev-lang/rust/rust-1.27.0.ebuild |
482 |
new file mode 100644 |
483 |
index 0000000..a875874 |
484 |
--- /dev/null |
485 |
+++ b/dev-lang/rust/rust-1.27.0.ebuild |
486 |
@@ -0,0 +1,355 @@ |
487 |
+# Copyright 1999-2018 Gentoo Foundation |
488 |
+# Distributed under the terms of the GNU General Public License v2 |
489 |
+ |
490 |
+EAPI=6 |
491 |
+ |
492 |
+LLVM_MAX_SLOT=6 |
493 |
+PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) |
494 |
+ |
495 |
+inherit llvm multiprocessing multilib-build python-any-r1 versionator toolchain-funcs |
496 |
+ |
497 |
+if [[ ${PV} = *beta* ]]; then |
498 |
+ betaver=${PV//*beta} |
499 |
+ BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" |
500 |
+ MY_P="rustc-beta" |
501 |
+ SLOT="beta/${PV}" |
502 |
+ SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz" |
503 |
+ KEYWORDS="" |
504 |
+else |
505 |
+ ABI_VER="$(get_version_component_range 1-2)" |
506 |
+ SLOT="stable/${ABI_VER}" |
507 |
+ MY_P="rustc-${PV}" |
508 |
+ SRC="${MY_P}-src.tar.xz" |
509 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
510 |
+fi |
511 |
+ |
512 |
+RUST_STAGE0_VERSION="1.$(($(get_version_component_range 2) - 1)).2" |
513 |
+ |
514 |
+# there is no cargo 0.28 tag, so use 0.27 |
515 |
+CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2))).0" |
516 |
+ |
517 |
+DESCRIPTION="Systems programming language from Mozilla" |
518 |
+HOMEPAGE="https://www.rust-lang.org/" |
519 |
+ |
520 |
+SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz |
521 |
+ amd64? ( |
522 |
+ elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-gnu.tar.xz ) |
523 |
+ elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-x86_64-unknown-linux-musl.tar.xz ) |
524 |
+ ) |
525 |
+ arm? ( |
526 |
+ elibc_glibc? ( |
527 |
+ https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-gnueabi.tar.xz |
528 |
+ https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-gnueabihf.tar.xz |
529 |
+ ) |
530 |
+ elibc_musl? ( |
531 |
+ https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-arm-unknown-linux-musleabi.tar.xz |
532 |
+ https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-armv7-unknown-linux-musleabihf.tar.xz |
533 |
+ ) |
534 |
+ ) |
535 |
+ arm64? ( |
536 |
+ elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-gnu.tar.xz ) |
537 |
+ elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-aarch64-unknown-linux-musl.tar.xz ) |
538 |
+ ) |
539 |
+ x86? ( |
540 |
+ elibc_glibc? ( https://static.rust-lang.org/dist/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-gnu.tar.xz ) |
541 |
+ elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${RUST_STAGE0_VERSION}-i686-unknown-linux-musl.tar.xz ) |
542 |
+ ) |
543 |
+" |
544 |
+ |
545 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 |
546 |
+ NVPTX PowerPC Sparc SystemZ X86 XCore ) |
547 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
548 |
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} |
549 |
+ |
550 |
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" |
551 |
+ |
552 |
+IUSE="debug doc extended jemalloc libressl system-llvm wasm ${ALL_LLVM_TARGETS[*]}" |
553 |
+ |
554 |
+RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 |
555 |
+ jemalloc? ( dev-libs/jemalloc ) |
556 |
+ system-llvm? ( sys-devel/llvm ) |
557 |
+ extended? ( |
558 |
+ libressl? ( dev-libs/libressl:0= ) |
559 |
+ !libressl? ( dev-libs/openssl:0= ) |
560 |
+ net-libs/http-parser:0/2.8.0 |
561 |
+ net-libs/libssh2:= |
562 |
+ net-misc/curl:=[ssl] |
563 |
+ sys-libs/zlib:= |
564 |
+ !dev-util/rustfmt |
565 |
+ !dev-util/cargo |
566 |
+ ) |
567 |
+" |
568 |
+DEPEND="${RDEPEND} |
569 |
+ ${PYTHON_DEPS} |
570 |
+ || ( |
571 |
+ >=sys-devel/gcc-4.7 |
572 |
+ >=sys-devel/clang-3.5 |
573 |
+ ) |
574 |
+ !system-llvm? ( |
575 |
+ dev-util/cmake |
576 |
+ dev-util/ninja |
577 |
+ ) |
578 |
+" |
579 |
+PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" |
580 |
+ |
581 |
+REQUIRED_USE="!system-llvm? ( || ( ${ALL_LLVM_TARGETS[*]} ) )" |
582 |
+ |
583 |
+PATCHES=( |
584 |
+ "${FILESDIR}/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch" |
585 |
+ "${FILESDIR}/1.27.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" |
586 |
+ "${FILESDIR}/1.27.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch" |
587 |
+ "${FILESDIR}/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch" |
588 |
+ "${FILESDIR}/1.25.0/0005-Fix-LLVM-build.patch" |
589 |
+ "${FILESDIR}/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch" |
590 |
+ "${FILESDIR}/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch" |
591 |
+ "${FILESDIR}/1.26.2/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" |
592 |
+ "${FILESDIR}/1.25.0/0009-liblibc.patch" |
593 |
+ "${FILESDIR}/1.25.0/0010-llvm.patch" |
594 |
+ "${FILESDIR}/rust-1.27.0-libressl-2.7.0.patch" |
595 |
+) |
596 |
+ |
597 |
+S="${WORKDIR}/${MY_P}-src" |
598 |
+ |
599 |
+toml_usex() { |
600 |
+ usex "$1" true false |
601 |
+} |
602 |
+ |
603 |
+rust_host() { |
604 |
+ case "${1}" in |
605 |
+ arm) |
606 |
+ if [[ ${1} == ${DEFAULT_ABI} ]]; then |
607 |
+ if [[ ${CHOST} == armv7* ]]; then |
608 |
+ RUSTARCH=armv7 |
609 |
+ else |
610 |
+ RUSTARCH=arm |
611 |
+ fi |
612 |
+ else |
613 |
+ RUSTARCH=arm |
614 |
+ fi ;; |
615 |
+ amd64) |
616 |
+ RUSTARCH=x86_64 ;; |
617 |
+ arm64) |
618 |
+ RUSTARCH=aarch64 ;; |
619 |
+ x86) |
620 |
+ RUSTARCH=i686 ;; |
621 |
+ esac |
622 |
+ case "${1}" in |
623 |
+ arm) |
624 |
+ if [[ ${1} == ${DEFAULT_ABI} ]]; then |
625 |
+ if [[ ${CHOST} == armv7a-hardfloat* ]]; then |
626 |
+ RUSTLIBC=${ELIBC/glibc/gnu}eabihf |
627 |
+ else |
628 |
+ RUSTLIBC=${CHOST##*-} |
629 |
+ fi |
630 |
+ else |
631 |
+ RUSTLIBC=${ELIBC/glibc/gnu} |
632 |
+ fi ;; |
633 |
+ *) |
634 |
+ RUSTLIBC=${ELIBC/glibc/gnu} ;; |
635 |
+ esac |
636 |
+ RUSTHOST=${RUSTARCH}-unknown-${KERNEL}-${RUSTLIBC} |
637 |
+ echo "${RUSTHOST}" |
638 |
+} |
639 |
+ |
640 |
+pkg_setup() { |
641 |
+ export RUST_BACKTRACE=1 |
642 |
+ if use system-llvm; then |
643 |
+ llvm_pkg_setup |
644 |
+ local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
645 |
+ |
646 |
+ export LLVM_LINK_SHARED=1 |
647 |
+ export RUSTFLAGS="$RUSTFLAGS -L native=$("$llvm_config" --libdir)" |
648 |
+ fi |
649 |
+ |
650 |
+ python-any-r1_pkg_setup |
651 |
+} |
652 |
+ |
653 |
+src_prepare() { |
654 |
+ "${WORKDIR}/rust-${RUST_STAGE0_VERSION}-$(rust_host ${ARCH})/install.sh" \ |
655 |
+ --destdir="${WORKDIR}/stage0" \ |
656 |
+ --prefix=/ \ |
657 |
+ --components=rust-std-$(rust_host ${ARCH}),rustc,cargo \ |
658 |
+ --disable-ldconfig \ |
659 |
+ || die |
660 |
+ |
661 |
+ default |
662 |
+} |
663 |
+ |
664 |
+src_configure() { |
665 |
+ local rust_target="" rust_targets="" rust_target_name arch_cflags |
666 |
+ |
667 |
+ # Collect rust target names to compile standard libs for all ABIs. |
668 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
669 |
+ rust_targets="${rust_targets},\"$(rust_host ${v##*.})\"" |
670 |
+ done |
671 |
+ if use wasm; then |
672 |
+ rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" |
673 |
+ fi |
674 |
+ rust_targets="${rust_targets#,}" |
675 |
+ |
676 |
+ rust_target=$(rust_host $ARCH) |
677 |
+ |
678 |
+ cat <<- EOF > "${S}"/config.toml |
679 |
+ [llvm] |
680 |
+ ninja = true |
681 |
+ optimize = $(toml_usex !debug) |
682 |
+ release-debuginfo = $(toml_usex debug) |
683 |
+ assertions = $(toml_usex debug) |
684 |
+ targets = "${LLVM_TARGETS// /;}" |
685 |
+ [build] |
686 |
+ build = "${rust_target}" |
687 |
+ host = ["${rust_target}"] |
688 |
+ target = [${rust_targets}] |
689 |
+ cargo = "${WORKDIR}/stage0/bin/cargo" |
690 |
+ rustc = "${WORKDIR}/stage0/bin/rustc" |
691 |
+ docs = $(toml_usex doc) |
692 |
+ compiler-docs = $(toml_usex doc) |
693 |
+ submodules = false |
694 |
+ python = "${EPYTHON}" |
695 |
+ locked-deps = true |
696 |
+ vendor = true |
697 |
+ verbose = 2 |
698 |
+ extended = $(toml_usex extended) |
699 |
+ [install] |
700 |
+ prefix = "${EPREFIX}/usr" |
701 |
+ libdir = "$(get_libdir)" |
702 |
+ docdir = "share/doc/${P}" |
703 |
+ mandir = "share/${P}/man" |
704 |
+ [rust] |
705 |
+ optimize = $(toml_usex !debug) |
706 |
+ debuginfo = $(toml_usex debug) |
707 |
+ debug-assertions = $(toml_usex debug) |
708 |
+ use-jemalloc = $(toml_usex jemalloc) |
709 |
+ default-linker = "$(tc-getCC)" |
710 |
+ channel = "${SLOT%%/*}" |
711 |
+ rpath = false |
712 |
+ lld = $(toml_usex wasm) |
713 |
+ optimize-tests = $(toml_usex !debug) |
714 |
+ dist-src = false |
715 |
+ [dist] |
716 |
+ src-tarball = false |
717 |
+ EOF |
718 |
+ |
719 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
720 |
+ rust_target=$(rust_host ${v##*.}) |
721 |
+ arch_cflags="$(get_abi_CFLAGS ${v##*.})" |
722 |
+ |
723 |
+ cat <<- EOF >> "${S}"/config.env |
724 |
+ CFLAGS_${rust_target}=${arch_cflags} |
725 |
+ EOF |
726 |
+ |
727 |
+ cat <<- EOF >> "${S}"/config.toml |
728 |
+ [target.${rust_target}] |
729 |
+ cc = "$(tc-getBUILD_CC)" |
730 |
+ cxx = "$(tc-getBUILD_CXX)" |
731 |
+ linker = "$(tc-getCC)" |
732 |
+ ar = "$(tc-getAR)" |
733 |
+ EOF |
734 |
+ |
735 |
+ use system-llvm && cat <<- EOF >> "${S}"/config.toml |
736 |
+ llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" |
737 |
+ EOF |
738 |
+ done |
739 |
+ |
740 |
+ if use wasm; then |
741 |
+ cat <<- EOF >> "${S}"/config.toml |
742 |
+ [target.wasm32-unknown-unknown] |
743 |
+ linker = "lld" |
744 |
+ EOF |
745 |
+ fi |
746 |
+} |
747 |
+ |
748 |
+src_compile() { |
749 |
+ env $(cat "${S}"/config.env)\ |
750 |
+ ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die |
751 |
+} |
752 |
+ |
753 |
+src_install() { |
754 |
+ local rust_target abi_libdir |
755 |
+ |
756 |
+ env DESTDIR="${D}" ./x.py install || die |
757 |
+ |
758 |
+ mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die |
759 |
+ mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die |
760 |
+ mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die |
761 |
+ mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die |
762 |
+ |
763 |
+ # Copy shared library versions of standard libraries for all targets |
764 |
+ # into the system's abi-dependent lib directories because the rust |
765 |
+ # installer only does so for the native ABI. |
766 |
+ for v in $(multilib_get_enabled_abi_pairs); do |
767 |
+ if [ ${v##*.} = ${DEFAULT_ABI} ]; then |
768 |
+ continue |
769 |
+ fi |
770 |
+ abi_libdir=$(get_abi_LIBDIR ${v##*.}) |
771 |
+ rust_target=$(rust_host ${v##*.}) |
772 |
+ mkdir -p "${D}/usr/${abi_libdir}" |
773 |
+ cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ |
774 |
+ "${D}/usr/${abi_libdir}" || die |
775 |
+ done |
776 |
+ |
777 |
+ rm "${D}/usr/$(get_libdir)/rustlib/components" || die |
778 |
+ rm "${D}/usr/$(get_libdir)/rustlib/install.log" || die |
779 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-std-$(rust_host ${ARCH})" || die |
780 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustc" || die |
781 |
+ rm "${D}/usr/$(get_libdir)/rustlib/rust-installer-version" || die |
782 |
+ rm "${D}/usr/$(get_libdir)/rustlib/uninstall.sh" || die |
783 |
+ |
784 |
+ |
785 |
+ if use doc; then |
786 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-docs" || die |
787 |
+ fi |
788 |
+ |
789 |
+ if use extended; then |
790 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-cargo" || die |
791 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rls-preview" || die |
792 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-analysis-$(rust_host ${ARCH})" || die |
793 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-src" || die |
794 |
+ rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustfmt-preview" || die |
795 |
+ |
796 |
+ rm "${D}/usr/share/doc/${P}/LICENSE-APACHE.old" || die |
797 |
+ rm "${D}/usr/share/doc/${P}/LICENSE-MIT.old" || die |
798 |
+ fi |
799 |
+ |
800 |
+ rm "${D}/usr/share/doc/${P}/LICENSE-APACHE" || die |
801 |
+ rm "${D}/usr/share/doc/${P}/LICENSE-MIT" || die |
802 |
+ |
803 |
+ docompress "/usr/share/${P}/man" |
804 |
+ |
805 |
+ cat <<-EOF > "${T}"/50${P} |
806 |
+ MANPATH="/usr/share/${P}/man" |
807 |
+ EOF |
808 |
+ doenvd "${T}"/50${P} |
809 |
+ |
810 |
+ cat <<-EOF > "${T}/provider-${P}" |
811 |
+ /usr/bin/rustdoc |
812 |
+ /usr/bin/rust-gdb |
813 |
+ /usr/bin/rust-lldb |
814 |
+ EOF |
815 |
+ dodir /etc/env.d/rust |
816 |
+ insinto /etc/env.d/rust |
817 |
+ doins "${T}/provider-${P}" |
818 |
+} |
819 |
+ |
820 |
+pkg_postinst() { |
821 |
+ eselect rust update --if-unset |
822 |
+ |
823 |
+ elog "Rust installs a helper script for calling GDB and LLDB," |
824 |
+ elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." |
825 |
+ |
826 |
+ if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then |
827 |
+ elog "install app-emacs/rust-mode to get emacs support for rust." |
828 |
+ fi |
829 |
+ |
830 |
+ if has_version app-editors/gvim || has_version app-editors/vim; then |
831 |
+ elog "install app-vim/rust-vim to get vim support for rust." |
832 |
+ fi |
833 |
+ |
834 |
+ if has_version 'app-shells/zsh'; then |
835 |
+ elog "install app-shells/rust-zshcomp to get zsh completion for rust." |
836 |
+ fi |
837 |
+} |
838 |
+ |
839 |
+pkg_postrm() { |
840 |
+ eselect rust unset --if-invalid |
841 |
+} |