dev-lang/rust: bump to 1.36.0
authorGeorgy Yakovlev <gyakovlev@gentoo.org>
Mon, 8 Jul 2019 03:00:02 +0000 (20:00 -0700)
committerGeorgy Yakovlev <gyakovlev@gentoo.org>
Mon, 8 Jul 2019 23:01:19 +0000 (16:01 -0700)
couple of important fixes
also it now installs i686 libs to /usr/lib/${PN} on multilib

Bug: https://bugs.gentoo.org/672816
Bug: https://bugs.gentoo.org/679806

Package-Manager: Portage-2.3.68, Repoman-2.3.16
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
dev-lang/rust/Manifest
dev-lang/rust/files/1.34.2-fix-custom-libdir.patch [new file with mode: 0644]
dev-lang/rust/rust-1.36.0.ebuild [new file with mode: 0644]

index 7a682486576d26d3edb5abff563e9745d075d865..dd56cf989a0b60e8f4833fd6b890c147c2df845d 100644 (file)
@@ -24,5 +24,19 @@ DIST rust-1.34.2-powerpc64-unknown-linux-gnu.tar.xz 125735384 BLAKE2B c25d43fa63
 DIST rust-1.34.2-powerpc64le-unknown-linux-gnu.tar.xz 129619832 BLAKE2B df76b7c08941ae2cb512ba656b09a7b87e1e656badbadf58d64ab5f9133e7248a63873675ac44f16207107a0f68da6089706b46af94154c0bd51aed655f8b578 SHA512 3c881e7bcf622237f279855ebaeb544f4df9bfe5bc1f74578093d67befed8f027692ea56dc773c653bef8a124e9ebac2544d0c197a0e3a1ec8da63ef9d434412
 DIST rust-1.34.2-s390x-unknown-linux-gnu.tar.xz 134376720 BLAKE2B 3eb1452bc0f5d6cbe5547f18ad039c54d4fee44e8c24e35f3399272755cd293df008db2c7dded32c7853944e43de7a4d337b7408835445a4916dbf55d14a7b3e SHA512 181f58b00cdccb205be853f5d00fc0a0c939b7e4dc801717b21ece0f714a8f3b501f1196eb2e3f3081932a0417a6218763c3d095cdd036e9f202cc41291876a1
 DIST rust-1.34.2-x86_64-unknown-linux-gnu.tar.xz 157279864 BLAKE2B c25fcb6168e16a4deb19a8ca9b3d91966194f4c8d2e60933226fab015b64a819f6e56a6b51b6e9457ce80efaf5bf71f2eed2f3e6e39bef5856524e33d0a5637b SHA512 64d6b7da08ffd877c10d819605a37b0bc178c4ab80e2f7449f3d5ac9254a438e148da3729408b4c9429ed499d7f142c9d2926f5c916e0a32bebaaefe4b0a09a6
+DIST rust-1.35.0-aarch64-unknown-linux-gnu.tar.xz 132705960 BLAKE2B 134e71195a69f891d7b60bd2ad24468beb0796480d2a48707058b085a6f9255bc092578015be89dd29cebbf1b5f49221735dcedd0cb79a1975220531e5f4d364 SHA512 9231e4acf26dc19a31c6c9623c939eafd0fdefc18debb8569baae36d3ad3410e21097ae2306b5adc48bc5e219da1dc1df38569e1d0ae9b0178d5a2e815c20db8
+DIST rust-1.35.0-arm-unknown-linux-gnueabi.tar.xz 134286432 BLAKE2B 3cc7e664e4d59f0a7ec5153b67c95ccd78c40b2d32a30f2082d8c8370d9e41a47d9e60b0b1182a4e4f8d0e81fb276a16092e4c7911da4479ef0998b0d36ac273 SHA512 e16a4484e1788b4b2cd14482c7717fbc3cfc0b38cf0a483ad4d1bba174ba8b9e631cb6a04fd442e05ee6c9c8291dc344c64b0ced10e342bf75c9ad6b63480723
+DIST rust-1.35.0-arm-unknown-linux-gnueabihf.tar.xz 134633256 BLAKE2B 0487f81ea9635c037a601cce5a55dc4f54eb14adef5056e3e2e83086fa0a4384e92179cbe3ae476d0b9a7e0860a718265fa0261f6dd762444812e3263037e18e SHA512 229d206f30387109649a434c23a8b9af14c2942691cba3a22ca3d76ca76942bd0ad44e0660dd72bdd9a00214a9fa6c140691bd5dd879af35cf2abf9f4a7cbac8
+DIST rust-1.35.0-armv7-unknown-linux-gnueabihf.tar.xz 136384068 BLAKE2B db8ba39772e150d829cb9c86f20c89c09b1c6a2c996fe5300e265704a0557e8cd879690ede2f03e4ba03d5201a368c65b53a471d581e7ae95646b50992fd4fa8 SHA512 4d80fdc7483566999d8c38b6772c1f1c6cf0f537f68bff9dd9ed68931afab569e02fc9d5ed2999fb1d3478113527840676d903630f93c3d79c30fdba0b98a2bb
+DIST rust-1.35.0-i686-unknown-linux-gnu.tar.xz 173765732 BLAKE2B f55ffa1742bc68c733d8392cafe592a937f0a07e3dd50b63aa7479839c0f18d1eecabe897d962635f5dca669053a7a28b5dc2c7d736f581dad9d7ed508bf5ddc SHA512 33a603f638ced850c4572cc81041b1ab47d95a062c66ea24695e449cca7ac6353757c794a85af4a15e43e0ce091c7cc47dbd01fd30e23e1bae6ced194a08a667
+DIST rust-1.35.0-mips-unknown-linux-gnu.tar.xz 126071936 BLAKE2B d0c34edac3e3a36e096efc51116b5073dc7bbbceee6373c2c9720150fe64a6d1e19450590f63b89111f7e93b72af3cc838215a153fbd069d6a66236ce65265f9 SHA512 a70490da14da69c7700c446925875babd8bf6ba0f81c4bf3b838676439a88be1d7cc49290b265f56fad84c8d31fc95c90a46164feeed5b7853751eb71678ad5c
+DIST rust-1.35.0-mips64-unknown-linux-gnuabi64.tar.xz 135622404 BLAKE2B 63c4334c08a774a47712ff5781ebebb0ecef828ad26542f22e96a74ae31ca2ac946b02f835403596bb00ba3d6d4bd7b736a34626e97d43aef631b936bdc0d467 SHA512 cd5525846129eaa09ebf8c91ff5ec098241ba3c75539d09d415b09945c18d60cafacce6263def1c3c647cceb28750fac7f2210366a8a8f3e8b30c4e4dd79f96f
+DIST rust-1.35.0-mipsel-unknown-linux-gnu.tar.xz 128447920 BLAKE2B 896586031be5be6cf8f2b1d9729a594f99b42c8af72ab1e91c45b2716dd70279c6126290209262175e26ba12a9644fc7007f640155aebc226c568684256113c7 SHA512 42a3828eb1124fde0026be35885034dbcafedaa0ccc02202778f488e89dc4c3f5085341f5892f46f74f4dd2c541c579470ca25ba7315c2316bff7e7a293f2340
+DIST rust-1.35.0-powerpc-unknown-linux-gnu.tar.xz 128414412 BLAKE2B 4bedb0d572c615d763a0d2c21aea60b59b985193cd43c4d649b8c945728d65606ba3f40f4a0a2fd0524bbe8a4895787efabc6fe4517b070e321f2a2588b06740 SHA512 ea9b908f3ddc1b659b1dcdfa937bda410a2778f2133c797258eac46b73b7f44a0ab12d99a02549f8dd4de243bf3ddbe4279f132a8cb66389ed30af3cf7692652
+DIST rust-1.35.0-powerpc64-unknown-linux-gnu.tar.xz 139462276 BLAKE2B b99ee8f5f0f372f975e1f690a9e2dea67840220a3f893189672e004045332cecf1823fba3d155348a70c200649a8ff7891bf08fe2f726e69003a71165ea8dfa5 SHA512 a89094b58ffdb4940e51c4c2e5f5efa094d7d6c1a2b2382397dbfb05eeaf99e9329a8e7c51da602a6b8935ebb4f6df475a1873748139d9f9a97b8bd40c49849b
+DIST rust-1.35.0-powerpc64le-unknown-linux-gnu.tar.xz 143826544 BLAKE2B ff5f814515034b382faf40dc0d95623ec57c4f063ded1bb89364594736269744f5409c978de24fa29f6a061d1489179456a90847f5ce8de1f684df22fda68b75 SHA512 3b63dac50a92693d13066aa6e96de05fceb2da6c07834adfab8c12e6a78f59051dfa008062b1d2ad410a009e2164fc716d689231e552379e419161d1620d0066
+DIST rust-1.35.0-s390x-unknown-linux-gnu.tar.xz 152808372 BLAKE2B 96a1e2b96b6a1faf5a3125494b17c4d5f95ea618a5ff8f7ddb7506ebef4fd6cf7f9a2ae961657b7b969a5f3cbc870c805c6634163e7f5fc71e058ea4528e19a0 SHA512 11539eb25e474bbaa8e57f21c3f64506859bc86baec74df24bb4aaf5361745840b82ff715fc54fbd6ba654a8f7fd4f064af0538b983dd489cd69498bd70d1bf7
+DIST rust-1.35.0-x86_64-unknown-linux-gnu.tar.xz 161491264 BLAKE2B ed336829cfe4199750798352e4e338f307033ea0eb5db9ab68f9cf7465d86edbd1218d3e929c775822fd5db3d73a5d75c6e9b5ca45ed6b474bffe403f39f71a0 SHA512 49976ac2fbac5b1709c4a7f3785eb99ab827464ec4d99ee7190df16c3be23e98de606566b57df2231a15097c7fe984e0d19496ce7478ccc1f0f2c7aeb32ecb04
 DIST rustc-1.34.2-src.tar.xz 95048792 BLAKE2B e81e4bfda87ddfb09ab8a74792346970aa440c678d2bb1279c329db4929282f761ada6fea9d81ceeecfd513613025c8e636487626fc36bd0b33559e045bb1b15 SHA512 f1bd2b226d90aae8a4657e6117b9a8451d4ce8129f79cc0fce0da7613a3b7800e690bc0ede8fec20a2f5f32c13fa8e22ac97d3838e0d36936793535a75d9c381
 DIST rustc-1.35.0-src.tar.xz 96543548 BLAKE2B 0291152f2b7aa8b50b22d74afbd9c7654bab8ae7dcb76224dbff43bc39a3b918ff86bfd20f408a9a16da8b20b08d9f0289bb63620f093d25d9fa008de57f52c3 SHA512 477c10b780bd54776be7ecbda0ab970416253e4a87c3e701825a7d07bcbcd91601b8e61129c5d04d4259e89c2e81e87cdbdee853375a8de5c9cf8372be2c9129
+DIST rustc-1.36.0-src.tar.xz 98707920 BLAKE2B caff82482589941ab63be51eeffdf2a0419c1b624485240a0547b4bebc9f64f6c65a4babb960d1b23b3cde76550390d6d4813e1e9a9c43bf325998c87832fb94 SHA512 1adbb3b67d599f926dc19258e2596cb3b990e152e75e71645637098526207aa5632d7915fd5b67c7a045f63860cc7be3d28be014ad6141a342adc16b2fe8a879
diff --git a/dev-lang/rust/files/1.34.2-fix-custom-libdir.patch b/dev-lang/rust/files/1.34.2-fix-custom-libdir.patch
new file mode 100644 (file)
index 0000000..2856d98
--- /dev/null
@@ -0,0 +1,36 @@
+From c1aa2a464ed1a0fa2430a1e604fe6a3b9d785048 Mon Sep 17 00:00:00 2001
+From: O01eg <o01eg@yandex.ru>
+Date: Mon, 8 Jul 2019 22:49:24 +0300
+Subject: [PATCH] Fix double resolving custom libdir
+
+---
+ src/bootstrap/dist.rs | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index 45bc77ec97d4..5ddd1c3da949 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -485,7 +485,9 @@ impl Step for Rustc {
+                     let name = entry.file_name();
+                     if let Some(s) = name.to_str() {
+                         if is_dylib(s) {
+-                            builder.install(&entry.path(), &image.join(&libdir_relative), 0o644);
++                            // Don't use custom libdir here because ^lib/ will be resolved again
++                            // with installer
++                            builder.install(&entry.path(), &image.join("lib"), 0o644);
+                         }
+                     }
+                 }
+@@ -493,8 +495,9 @@ impl Step for Rustc {
+             // Copy over the codegen backends
+             let backends_src = builder.sysroot_codegen_backends(compiler);
+-            let backends_rel = backends_src.strip_prefix(&src).unwrap();
+-            let backends_dst = image.join(&backends_rel);
++            let backends_rel = backends_src.strip_prefix(&libdir).unwrap();
++            // Don't use custom libdir here because ^lib/ will be resolved again with installer
++            let backends_dst = image.join("lib").join(&backends_rel);
+             t!(fs::create_dir_all(&backends_dst));
+             builder.cp_r(&backends_src, &backends_dst);
diff --git a/dev-lang/rust/rust-1.36.0.ebuild b/dev-lang/rust/rust-1.36.0.ebuild
new file mode 100644 (file)
index 0000000..bdb8513
--- /dev/null
@@ -0,0 +1,325 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
+
+inherit check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
+
+if [[ ${PV} = *beta* ]]; then
+       betaver=${PV//*beta}
+       BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
+       MY_P="rustc-beta"
+       SLOT="beta/${PV}"
+       SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
+else
+       ABI_VER="$(ver_cut 1-2)"
+       SLOT="stable/${ABI_VER}"
+       MY_P="rustc-${PV}"
+       SRC="${MY_P}-src.tar.xz"
+       KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+fi
+
+RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
+
+DESCRIPTION="Systems programming language from Mozilla"
+HOMEPAGE="https://www.rust-lang.org/"
+
+SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz
+       $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION})"
+
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
+       NVPTX PowerPC 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 ${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
+# 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.
+LLVM_DEPEND="
+       || (
+               sys-devel/llvm:8[llvm_targets_WebAssembly?]
+               wasm? ( =sys-devel/lld-8* )
+       )
+       <sys-devel/llvm-9:=
+"
+LLVM_MAX_SLOT=8
+
+COMMON_DEPEND="
+       sys-libs/zlib
+       !libressl? ( dev-libs/openssl:0= )
+       libressl? ( dev-libs/libressl:0= )
+       net-libs/libssh2
+       net-libs/http-parser:=
+       net-misc/curl[ssl]
+       system-llvm? (
+               ${LLVM_DEPEND}
+       )
+"
+
+DEPEND="${COMMON_DEPEND}
+       ${PYTHON_DEPS}
+       || (
+               >=sys-devel/gcc-4.7
+               >=sys-devel/clang-3.5
+       )
+       dev-util/cmake
+"
+
+RDEPEND="${COMMON_DEPEND}
+       >=app-eselect/eselect-rust-20190311
+       !dev-util/cargo
+       rustfmt? ( !dev-util/rustfmt )
+"
+
+REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
+       wasm? ( llvm_targets_WebAssembly )
+       x86? ( cpu_flags_x86_sse2 )
+"
+
+PATCHES=(
+       "${FILESDIR}"/0001-llvm-cmake-Add-additional-headers-only-if-they-exist.patch
+       "${FILESDIR}"/1.34.2-fix-custom-libdir.patch
+       "${FILESDIR}"/1.35.0-revert-commits-triggering-multiple-llvm-rebuilds.patch
+)
+
+S="${WORKDIR}/${MY_P}-src"
+
+toml_usex() {
+       usex "$1" true false
+}
+
+pre_build_checks() {
+       CHECKREQS_DISK_BUILD="7G"
+       eshopts_push -s extglob
+       if is-flagq '-g?(gdb)?([1-9])'; then
+               CHECKREQS_DISK_BUILD="10G"
+       fi
+       eshopts_pop
+       check-reqs_pkg_setup
+}
+
+pkg_pretend() {
+       pre_build_checks
+}
+
+pkg_setup() {
+       pre_build_checks
+       python-any-r1_pkg_setup
+       use system-llvm && llvm_pkg_setup
+}
+
+src_prepare() {
+       local rust_stage0_root="${WORKDIR}"/rust-stage0
+
+       local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)"
+
+       "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die
+
+       default
+}
+
+src_configure() {
+       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
+               rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
+       done
+       if use wasm; then
+               rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
+       fi
+       rust_targets="${rust_targets#,}"
+
+       local extended="true" tools="\"cargo\","
+       if use clippy; then
+               tools="\"clippy\",$tools"
+       fi
+       if use rls; then
+               tools="\"rls\",\"analysis\",\"src\",$tools"
+       fi
+       if use rustfmt; then
+               tools="\"rustfmt\",$tools"
+       fi
+
+       local rust_stage0_root="${WORKDIR}"/rust-stage0
+
+       rust_target="$(rust_abi)"
+
+       cat <<- EOF > "${S}"/config.toml
+               [llvm]
+               optimize = $(toml_usex !debug)
+               release-debuginfo = $(toml_usex debug)
+               assertions = $(toml_usex debug)
+               targets = "${LLVM_TARGETS// /;}"
+               experimental-targets = ""
+               link-shared = $(toml_usex system-llvm)
+               [build]
+               build = "${rust_target}"
+               host = ["${rust_target}"]
+               target = [${rust_targets}]
+               cargo = "${rust_stage0_root}/bin/cargo"
+               rustc = "${rust_stage0_root}/bin/rustc"
+               docs = $(toml_usex doc)
+               submodules = false
+               python = "${EPYTHON}"
+               locked-deps = true
+               vendor = true
+               extended = ${extended}
+               tools = [${tools}]
+               verbose = 2
+               [install]
+               prefix = "${EPREFIX}/usr"
+               libdir = "$(get_libdir)/${P}"
+               docdir = "share/doc/${P}"
+               mandir = "share/${P}/man"
+               [rust]
+               optimize = $(toml_usex !debug)
+               debuginfo = $(toml_usex debug)
+               debug-assertions = $(toml_usex debug)
+               default-linker = "$(tc-getCC)"
+               channel = "stable"
+               rpath = false
+               lld = $(usex system-llvm false $(toml_usex wasm))
+       EOF
+
+       for v in $(multilib_get_enabled_abi_pairs); do
+               rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
+               arch_cflags="$(get_abi_CFLAGS ${v##*.})"
+
+               cat <<- EOF >> "${S}"/config.env
+                       CFLAGS_${rust_target}=${arch_cflags}
+               EOF
+
+               cat <<- EOF >> "${S}"/config.toml
+                       [target.${rust_target}]
+                       cc = "$(tc-getBUILD_CC)"
+                       cxx = "$(tc-getBUILD_CXX)"
+                       linker = "$(tc-getCC)"
+                       ar = "$(tc-getAR)"
+               EOF
+               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
+}
+
+src_compile() {
+       env $(cat "${S}"/config.env)\
+               "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
+               --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
+}
+
+src_install() {
+       local rust_target abi_libdir
+
+       env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
+       --exclude src/tools/miri || die
+
+       mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
+       mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
+       mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
+       mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
+       mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
+       mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
+       if use clippy; then
+               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 rls; then
+               mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
+       fi
+       if use rustfmt; then
+               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
+
+       # 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
+
+       # FIXME:
+       # Really not sure if that env is needed, specailly LDPATH
+       cat <<-EOF > "${T}"/50${P}
+               LDPATH="${EPREFIX}/usr/$(get_libdir)/${P}"
+               MANPATH="${EPREFIX}/usr/share/${P}/man"
+       EOF
+       doenvd "${T}"/50${P}
+
+       # note: eselect-rust adds EROOT to all paths below
+       cat <<-EOF > "${T}/provider-${P}"
+               /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 rls; then
+               echo /usr/bin/rls >> "${T}/provider-${P}"
+       fi
+       if use rustfmt; then
+               echo /usr/bin/rustfmt >> "${T}/provider-${P}"
+               echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
+       fi
+       dodir /etc/env.d/rust
+       insinto /etc/env.d/rust
+       doins "${T}/provider-${P}"
+}
+
+pkg_postinst() {
+       eselect rust update --if-unset
+
+       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
+               elog "install app-emacs/rust-mode to get emacs support for rust."
+       fi
+
+       if has_version app-editors/gvim || has_version app-editors/vim; then
+               elog "install app-vim/rust-vim to get vim support for rust."
+       fi
+}
+
+pkg_postrm() {
+       eselect rust cleanup
+}