aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoro01eg <o01eg@yandex.ru>2020-05-29 08:58:07 +0300
committerMikhail Pukhlikov <cynede@gentoo.org>2020-05-29 11:53:25 +0400
commitc233b56f0828ad116dab5588cc53a1dcec4873b1 (patch)
tree5fe78a407c36e9785a31a1b166c27c53f4390385
parentdev-lang/rust-bin: keywords mask -999 & -9999 ebuilds (diff)
downloadrust-c233b56f0828ad116dab5588cc53a1dcec4873b1.tar.gz
rust-c233b56f0828ad116dab5588cc53a1dcec4873b1.tar.bz2
rust-c233b56f0828ad116dab5588cc53a1dcec4873b1.zip
dev-lang/rust-9999: Synchronize ebuild with stable
Closes: https://github.com/gentoo/gentoo-rust/pull/485 Signed-off-by: Mikhail Pukhlikov <cynede@gentoo.org>
-rw-r--r--dev-lang/rust/files/1.43.1-fix-libdir.patch70
-rw-r--r--dev-lang/rust/rust-9999.ebuild213
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
}