public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/rust:master commit in: dev-lang/rust/files/, dev-lang/rust/
@ 2019-10-31  9:44 Mikhail Pukhlikov
  0 siblings, 0 replies; 2+ messages in thread
From: Mikhail Pukhlikov @ 2019-10-31  9:44 UTC (permalink / raw
  To: gentoo-commits

commit:     324b8f073cf290eb2f227aee92b3368e8046d199
Author:     stefson <herrtimson <AT> yahoo <DOT> de>
AuthorDate: Tue Oct 29 19:34:33 2019 +0000
Commit:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 09:44:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/rust.git/commit/?id=324b8f07

dev-lang/rust: add upstream fix from pr65932

the bootstrap script uses python to extract the stage0, and given that
someone out there's still using python2 for that, it will fail, as there's
no built in support for lzma prior to python-3.4

the updated patch solves this problem, as it detects the used python version
and chooses tar.gz for users of python2 and tar.xz for those of python3

Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
Signed-off-by: Mikhail Pukhlikov <cynede <AT> gentoo.org>

 .../37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch | 46 -------------
 dev-lang/rust/files/pr65932.patch                  | 79 ++++++++++++++++++++++
 dev-lang/rust/rust-999.ebuild                      |  2 +-
 dev-lang/rust/rust-9999.ebuild                     |  2 +-
 4 files changed, 81 insertions(+), 48 deletions(-)

diff --git a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch b/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
deleted file mode 100644
index 6504fbe..0000000
--- a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 37c5cb8118b6de04dd5d4e5e43787c8b83339472 Mon Sep 17 00:00:00 2001
-From: stefson <hidden@yahoo.de>
-Date: Fri, 25 Oct 2019 13:20:03 +0200
-Subject: [PATCH] rust/src/bootstrap.py: change src url from tar.gz to tar.xz
-
----
- src/bootstrap/bootstrap.py | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
-index 4caf36a6f2a5..6c2f522f50d6 100644
---- a/src/bootstrap/bootstrap.py
-+++ b/src/bootstrap/bootstrap.py
-@@ -105,7 +105,7 @@ def verify(path, sha_path, verbose):
- def unpack(tarball, dst, verbose=False, match=None):
-     """Unpack the given tarball file"""
-     print("extracting", tarball)
--    fname = os.path.basename(tarball).replace(".tar.gz", "")
-+    fname = os.path.basename(tarball).replace(".tar.xz", "")
-     with contextlib.closing(tarfile.open(tarball)) as tar:
-         for member in tar.getnames():
-             if "/" not in member:
-@@ -349,12 +349,12 @@ def download_stage0(self):
-                  self.program_out_of_date(self.rustc_stamp())):
-             if os.path.exists(self.bin_root()):
-                 shutil.rmtree(self.bin_root())
--            filename = "rust-std-{}-{}.tar.gz".format(
-+            filename = "rust-std-{}-{}.tar.xz".format(
-                 rustc_channel, self.build)
-             pattern = "rust-std-{}".format(self.build)
-             self._download_stage0_helper(filename, pattern)
- 
--            filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
-+            filename = "rustc-{}-{}.tar.xz".format(rustc_channel, self.build)
-             self._download_stage0_helper(filename, "rustc")
-             self.fix_executable("{}/bin/rustc".format(self.bin_root()))
-             self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
-@@ -372,7 +372,7 @@ def download_stage0(self):
-         if self.cargo().startswith(self.bin_root()) and \
-                 (not os.path.exists(self.cargo()) or
-                  self.program_out_of_date(self.cargo_stamp())):
--            filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
-+            filename = "cargo-{}-{}.tar.xz".format(cargo_channel, self.build)
-             self._download_stage0_helper(filename, "cargo")
-             self.fix_executable("{}/bin/cargo".format(self.bin_root()))
-             with output(self.cargo_stamp()) as cargo_stamp:

diff --git a/dev-lang/rust/files/pr65932.patch b/dev-lang/rust/files/pr65932.patch
new file mode 100644
index 0000000..8d8497a
--- /dev/null
+++ b/dev-lang/rust/files/pr65932.patch
@@ -0,0 +1,79 @@
+From f59c3fdc0906d2af60b52e9d5782f2e3cf39ad03 Mon Sep 17 00:00:00 2001
+From: Guanqun Lu <guanqun.lu@gmail.com>
+Date: Tue, 29 Oct 2019 16:48:05 +0800
+Subject: [PATCH] download .tar.xz if python3 is used
+
+---
+ src/bootstrap/bootstrap.py | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+index 4caf36a6f2a5..efde8bd6ce10 100644
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -102,10 +102,10 @@ def verify(path, sha_path, verbose):
+     return verified
+ 
+ 
+-def unpack(tarball, dst, verbose=False, match=None):
++def unpack(tarball, tarball_suffix, dst, verbose=False, match=None):
+     """Unpack the given tarball file"""
+     print("extracting", tarball)
+-    fname = os.path.basename(tarball).replace(".tar.gz", "")
++    fname = os.path.basename(tarball).replace(tarball_suffix, "")
+     with contextlib.closing(tarfile.open(tarball)) as tar:
+         for member in tar.getnames():
+             if "/" not in member:
+@@ -329,6 +329,7 @@ def __init__(self):
+         self.rust_root = ''
+         self.use_locked_deps = ''
+         self.use_vendored_sources = ''
++        self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz'
+         self.verbose = False
+ 
+     def download_stage0(self):
+@@ -349,12 +350,13 @@ def download_stage0(self):
+                  self.program_out_of_date(self.rustc_stamp())):
+             if os.path.exists(self.bin_root()):
+                 shutil.rmtree(self.bin_root())
+-            filename = "rust-std-{}-{}.tar.gz".format(
+-                rustc_channel, self.build)
++            filename = "rust-std-{}-{}{}".format(
++                rustc_channel, self.build, self.tarball_suffix)
+             pattern = "rust-std-{}".format(self.build)
+             self._download_stage0_helper(filename, pattern)
+ 
+-            filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
++            filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
++                                              self.tarball_suffix)
+             self._download_stage0_helper(filename, "rustc")
+             self.fix_executable("{}/bin/rustc".format(self.bin_root()))
+             self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
+@@ -365,14 +367,15 @@ def download_stage0(self):
+             # libraries/binaries that are included in rust-std with
+             # the system MinGW ones.
+             if "pc-windows-gnu" in self.build:
+-                filename = "rust-mingw-{}-{}.tar.gz".format(
+-                    rustc_channel, self.build)
++                filename = "rust-mingw-{}-{}{}".format(
++                    rustc_channel, self.build, self.tarball_suffix)
+                 self._download_stage0_helper(filename, "rust-mingw")
+ 
+         if self.cargo().startswith(self.bin_root()) and \
+                 (not os.path.exists(self.cargo()) or
+                  self.program_out_of_date(self.cargo_stamp())):
+-            filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
++            filename = "cargo-{}-{}{}".format(cargo_channel, self.build,
++                                              self.tarball_suffix)
+             self._download_stage0_helper(filename, "cargo")
+             self.fix_executable("{}/bin/cargo".format(self.bin_root()))
+             with output(self.cargo_stamp()) as cargo_stamp:
+@@ -388,7 +391,7 @@ def _download_stage0_helper(self, filename, pattern):
+         tarball = os.path.join(rustc_cache, filename)
+         if not os.path.exists(tarball):
+             get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
+-        unpack(tarball, self.bin_root(), match=pattern, verbose=self.verbose)
++        unpack(tarball, self.tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose)
+ 
+     @staticmethod
+     def fix_executable(fname):

diff --git a/dev-lang/rust/rust-999.ebuild b/dev-lang/rust/rust-999.ebuild
index ebb8421..0430773 100644
--- a/dev-lang/rust/rust-999.ebuild
+++ b/dev-lang/rust/rust-999.ebuild
@@ -92,7 +92,7 @@ PATCHES=(
 	"${FILESDIR}"/pr65474.patch
 
 	# upstream issue: https://github.com/rust-lang/rust/issues/65757
-	"${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+	"${FILESDIR}"/pr65932.patch
 	)
 
 S="${WORKDIR}/${MY_P}-src"

diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
index d149a29..6b601e8 100644
--- a/dev-lang/rust/rust-9999.ebuild
+++ b/dev-lang/rust/rust-9999.ebuild
@@ -88,7 +88,7 @@ REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
 
 PATCHES=(
 	# upstream issue: https://github.com/rust-lang/rust/issues/65757
-	"${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+	"${FILESDIR}"/pr65932.patch
 	)
 
 S="${WORKDIR}/${MY_P}-src"


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/proj/rust:master commit in: dev-lang/rust/files/, dev-lang/rust/
@ 2020-05-29  7:53 Mikhail Pukhlikov
  0 siblings, 0 replies; 2+ messages in thread
From: Mikhail Pukhlikov @ 2020-05-29  7:53 UTC (permalink / raw
  To: gentoo-commits

commit:     c233b56f0828ad116dab5588cc53a1dcec4873b1
Author:     o01eg <o01eg <AT> yandex <DOT> ru>
AuthorDate: Fri May 29 05:58:07 2020 +0000
Commit:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
CommitDate: Fri May 29 07:53:25 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/rust.git/commit/?id=c233b56f

dev-lang/rust-9999: Synchronize ebuild with stable

Closes: https://github.com/gentoo/gentoo-rust/pull/485
Signed-off-by: Mikhail Pukhlikov <cynede <AT> gentoo.org>

 dev-lang/rust/files/1.43.1-fix-libdir.patch |  70 +++++++++
 dev-lang/rust/rust-9999.ebuild              | 213 ++++++++++++++++++----------
 2 files changed, 209 insertions(+), 74 deletions(-)

diff --git a/dev-lang/rust/files/1.43.1-fix-libdir.patch b/dev-lang/rust/files/1.43.1-fix-libdir.patch
new file mode 100644
index 0000000..e1dccf3
--- /dev/null
+++ b/dev-lang/rust/files/1.43.1-fix-libdir.patch
@@ -0,0 +1,70 @@
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index eb0199fd020..c33657549ba 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -646,6 +646,7 @@ impl<'a> Builder<'a> {
+     pub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path {
+         match self.config.libdir_relative() {
+             Some(relative_libdir) if compiler.stage >= 1 => relative_libdir,
++            _ if compiler.stage == 0 => &self.build.initial_libdir,
+             _ => Path::new("lib"),
+         }
+     }
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index a476d25f102..7fe4496ca45 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -242,6 +242,7 @@ pub struct Build {
+     initial_rustc: PathBuf,
+     initial_cargo: PathBuf,
+     initial_lld: PathBuf,
++    initial_libdir: PathBuf,
+ 
+     // Runtime state filled in later on
+     // C/C++ compilers and archiver for all targets
+@@ -343,18 +344,38 @@ impl Build {
+         // we always try to use git for LLVM builds
+         let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
+ 
+-        let initial_sysroot = config.initial_rustc.parent().unwrap().parent().unwrap();
+-        let initial_lld = initial_sysroot
+-            .join("lib")
+-            .join("rustlib")
+-            .join(config.build)
+-            .join("bin")
+-            .join("rust-lld");
++        let initial_target_libdir_str = output(
++            Command::new(&config.initial_rustc)
++                .arg("--target")
++                .arg(config.build)
++                .arg("--print")
++                .arg("target-libdir"),
++        );
++        let initial_target_dir = Path::new(&initial_target_libdir_str).parent().unwrap();
++        let initial_lld = initial_target_dir.join("bin").join("rust-lld");
++
++        let initial_sysroot = output(
++            Command::new(&config.initial_rustc)
++                .arg("--print")
++                .arg("sysroot"),
++        );
++        println!("stage0 sysroot: {}", initial_sysroot);
++        let initial_libdir_full = initial_target_dir
++            .parent()
++            .unwrap()
++            .parent()
++            .unwrap();
++        println!("stage0 libdir: {}", initial_libdir_full.display());
++        let initial_libdir = initial_libdir_full
++            .strip_prefix(initial_sysroot.trim())
++            .unwrap()
++            .to_path_buf();
+ 
+         let mut build = Build {
+             initial_rustc: config.initial_rustc.clone(),
+             initial_cargo: config.initial_cargo.clone(),
+             initial_lld,
++            initial_libdir,
+             local_rebuild: config.local_rebuild,
+             fail_fast: config.cmd.fail_fast(),
+             doc_tests: config.cmd.doc_tests(),

diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
index 7e4f356..facf26f 100644
--- a/dev-lang/rust/rust-9999.ebuild
+++ b/dev-lang/rust/rust-9999.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
+PYTHON_COMPAT=( python3_{6,7,8} )
 
-inherit check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs git-r3
+inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs git-r3
 
 SLOT="git"
 MY_P="rust-git"
@@ -24,42 +24,42 @@ HOMEPAGE="https://www.rust-lang.org/"
 RESTRICT="network-sandbox"
 
 ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
-	NVPTX PowerPC Sparc SystemZ WebAssembly X86 XCore )
+	NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
 ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
 LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
 
 LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
 
-IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt system-llvm wasm sanitize miri zsh-completion ${ALL_LLVM_TARGETS[*]}"
+IUSE="clippy cpu_flags_x86_sse2 debug doc libressl miri parallel-compiler rls rustfmt system-llvm wasm sanitize ${ALL_LLVM_TARGETS[*]}"
 
 # Please keep the LLVM dependency block separate. Since LLVM is slotted,
-# we need to *really* make sure we're not pulling one than more slot
+# we need to *really* make sure we're not pulling more than one slot
 # simultaneously.
 
 # How to use it:
 # 1. List all the working slots (with min versions) in ||, newest first.
-# 2. Update the := to specify *max* version, e.g. < 9.
-# 3. Specify LLVM_MAX_SLOT, e.g. 8.
+# 2. Update the := to specify *max* version, e.g. < 11.
+# 3. Specify LLVM_MAX_SLOT, e.g. 10.
 LLVM_DEPEND="
 	|| (
-		sys-devel/llvm:9[llvm_targets_WebAssembly?]
-		wasm? ( >=sys-devel/lld-9 )
+		sys-devel/llvm:10[${LLVM_TARGET_USEDEPS// /,}]
+		sys-devel/llvm:9[${LLVM_TARGET_USEDEPS// /,}]
 	)
-	(
-		sys-devel/llvm:8[llvm_targets_WebAssembly?]
-		wasm? ( >=sys-devel/lld-8 )
-	)
-	<sys-devel/llvm-10:=
+	<sys-devel/llvm-11:=
+	wasm? ( sys-devel/lld )
 "
-LLVM_MAX_SLOT=9
+LLVM_MAX_SLOT=10
 
+# libgit2 should be at least same as bungled into libgit-sys #707746
 COMMON_DEPEND="
-	sys-libs/zlib
+	>=dev-libs/libgit2-0.99:=
+	net-libs/libssh2:=
+	net-libs/http-parser:=
+	net-misc/curl:=[ssl]
+	sys-libs/zlib:=
 	!libressl? ( dev-libs/openssl:0= )
 	libressl? ( dev-libs/libressl:0= )
-	net-libs/libssh2
-	net-libs/http-parser:=
-	net-misc/curl[ssl]
+	elibc_musl? ( sys-libs/libunwind )
 	system-llvm? (
 		${LLVM_DEPEND}
 	)
@@ -71,13 +71,14 @@ DEPEND="${COMMON_DEPEND}
 		>=sys-devel/gcc-4.7
 		>=sys-devel/clang-3.5
 	)
-	dev-util/cmake
+	!system-llvm? (
+		dev-util/cmake
+		dev-util/ninja
+	)
 "
 
 RDEPEND="${COMMON_DEPEND}
 	>=app-eselect/eselect-rust-20190311
-	!dev-util/cargo
-	rustfmt? ( !dev-util/rustfmt )
 "
 
 REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
@@ -86,7 +87,22 @@ REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
 	?? ( system-llvm sanitize )
 "
 
-#PATCHES=( )
+QA_FLAGS_IGNORED="
+	usr/bin/.*-${PV}
+	usr/lib.*/lib.*.so
+	usr/$(get_libdir)/${P}/rustlib/.*/codegen-backends/librustc_codegen_llvm-llvm.so
+	usr/$(get_libdir)/${P}/rustlib/.*/lib/lib.*.so
+"
+
+# tests need a bit more work, currently they are causing multiple
+# re-compilations and somewhat fragile.
+RESTRICT="test network-sandbox"
+
+QA_SONAME="usr/lib.*/librustc_macros.*.so"
+
+PATCHES=(
+	"${FILESDIR}"/1.43.1-fix-libdir.patch
+)
 
 S="${WORKDIR}/${MY_P}-src"
 
@@ -95,10 +111,10 @@ toml_usex() {
 }
 
 pre_build_checks() {
-	CHECKREQS_DISK_BUILD="7G"
+	CHECKREQS_DISK_BUILD="9G"
 	eshopts_push -s extglob
 	if is-flagq '-g?(gdb)?([1-9])'; then
-		CHECKREQS_DISK_BUILD="10G"
+		CHECKREQS_DISK_BUILD="15G"
 	fi
 	eshopts_pop
 	check-reqs_pkg_setup
@@ -109,13 +125,26 @@ pkg_pretend() {
 }
 
 pkg_setup() {
+	# ToDo: write a reason
 	unset SUDO_USER
 
 	pre_build_checks
 	python-any-r1_pkg_setup
+
+	# required to link agains system libs, otherwise
+	# crates use bundled sources and compile own static version
+	export LIBGIT2_SYS_USE_PKG_CONFIG=1
+	export LIBSSH2_SYS_USE_PKG_CONFIG=1
+	export PKG_CONFIG_ALLOW_CROSS=1
+
 	if use system-llvm; then
 		EGIT_SUBMODULES=( "*" "-src/llvm-project" )
 		llvm_pkg_setup
+
+		local llvm_config="$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config"
+
+		export LLVM_LINK_SHARED=1
+		export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
 	fi
 }
 
@@ -141,19 +170,19 @@ src_configure() {
 	fi
 	rust_targets="${rust_targets#,}"
 
-	local extended="true" tools="\"cargo\","
+	local tools="\"cargo\","
 	if use clippy; then
 		tools="\"clippy\",$tools"
 	fi
+	if use miri; then
+		tools="\"miri\",$tools"
+	fi
 	if use rls; then
 		tools="\"rls\",\"analysis\",\"src\",$tools"
 	fi
 	if use rustfmt; then
 		tools="\"rustfmt\",$tools"
 	fi
-	if use miri; then
-		tools="\"miri\",$tools"
-	fi
 
 	local rust_stage0_root="${WORKDIR}"/rust-stage0
 
@@ -164,6 +193,7 @@ src_configure() {
 		optimize = $(toml_usex !debug)
 		release-debuginfo = $(toml_usex debug)
 		assertions = $(toml_usex debug)
+		ninja = true
 		targets = "${LLVM_TARGETS// /;}"
 		experimental-targets = ""
 		link-shared = $(toml_usex system-llvm)
@@ -172,28 +202,42 @@ src_configure() {
 		host = ["${rust_target}"]
 		target = [${rust_targets}]
 		docs = $(toml_usex doc)
+		compiler-docs = $(toml_usex doc)
 		submodules = false
 		python = "${EPYTHON}"
 		locked-deps = true
 		vendor = false
-		sanitizers = $(toml_usex sanitize)
-		extended = ${extended}
+		extended = true
 		tools = [${tools}]
 		verbose = 2
+		sanitizers = $(toml_usex sanitize)
+		profiler = false
+		cargo-native-static = false
 		[install]
 		prefix = "${EPREFIX}/usr"
 		libdir = "$(get_libdir)/${P}"
-		docdir = "share/doc/${P}"
+		docdir = "share/doc/${PF}"
 		mandir = "share/${P}/man"
 		[rust]
-		optimize = $(toml_usex !debug)
-		debuginfo-level = $(usex debug 2 0)
+		optimize = true
+		debug = $(toml_usex debug)
 		debug-assertions = $(toml_usex debug)
+		debuginfo-level-rustc = 0
+		backtrace = true
+		incremental = false
 		default-linker = "$(tc-getCC)"
+		parallel-compiler = $(toml_usex parallel-compiler)
 		rpath = false
+		verbose-tests = true
+		optimize-tests = $(toml_usex !debug)
+		codegen-tests = true
+		dist-src = false
 		ignore-git = false
 		lld = $(usex system-llvm false $(toml_usex wasm))
-		llvm-tools = $(usex system-llvm false true)
+		backtrace-on-ice = true
+		jemalloc = false
+		[dist]
+		src-tarball = false
 	EOF
 
 	for v in $(multilib_get_enabled_abi_pairs); do
@@ -211,30 +255,64 @@ src_configure() {
 			linker = "$(tc-getCC)"
 			ar = "$(tc-getAR)"
 		EOF
+		# librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
+		if use elibc_musl; then
+			cat <<- EOF >> "${S}"/config.toml
+				crt-static = false
+			EOF
+		fi
 		if use system-llvm; then
 			cat <<- EOF >> "${S}"/config.toml
 				llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
 			EOF
 		fi
 	done
-
 	if use wasm; then
 		cat <<- EOF >> "${S}"/config.toml
 			[target.wasm32-unknown-unknown]
 			linker = "$(usex system-llvm lld rust-lld)"
 		EOF
 	fi
+
+	einfo "Rust configured with the following settings:"
+	cat "${S}"/config.toml || die
 }
 
 src_compile() {
-	env $(cat "${S}"/config.env)\
+	env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
 		"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
 }
 
+src_test() {
+	env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
+		"${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml -j$(makeopts_jobs) --no-doc --no-fail-fast \
+		src/test/codegen \
+		src/test/codegen-units \
+		src/test/compile-fail \
+		src/test/incremental \
+		src/test/mir-opt \
+		src/test/pretty \
+		src/test/run-fail \
+		src/test/run-make \
+		src/test/run-make-fulldeps \
+		src/test/ui \
+		src/test/ui-fulldeps || die
+}
+
 src_install() {
 	local rust_target abi_libdir
 
-	env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv -j$(makeopts_jobs) --config="${S}"/config.toml || die
+	env $(cat "${S}"/config.env) DESTDIR="${D}" \
+		"${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
+
+	# bug #689562, #689160
+	rm "${D}/etc/bash_completion.d/cargo" || die
+	rmdir "${D}"/etc{/bash_completion.d,} || die
+	dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
+
+	# fix collision with stable rust #675026
+	rmdir "${ED}"/usr/share/bash-completion/completions/cargo || die
+	rmdir "${ED}"/usr/share/zsh/site-functions/_cargo || die
 
 	mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
 	mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
@@ -246,6 +324,10 @@ src_install() {
 		mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
 		mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
 	fi
+	if use miri; then
+		mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die
+		mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die
+	fi
 	if use rls; then
 		mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
 	fi
@@ -253,29 +335,11 @@ src_install() {
 		mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
 		mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
 	fi
-	if use miri; then
-		mv "${ED}/usr/bin/miri" "${ED}/usr/bin/miri-${PV}" || die
-		mv "${ED}/usr/bin/cargo-miri" "${ED}/usr/bin/cargo-miri-${PV}" || die
-	fi
-	if ! use zsh-completion; then
-		rm "${ED}/usr/share/zsh/site-functions/_cargo" # fix https://bugs.gentoo.org/675026
-	fi
-
-	# Copy shared library versions of standard libraries for all targets
-	# into the system's abi-dependent lib directories because the rust
-	# installer only does so for the native ABI.
-	for v in $(multilib_get_enabled_abi_pairs); do
-		if [ ${v##*.} = ${DEFAULT_ABI} ]; then
-			continue
-		fi
-		abi_libdir=$(get_abi_LIBDIR ${v##*.})
-		rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
-		mkdir -p "${ED}/usr/${abi_libdir}/${P}"
-		cp "${ED}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
-		   "${ED}/usr/${abi_libdir}/${P}" || die
-	done
 
 	dodoc COPYRIGHT
+	rm "${ED}/usr/share/doc/${P}"/*.old || die
+	rm "${ED}/usr/share/doc/${P}/LICENSE-APACHE" || die
+	rm "${ED}/usr/share/doc/${P}/LICENSE-MIT" || die
 
 	cat <<-EOF > "${T}"/50${P}
 		LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}"
@@ -283,23 +347,27 @@ src_install() {
 	EOF
 	if use rls; then
 		cat <<-EOF >> "${T}"/50${P}
-		RUST_SRC_PATH="${EPREFIX}/usr/$(get_libdir)/${P}/rustlib/src/rust/src/"
+		RUST_SRC_PATH="${EPREFIX}/usr/lib/${P}/rustlib/src/rust/src/"
 		EOF
 	fi
 	doenvd "${T}"/50${P}
 
 	# note: eselect-rust adds EROOT to all paths below
 	cat <<-EOF > "${T}/provider-${P}"
+		/usr/bin/cargo
 		/usr/bin/rustdoc
 		/usr/bin/rust-gdb
 		/usr/bin/rust-gdbgui
 		/usr/bin/rust-lldb
 	EOF
-	echo /usr/bin/cargo >> "${T}/provider-${P}"
 	if use clippy; then
 		echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
 		echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
 	fi
+	if use miri; then
+		echo /usr/bin/miri >> "${T}/provider-${P}"
+		echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
+	fi
 	if use rls; then
 		echo /usr/bin/rls >> "${T}/provider-${P}"
 	fi
@@ -307,11 +375,7 @@ src_install() {
 		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
 		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
 	fi
-	if use miri; then
-		echo /usr/bin/miri >> "${T}/provider-${P}"
-		echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
-	fi
-	dodir /etc/env.d/rust
+
 	insinto /etc/env.d/rust
 	doins "${T}/provider-${P}"
 }
@@ -322,11 +386,7 @@ pkg_postinst() {
 	elog "Rust installs a helper script for calling GDB and LLDB,"
 	elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
 
-	ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
-	ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
-	ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
-
-	if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
+	if has_version app-editors/emacs; then
 		elog "install app-emacs/rust-mode to get emacs support for rust."
 	fi
 
@@ -334,8 +394,13 @@ pkg_postinst() {
 		elog "install app-vim/rust-vim to get vim support for rust."
 	fi
 
-	if has_version 'app-shells/zsh'; then
-		elog "install app-shells/rust-zshcomp to get zsh completion for rust."
+	if use elibc_musl; then
+		ewarn "${PN} on *-musl targets is configured with crt-static"
+		ewarn ""
+		ewarn "you will need to set RUSTFLAGS=\"-C target-feature=-crt-static\" in make.conf"
+		ewarn "to use it with portage, otherwise you may see failures like"
+		ewarn "error: cannot produce proc-macro for serde_derive v1.0.98 as the target "
+		ewarn "x86_64-unknown-linux-musl does not support these crate types"
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-29  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-29  7:53 [gentoo-commits] repo/proj/rust:master commit in: dev-lang/rust/files/, dev-lang/rust/ Mikhail Pukhlikov
  -- strict thread matches above, loose matches on Subject: below --
2019-10-31  9:44 Mikhail Pukhlikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox