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/files/, dev-lang/rust/
Date: Mon, 29 Jan 2018 19:34:16
Message-Id: 1517254360.87eefea7ded24320154805089ad005cdc85ad376.lluixhi@gentoo
1 commit: 87eefea7ded24320154805089ad005cdc85ad376
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Mon Jan 29 19:32:40 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Mon Jan 29 19:32:40 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=87eefea7
7
8 dev-lang/rust: version bump to 1.23.0-r1
9
10 dev-lang/rust/files/1.23.0-separate-libdir.patch | 180 +++++++++++++++++
11 dev-lang/rust/rust-1.23.0-r1.ebuild | 246 +++++++++++++++++++++++
12 2 files changed, 426 insertions(+)
13
14 diff --git a/dev-lang/rust/files/1.23.0-separate-libdir.patch b/dev-lang/rust/files/1.23.0-separate-libdir.patch
15 new file mode 100644
16 index 0000000..dcf1762
17 --- /dev/null
18 +++ b/dev-lang/rust/files/1.23.0-separate-libdir.patch
19 @@ -0,0 +1,180 @@
20 +From c520b2dd277f13dc09e8e72c486e5c58fb97017d Mon Sep 17 00:00:00 2001
21 +From: O01eg <o01eg@××××××.ru>
22 +Date: Wed, 29 Nov 2017 12:32:03 +0300
23 +Subject: [PATCH] Fix #45345.
24 +
25 +Re-implement
26 +
27 +```bash
28 +CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-`
29 +```
30 +
31 +from old `configure` script.
32 +
33 +Accept verbosity in rustdoc.
34 +
35 +Stage 1 and later use relative libdir.
36 +
37 +Build all stages with relative libdirs.
38 +
39 +Add library path for real rustdoc with `RUSTDOC_LIBDIR` environment variable.
40 +
41 +Remove unused argument `rustc_cargo`.
42 +
43 +Remove unused configuration parameter `libdir_relative`.
44 +---
45 + src/bootstrap/bin/rustdoc.rs | 13 ++++++++++++-
46 + src/bootstrap/builder.rs | 9 ++++++---
47 + src/bootstrap/check.rs | 2 +-
48 + src/bootstrap/compile.rs | 13 ++++---------
49 + src/bootstrap/config.rs | 1 -
50 + src/bootstrap/doc.rs | 2 +-
51 + 6 files changed, 24 insertions(+), 16 deletions(-)
52 +
53 +diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
54 +index 4e975adc97..24312b50ec 100644
55 +--- a/src/bootstrap/bin/rustdoc.rs
56 ++++ b/src/bootstrap/bin/rustdoc.rs
57 +@@ -23,10 +23,17 @@ use std::path::PathBuf;
58 + fn main() {
59 + let args = env::args_os().skip(1).collect::<Vec<_>>();
60 + let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
61 +- let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
62 ++ let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
63 + let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
64 + let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
65 +
66 ++ use std::str::FromStr;
67 ++
68 ++ let verbose = match env::var("RUSTC_VERBOSE") {
69 ++ Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"),
70 ++ Err(_) => 0,
71 ++ };
72 ++
73 + let mut dylib_path = bootstrap::util::dylib_path();
74 + dylib_path.insert(0, PathBuf::from(libdir));
75 +
76 +@@ -59,6 +66,10 @@ fn main() {
77 + .arg("--crate-version").arg(version);
78 + }
79 +
80 ++ if verbose > 1 {
81 ++ eprintln!("rustdoc command: {:?}", cmd);
82 ++ }
83 ++
84 + std::process::exit(match cmd.status() {
85 + Ok(s) => s.code().unwrap_or(1),
86 + Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
87 +diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
88 +index c76900882b..1927a604c5 100644
89 +--- a/src/bootstrap/builder.rs
90 ++++ b/src/bootstrap/builder.rs
91 +@@ -357,8 +357,8 @@ impl<'a> Builder<'a> {
92 +
93 + fn run(self, builder: &Builder) -> Interned<PathBuf> {
94 + let compiler = self.compiler;
95 +- let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
96 +- builder.build.config.libdir_relative.clone().unwrap()
97 ++ let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
98 ++ builder.build.config.libdir.clone().unwrap()
99 + } else {
100 + PathBuf::from("lib")
101 + };
102 +@@ -416,7 +416,7 @@ impl<'a> Builder<'a> {
103 + let compiler = self.compiler(self.top_stage, host);
104 + cmd.env("RUSTC_STAGE", compiler.stage.to_string())
105 + .env("RUSTC_SYSROOT", self.sysroot(compiler))
106 +- .env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
107 ++ .env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
108 + .env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
109 + .env("RUSTDOC_REAL", self.rustdoc(host))
110 + .env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
111 +@@ -496,6 +496,9 @@ impl<'a> Builder<'a> {
112 + if let Some(target_linker) = self.build.linker(target) {
113 + cargo.env("RUSTC_TARGET_LINKER", target_linker);
114 + }
115 ++ if cmd != "build" {
116 ++ cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
117 ++ }
118 +
119 + if mode != Mode::Tool {
120 + // Tools don't get debuginfo right now, e.g. cargo and rls don't
121 +diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
122 +index 4d69b19c73..d926c2b901 100644
123 +--- a/src/bootstrap/check.rs
124 ++++ b/src/bootstrap/check.rs
125 +@@ -1171,7 +1171,7 @@ impl Step for Crate {
126 + }
127 + Mode::Librustc => {
128 + builder.ensure(compile::Rustc { compiler, target });
129 +- compile::rustc_cargo(build, &compiler, target, &mut cargo);
130 ++ compile::rustc_cargo(build, target, &mut cargo);
131 + ("librustc", "rustc-main")
132 + }
133 + _ => panic!("can only test libraries"),
134 +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
135 +index db013691bb..d60feb1aff 100644
136 +--- a/src/bootstrap/compile.rs
137 ++++ b/src/bootstrap/compile.rs
138 +@@ -485,7 +485,7 @@ impl Step for Rustc {
139 + build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
140 +
141 + let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
142 +- rustc_cargo(build, &compiler, target, &mut cargo);
143 ++ rustc_cargo(build, target, &mut cargo);
144 + run_cargo(build,
145 + &mut cargo,
146 + &librustc_stamp(build, compiler, target));
147 +@@ -500,7 +500,6 @@ impl Step for Rustc {
148 +
149 + /// Same as `std_cargo`, but for libtest
150 + pub fn rustc_cargo(build: &Build,
151 +- compiler: &Compiler,
152 + target: Interned<String>,
153 + cargo: &mut Command) {
154 + cargo.arg("--features").arg(build.rustc_features())
155 +@@ -514,13 +513,9 @@ pub fn rustc_cargo(build: &Build,
156 + .env("CFG_VERSION", build.rust_version())
157 + .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
158 +
159 +- if compiler.stage == 0 {
160 +- cargo.env("CFG_LIBDIR_RELATIVE", "lib");
161 +- } else {
162 +- let libdir_relative =
163 +- build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
164 +- cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
165 +- }
166 ++ let libdir_relative =
167 ++ build.config.libdir.clone().unwrap_or(PathBuf::from("lib"));
168 ++ cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
169 +
170 + // If we're not building a compiler with debugging information then remove
171 + // these two env vars which would be set otherwise.
172 +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
173 +index 35e62f17f2..1ca19187cf 100644
174 +--- a/src/bootstrap/config.rs
175 ++++ b/src/bootstrap/config.rs
176 +@@ -119,7 +119,6 @@ pub struct Config {
177 + pub docdir: Option<PathBuf>,
178 + pub bindir: Option<PathBuf>,
179 + pub libdir: Option<PathBuf>,
180 +- pub libdir_relative: Option<PathBuf>,
181 + pub mandir: Option<PathBuf>,
182 + pub codegen_tests: bool,
183 + pub nodejs: Option<PathBuf>,
184 +diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
185 +index 3c12cfc4c7..1314d967d8 100644
186 +--- a/src/bootstrap/doc.rs
187 ++++ b/src/bootstrap/doc.rs
188 +@@ -616,7 +616,7 @@ impl Step for Rustc {
189 + t!(symlink_dir_force(&my_out, &out_dir));
190 +
191 + let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
192 +- compile::rustc_cargo(build, &compiler, target, &mut cargo);
193 ++ compile::rustc_cargo(build, target, &mut cargo);
194 +
195 + if build.config.compiler_docs {
196 + // src/rustc/Cargo.toml contains a bin crate called rustc which
197 +--
198 +2.13.6
199 +
200
201 diff --git a/dev-lang/rust/rust-1.23.0-r1.ebuild b/dev-lang/rust/rust-1.23.0-r1.ebuild
202 new file mode 100644
203 index 0000000..8cdf96b
204 --- /dev/null
205 +++ b/dev-lang/rust/rust-1.23.0-r1.ebuild
206 @@ -0,0 +1,246 @@
207 +# Copyright 1999-2018 Gentoo Foundation
208 +# Distributed under the terms of the GNU General Public License v2
209 +
210 +EAPI=6
211 +
212 +LLVM_MAX_SLOT=4
213 +PYTHON_COMPAT=( python2_7 )
214 +
215 +inherit python-any-r1 versionator toolchain-funcs llvm
216 +
217 +if [[ ${PV} = *beta* ]]; then
218 + betaver=${PV//*beta}
219 + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
220 + MY_P="rustc-beta"
221 + SLOT="beta/${PV}"
222 + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
223 + KEYWORDS=""
224 +else
225 + ABI_VER="$(get_version_component_range 1-2)"
226 + SLOT="stable/${ABI_VER}"
227 + MY_P="rustc-${PV}"
228 + SRC="${MY_P}-src.tar.xz"
229 + KEYWORDS="~amd64 ~arm ~x86"
230 +fi
231 +
232 +case "${CHOST}" in
233 + armv7a-hardfloat-*)
234 + RUSTARCH=armv7 ;;
235 + arm*)
236 + RUSTARCH=arm ;;
237 + *)
238 + RUSTARCH=${CHOST%%-*} ;;
239 +esac
240 +case "${CHOST}" in
241 + armv7a-hardfloat-*)
242 + RUSTLIBC=${ELIBC/glibc/gnu}eabihf ;;
243 + arm*)
244 + RUSTLIBC=${ELIBC/glibc/gnu}eabi ;;
245 + *)
246 + RUSTLIBC=${ELIBC/glibc/gnu} ;;
247 +esac
248 +RUSTHOST=${RUSTARCH}-unknown-${KERNEL}-${RUSTLIBC}
249 +STAGE0_VERSION="1.$(($(get_version_component_range 2) - 0)).0"
250 +CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"
251 +
252 +DESCRIPTION="Systems programming language from Mozilla"
253 +HOMEPAGE="http://www.rust-lang.org/"
254 +
255 +SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
256 + amd64? (
257 + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${STAGE0_VERSION}-x86_64-unknown-linux-gnu.tar.xz )
258 + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${STAGE0_VERSION}-x86_64-unknown-linux-musl.tar.xz )
259 + )
260 + arm? (
261 + elibc_glibc? (
262 + https://static.rust-lang.org/dist/rust-${STAGE0_VERSION}-arm-unknown-linux-gnueabi.tar.xz
263 + https://static.rust-lang.org/dist/rust-${STAGE0_VERSION}-armv7-unknown-linux-gnueabihf.tar.xz
264 + )
265 + elibc_musl? (
266 + https://portage.smaeul.xyz/distfiles/rust-${STAGE0_VERSION}-arm-unknown-linux-musleabi.tar.xz
267 + https://portage.smaeul.xyz/distfiles/rust-${STAGE0_VERSION}-armv7-unknown-linux-musleabihf.tar.xz
268 + )
269 + )
270 + x86? (
271 + elibc_glibc? ( https://static.rust-lang.org/dist/rust-${STAGE0_VERSION}-i686-unknown-linux-gnu.tar.xz )
272 + elibc_musl? ( https://portage.smaeul.xyz/distfiles/rust-${STAGE0_VERSION}-i686-unknown-linux-musl.tar.xz )
273 + )
274 +"
275 +
276 +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
277 +
278 +IUSE="debug doc extended jemalloc system-llvm"
279 +
280 +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
281 + jemalloc? ( dev-libs/jemalloc )
282 + system-llvm? ( sys-devel/llvm:4 )
283 +"
284 +DEPEND="${RDEPEND}
285 + ${PYTHON_DEPS}
286 + || (
287 + >=sys-devel/gcc-4.7
288 + >=sys-devel/clang-3.5
289 + )
290 + !system-llvm? (
291 + >=dev-util/cmake-3.4.3
292 + dev-util/ninja
293 + )
294 +"
295 +PDEPEND="!extended? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )"
296 +
297 +PATCHES=(
298 + "${FILESDIR}/1.23.0-separate-libdir.patch"
299 + "${FILESDIR}/0001-Require-static-native-libraries-when-linking-static-.patch"
300 + "${FILESDIR}/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch"
301 + "${FILESDIR}/0003-Switch-musl-targets-to-link-dynamically-by-default.patch"
302 + "${FILESDIR}/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch"
303 + "${FILESDIR}/0005-Fix-LLVM-build.patch"
304 + "${FILESDIR}/0006-Fix-rustdoc-for-cross-targets.patch"
305 + "${FILESDIR}/0007-Add-openssl-configuration-for-musl-targets.patch"
306 + "${FILESDIR}/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch"
307 + "${FILESDIR}/0009-liblibc.patch"
308 + "${FILESDIR}/llvm-musl-fixes.patch"
309 +)
310 +
311 +S="${WORKDIR}/${MY_P}-src"
312 +
313 +toml_usex() {
314 + usex "$1" true false
315 +}
316 +
317 +pkg_setup() {
318 + export RUST_BACKTRACE=1
319 + if use system-llvm; then
320 + llvm_pkg_setup
321 + local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
322 +
323 + export LLVM_LINK_SHARED=1
324 + export RUSTFLAGS="$RUSTFLAGS -Lnative=$("$llvm_config" --libdir)"
325 + fi
326 +
327 + python-any-r1_pkg_setup
328 +}
329 +
330 +src_prepare() {
331 + default
332 +
333 + "${WORKDIR}/rust-${STAGE0_VERSION}-${RUSTHOST}/install.sh" \
334 + --prefix="${WORKDIR}/stage0" \
335 + --components=rust-std-${RUSTHOST},rustc,cargo \
336 + --disable-ldconfig \
337 + || die
338 +}
339 +
340 +src_configure() {
341 + cat <<- EOF > "${S}"/config.toml
342 + [llvm]
343 + ninja = true
344 + optimize = $(toml_usex !debug)
345 + release-debuginfo = $(toml_usex debug)
346 + assertions = $(toml_usex debug)
347 + [build]
348 + build = "${RUSTHOST}"
349 + host = ["${RUSTHOST}"]
350 + target = ["${RUSTHOST}"]
351 + cargo = "${WORKDIR}/stage0/bin/cargo"
352 + rustc = "${WORKDIR}/stage0/bin/rustc"
353 + docs = $(toml_usex doc)
354 + compiler-docs = $(toml_usex doc)
355 + submodules = false
356 + python = "${EPYTHON}"
357 + locked-deps = true
358 + vendor = true
359 + verbose = 2
360 + extended = $(toml_usex extended)
361 + [install]
362 + prefix = "${EPREFIX}/usr"
363 + libdir = "$(get_libdir)"
364 + docdir = "share/doc/${P}"
365 + mandir = "share/${P}/man"
366 + [rust]
367 + optimize = $(toml_usex !debug)
368 + debuginfo = $(toml_usex debug)
369 + debug-assertions = $(toml_usex debug)
370 + use-jemalloc = $(toml_usex jemalloc)
371 + default-linker = "$(tc-getCC)"
372 + channel = "${SLOT%%/*}"
373 + rpath = false
374 + optimize-tests = $(toml_usex !debug)
375 + [dist]
376 + src-tarball = false
377 + [target.${RUSTHOST}]
378 + cc = "$(tc-getBUILD_CC)"
379 + cxx = "$(tc-getBUILD_CXX)"
380 + linker = "$(tc-getCC)"
381 + ar = "$(tc-getAR)"
382 + EOF
383 + use system-llvm && cat <<- EOF >> "${S}"/config.toml
384 + llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
385 + EOF
386 +}
387 +
388 +src_compile() {
389 + ./x.py build || die
390 +}
391 +
392 +src_install() {
393 + env DESTDIR="${D}" ./x.py install || die
394 +
395 + rm "${D}/usr/$(get_libdir)/rustlib/components" || die
396 + rm "${D}/usr/$(get_libdir)/rustlib/install.log" || die
397 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-std-${RUSTHOST}" || die
398 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rustc" || die
399 + rm "${D}/usr/$(get_libdir)/rustlib/rust-installer-version" || die
400 + rm "${D}/usr/$(get_libdir)/rustlib/uninstall.sh" || die
401 +
402 + mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die
403 + mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die
404 + mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die
405 + mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die
406 +
407 + if use doc; then
408 + rm "${D}/usr/$(get_libdir)/rustlib/manifest-rust-docs" || die
409 + fi
410 +
411 + rm "${D}/usr/share/doc/${P}/LICENSE-APACHE" || die
412 + rm "${D}/usr/share/doc/${P}/LICENSE-MIT" || die
413 +
414 + docompress "/usr/share/${P}/man"
415 +
416 + cat <<-EOF > "${T}"/50${P}
417 + MANPATH="/usr/share/${P}/man"
418 + EOF
419 + doenvd "${T}"/50${P}
420 +
421 + cat <<-EOF > "${T}/provider-${P}"
422 + /usr/bin/rustdoc
423 + /usr/bin/rust-gdb
424 + /usr/bin/rust-lldb
425 + EOF
426 + dodir /etc/env.d/rust
427 + insinto /etc/env.d/rust
428 + doins "${T}/provider-${P}"
429 +}
430 +
431 +pkg_postinst() {
432 + eselect rust update --if-unset
433 +
434 + elog "Rust installs a helper script for calling GDB and LLDB,"
435 + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
436 +
437 + if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
438 + elog "install app-emacs/rust-mode to get emacs support for rust."
439 + fi
440 +
441 + if has_version app-editors/gvim || has_version app-editors/vim; then
442 + elog "install app-vim/rust-vim to get vim support for rust."
443 + fi
444 +
445 + if has_version 'app-shells/zsh'; then
446 + elog "install app-shells/rust-zshcomp to get zsh completion for rust."
447 + fi
448 +}
449 +
450 +pkg_postrm() {
451 + eselect rust unset --if-invalid
452 +}