summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirkjan Ochtman <djc@gentoo.org>2018-11-15 10:27:27 +0100
committerDirkjan Ochtman <djc@gentoo.org>2018-11-15 10:27:45 +0100
commit3a5b9598e49664cf3b11fb276adae40093c40d9e (patch)
tree5a95a4619e094eddf975bf4a2d8d9293b3582c4d
parentdev-util/checkbashisms: Removed old. (diff)
downloadgentoo-3a5b9598e49664cf3b11fb276adae40093c40d9e.tar.gz
gentoo-3a5b9598e49664cf3b11fb276adae40093c40d9e.tar.bz2
gentoo-3a5b9598e49664cf3b11fb276adae40093c40d9e.zip
dev-lang/rust: fix inconsistency, optionally use system LLVM
Fixes: https://bugs.gentoo.org/663240 Signed-off-by: Dirkjan Ochtman <djc@gentoo.org> Package-Manager: Portage-2.3.51, Repoman-2.3.11
-rw-r--r--dev-lang/rust/metadata.xml1
-rw-r--r--dev-lang/rust/rust-1.30.1-r1.ebuild22
2 files changed, 15 insertions, 8 deletions
diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml
index c6a534bebad..cd1133751de 100644
--- a/dev-lang/rust/metadata.xml
+++ b/dev-lang/rust/metadata.xml
@@ -8,6 +8,7 @@
<use>
<flag name="cargo">Install cargo component</flag>
<flag name="clippy">Install clippy component</flag>
+ <flag name="system-llvm">Use the system LLVM install</flag>
<flag name="rls">Install rls component</flag>
<flag name="rustfmt">Install rustfmt component</flag>
<flag name="wasm">Build support for the wasm32-unknown-unknown
diff --git a/dev-lang/rust/rust-1.30.1-r1.ebuild b/dev-lang/rust/rust-1.30.1-r1.ebuild
index 17118cfdb50..39efcc08a62 100644
--- a/dev-lang/rust/rust-1.30.1-r1.ebuild
+++ b/dev-lang/rust/rust-1.30.1-r1.ebuild
@@ -5,7 +5,7 @@ EAPI=6
PYTHON_COMPAT=( python2_7 python3_{5,6} pypy )
-inherit eapi7-ver multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
+inherit eapi7-ver llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
@@ -36,7 +36,7 @@ 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 +jemalloc libressl rls rustfmt wasm ${ALL_LLVM_TARGETS[*]}"
+IUSE="clippy cpu_flags_x86_sse2 debug doc +jemalloc libressl rls rustfmt system-llvm wasm ${ALL_LLVM_TARGETS[*]}"
COMMON_DEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
jemalloc? ( dev-libs/jemalloc )
@@ -45,7 +45,8 @@ COMMON_DEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
- net-misc/curl[ssl]"
+ net-misc/curl[ssl]
+ system-llvm? ( >=sys-devel/llvm-6:= )"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
@@ -78,7 +79,7 @@ src_prepare() {
}
src_configure() {
- local rust_target="" rust_targets="" rust_target_name arch_cflags
+ local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
@@ -110,6 +111,7 @@ src_configure() {
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
+ link-shared = $(toml_usex system-llvm)
[build]
build = "${rust_target}"
host = ["${rust_target}"]
@@ -140,7 +142,7 @@ src_configure() {
EOF
for v in $(multilib_get_enabled_abi_pairs); do
- rust_target=$(get_abi_CHOST ${v##*.})
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
@@ -154,6 +156,11 @@ src_configure() {
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
+ if use system-llvm; then
+ cat <<- EOF >> "${S}"/config.toml
+ llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
+ EOF
+ fi
done
if use wasm; then
@@ -200,10 +207,9 @@ src_install() {
continue
fi
abi_libdir=$(get_abi_LIBDIR ${v##*.})
- rust_target=$(get_abi_CHOST ${v##*.})
- rust_abi=$(rust_abi $rust_target)
+ rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
mkdir -p "${D}/usr/${abi_libdir}"
- cp "${D}/usr/$(get_libdir)/${P}/rustlib/${rust_abi}/lib"/*.so \
+ cp "${D}/usr/$(get_libdir)/${P}/rustlib/${rust_target}/lib"/*.so \
"${D}/usr/${abi_libdir}" || die
done