parlay

yet another gentoo overlay
git clone https://git.parazyd.org/parlay
Log | Files | Refs | README

commit 5fb8bc5777e4e0337b40bc684d336de855c57408
parent fe4d6b20b42f10933a1ebd3ba696bf3d8d3e83eb
Author: parazyd <parazyd@dyne.org>
Date:   Sun,  9 Dec 2018 14:12:34 +0100

dev-lang/rust: Update to 1.31.0

Diffstat:
Mdev-lang/rust/Manifest | 8++++----
Ddev-lang/rust/rust-1.29.2-r1.ebuild | 317-------------------------------------------------------------------------------
Adev-lang/rust/rust-1.31.0.ebuild | 317+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 321 insertions(+), 321 deletions(-)

diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest @@ -1,4 +1,4 @@ -DIST rust-1.28.0-aarch64-unknown-linux-gnu.tar.xz 98937652 BLAKE2B 836d3dd4e583fa50dd317c3bea56257e6ea19defdb38c16be6debb2854e147c8a92c4832263e4ac314136022a176526fe7d3774a3c5a84cd8d364cd2a1532860 SHA512 8d9acbc90ddaa1e0de0234a21798b19b5365ea371a12f9a143c6ebacbb48f57344da6e827e867513be502bce2801de27a0dbbacdf8618c653aeb58026b6c469c -DIST rust-1.28.0-i686-unknown-linux-gnu.tar.xz 136925948 BLAKE2B 85d9239533920c3f16d7c61bada0caeabceceade29032b70bb4562bfd04fa0158cdd85b8a0a1119506416fa5916ade8a0466bf6c10da457299a6319aa25f9dd6 SHA512 ffdfab46db14f07354b553e02fdb9dc6602c2c52b78d8f17c499f4ddb1e257aa53479df836eb3f06a2548d34296b0277cdb6b4c6f3cec57265823df22752c135 -DIST rust-1.28.0-x86_64-unknown-linux-musl.tar.xz 141237344 BLAKE2B 7f10f6b8fd9d800767711ce8d66f288727514808ad40a9c75ca9bf5befa301e6a7d6d0e1cb7c60e01b3f03bf2e4517193cd297e191e6c2d3baaf34dcbfd7ef2e SHA512 939d43281ae4c90a55d7c0be85b33a0da73b6a9b84766dc83ee3817883d0f3d92f27c882b119a0db2adc60770ec8dc5353a7d2df99a3bf037983c86312d8884b -DIST rustc-1.29.2-src.tar.xz 61888912 BLAKE2B f59b0bf45caa6f6136f92ffbaa612bbc6a340c8694ec69d75aadace9180c36753f985641915524388b52cc108f8f5b71840ee3a6c0b1fcff6decb61d2d8a161e SHA512 d8fa9501764348ace8f60f2069bcd016925abe56c8bbc2b87fb52ff796e4bc7284c1fccbb1671416437bb82fde7d9240eeae875d6099914e27e75cfe050e2d38 +DIST rust-1.30.1-aarch64-unknown-linux-gnu.tar.xz 114223904 BLAKE2B ca3f93d8cb59f5ecc8680ab018f8666a5c0df1bf671af4220c39178a946ce77a05588d91709facd42a1d693120c46c472c4d6dc0b6a5e7d3330b9f0807ff3fcc SHA512 5fb9cb0281cd76b1995bcd6c4dd824f8a4d4c1ffc61a0a54f62b45340b98a7b41cf5ec3d4a8ec370c2603c14f9dc5451ae1a47ea96ebbd520770dfd22cf0ffdc +DIST rust-1.30.1-i686-unknown-linux-gnu.tar.xz 143689500 BLAKE2B 0b654570e295c785b074625c8fe7649e1841327fba790e38e08e912ad0602440e08a205318e637c903989bd19bab4c0a726583f2ab457d75ff71e96524251aa0 SHA512 66c56107fd8c83f9c1948137aee09c67633f6f472823696719a22b5f0b0e28925b0a6b6545b8fe4d741b8473ddc49db30fe112fc5b0e6fc63439901ff5462a86 +DIST rust-1.30.1-x86_64-gentoo-linux-musl.tar.xz 96885576 BLAKE2B 403f73bb45bcce9ec85a9b1d5abe2053b6b3f97ea90e1326df61d788cad5fc43c850d30f0b023b6bcf5208a8f0fa13d202cc4ecb0754b7990b507d24ab4a1c5f SHA512 8310497433d1fb11dbb7e579354dbb30c316dbbd3db066ff3b059844f8c7169ab825f94fc48d0f7ed1339b823129d2cb10865abc656edca2e6bd4c914fb56bf5 +DIST rustc-1.31.0-src.tar.xz 96914112 BLAKE2B 5e4c5d7724033c756f57794bda273f5c6b481a4a310afc73cafa6a67c2fe3e56cf08ca828e822d91890a6fda917e4c05d4b20f598e50805431d2926a4f1add9c SHA512 38fb8c759a517defd64ca75a22d5deb1fa543fc13f127c73010741c40bc00935bf3b46743a95a22e98e37df5aa21d72203acabaecf8c0b23439e3b5c68f2fbec diff --git a/dev-lang/rust/rust-1.29.2-r1.ebuild b/dev-lang/rust/rust-1.29.2-r1.ebuild @@ -1,317 +0,0 @@ -# Copyright 1999-2018 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -LLVM_MAX_SLOT=7 -PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) - -inherit llvm eapi7-ver multiprocessing multilib-build python-any-r1 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 x86" -fi - -CHOST_amd64=x86_64-unknown-linux-musl -CHOST_x86=i686-unknown-linux-gnu -CHOST_arm64=aarch64-unknown-linux-gnu - -RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" -RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}" -RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}" -RUST_STAGE0_arm64="rust-${RUST_STAGE0_VERSION}-${CHOST_arm64}" - -CARGO_DEPEND_VERSION="0.$(($(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 - amd64? ( https://portage.smaeul.xyz/distfiles/${RUST_STAGE0_amd64}.tar.xz ) - x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.xz ) - arm64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_arm64}.tar.xz ) -" - -ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 - NVPTX PowerPC Sparc SystemZ 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="cargo clippy cpu_flags_x86_sse2 debug doc system-llvm +jemalloc libressl rls rustfmt wasm ${ALL_LLVM_TARGETS[*]}" - -RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 - jemalloc? ( dev-libs/jemalloc ) - cargo? ( - sys-libs/zlib - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) - net-libs/libssh2 - net-libs/http-parser:= - net-misc/curl[ssl] - )" -DEPEND="${RDEPEND} - ${PYTHON_DEPS} - || ( - >=sys-devel/gcc-4.7 - >=sys-devel/clang-3.5 - ) - cargo? ( !dev-util/cargo ) - rustfmt? ( !dev-util/rustfmt ) - dev-util/cmake -" -PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" - -REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) - x86? ( cpu_flags_x86_sse2 )" - -S="${WORKDIR}/${MY_P}-src" - -PATCHES=( - "${FILESDIR}/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" - "${FILESDIR}/0003-Switch-musl-targets-to-link-dynamically-by-default.patch" - "${FILESDIR}/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch" - "${FILESDIR}/0005-Fix-LLVM-build.patch" - "${FILESDIR}/0007-Add-openssl-configuration-for-musl-targets.patch" - "${FILESDIR}/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" - "${FILESDIR}/0010-liblibc.patch" - "${FILESDIR}/0011-Avoid-name-conflicts-with-musl-libc.patch" -) - -toml_usex() { - usex "$1" true false -} - -pkg_setup() { - export RUST_BACKTRACE=1 - - if use system-llvm; then - 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 - - python-any-r1_pkg_setup -} - -src_prepare() { - local rust_stage0_root="${WORKDIR}"/rust-stage0 - - local rust_stage0_name="RUST_STAGE0_${ARCH}" - local rust_stage0="${!rust_stage0_name}" - - "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die - - default -} - -src_configure() { - local rust_target="" rust_targets="" rust_target_name arch_cflags - - # Collect rust target names to compile standard libs for all ABIs. - for v in $(multilib_get_enabled_abi_pairs); do - rust_target_name="CHOST_${v##*.}" - rust_targets="${rust_targets},\"${!rust_target_name}\"" - done - if use wasm; then - rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" - fi - rust_targets="${rust_targets#,}" - - local extended="false" tools="" - if use cargo; then - extended="true" - tools="\"cargo\"," - fi - if use clippy; then - extended="true" - tools="\"clippy\",$tools" - fi - if use rls; then - extended="true" - tools="\"rls\",\"analysis\",\"src\",$tools" - fi - if use rustfmt; then - extended="true" - tools="\"rustfmt\",$tools" - fi - - local rust_stage0_root="${WORKDIR}"/rust-stage0 - - rust_target_name="CHOST_${ARCH}" - rust_target="${!rust_target_name}" - - cat <<- EOF > "${S}"/config.toml - [llvm] - optimize = $(toml_usex !debug) - release-debuginfo = $(toml_usex debug) - assertions = $(toml_usex debug) - targets = "${LLVM_TARGETS// /;}" - [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}] - [install] - prefix = "${EPREFIX}/usr" - libdir = "$(get_libdir)" - docdir = "share/doc/${P}" - mandir = "share/${P}/man" - [rust] - optimize = $(toml_usex !debug) - debuginfo = $(toml_usex debug) - debug-assertions = $(toml_usex debug) - use-jemalloc = $(toml_usex jemalloc) - default-linker = "$(tc-getCC)" - channel = "stable" - rpath = false - lld = $(toml_usex wasm) - EOF - - for v in $(multilib_get_enabled_abi_pairs); do - rust_target=$(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)" - llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" - EOF - done - - if use wasm; then - cat <<- EOF >> "${S}"/config.toml - [target.wasm32-unknown-unknown] - linker = "rust-lld" - EOF - fi -} - -src_compile() { - env $(cat "${S}"/config.env)\ - "${EPYTHON}" ./x.py build --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 || die - - mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die - mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die - mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die - mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die - if use cargo; then - mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die - fi - if use clippy; then - mv "${D}/usr/bin/clippy-driver" "${D}/usr/bin/clippy-driver-${PV}" || die - mv "${D}/usr/bin/cargo-clippy" "${D}/usr/bin/cargo-clippy-${PV}" || die - fi - if use rls; then - mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die - fi - if use rustfmt; then - mv "${D}/usr/bin/rustfmt" "${D}/usr/bin/rustfmt-${PV}" || die - mv "${D}/usr/bin/cargo-fmt" "${D}/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=$(get_abi_CHOST ${v##*.}) - mkdir -p "${D}/usr/${abi_libdir}" - cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ - "${D}/usr/${abi_libdir}" || die - done - - dodoc COPYRIGHT - - # FIXME: - # Really not sure if that env is needed, specailly LDPATH - cat <<-EOF > "${T}"/50${P} - LDPATH="/usr/$(get_libdir)/${P}" - MANPATH="/usr/share/${P}/man" - EOF - doenvd "${T}"/50${P} - - cat <<-EOF > "${T}/provider-${P}" - /usr/bin/rustdoc - /usr/bin/rust-gdb - /usr/bin/rust-lldb - EOF - if use cargo; then - echo /usr/bin/cargo >> "${T}/provider-${P}" - fi - 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}." - - 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 - - if has_version 'app-shells/zsh'; then - elog "install app-shells/rust-zshcomp to get zsh completion for rust." - fi -} - -pkg_postrm() { - eselect rust unset --if-invalid -} diff --git a/dev-lang/rust/rust-1.31.0.ebuild b/dev-lang/rust/rust-1.31.0.ebuild @@ -0,0 +1,317 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +LLVM_MAX_SLOT=7 +PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) + +inherit llvm eapi7-ver multiprocessing multilib-build python-any-r1 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 x86" +fi + +CHOST_amd64=x86_64-gentoo-linux-musl +CHOST_x86=i686-unknown-linux-gnu +CHOST_arm64=aarch64-unknown-linux-gnu + +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1" +RUST_STAGE0_amd64="rust-${RUST_STAGE0_VERSION}-${CHOST_amd64}" +RUST_STAGE0_x86="rust-${RUST_STAGE0_VERSION}-${CHOST_x86}" +RUST_STAGE0_arm64="rust-${RUST_STAGE0_VERSION}-${CHOST_arm64}" + +CARGO_DEPEND_VERSION="0.$(($(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 + amd64? ( https://portage.smaeul.xyz/distfiles/${RUST_STAGE0_amd64}.tar.xz ) + x86? ( https://static.rust-lang.org/dist/${RUST_STAGE0_x86}.tar.xz ) + arm64? ( https://static.rust-lang.org/dist/${RUST_STAGE0_arm64}.tar.xz ) +" + +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC Sparc SystemZ 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="cargo clippy cpu_flags_x86_sse2 debug doc system-llvm +jemalloc libressl rls rustfmt wasm ${ALL_LLVM_TARGETS[*]}" + +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 + jemalloc? ( dev-libs/jemalloc ) + cargo? ( + sys-libs/zlib + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:0= ) + net-libs/libssh2 + net-libs/http-parser:= + net-misc/curl[ssl] + )" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + || ( + >=sys-devel/gcc-4.7 + >=sys-devel/clang-3.5 + ) + cargo? ( !dev-util/cargo ) + rustfmt? ( !dev-util/rustfmt ) + dev-util/cmake +" +PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" + +REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) + x86? ( cpu_flags_x86_sse2 )" + +S="${WORKDIR}/${MY_P}-src" + +PATCHES=( + "${FILESDIR}/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch" + "${FILESDIR}/0003-Switch-musl-targets-to-link-dynamically-by-default.patch" + "${FILESDIR}/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch" + "${FILESDIR}/0005-Fix-LLVM-build.patch" + "${FILESDIR}/0007-Add-openssl-configuration-for-musl-targets.patch" + "${FILESDIR}/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch" + "${FILESDIR}/0010-liblibc.patch" + "${FILESDIR}/0011-Avoid-name-conflicts-with-musl-libc.patch" +) + +toml_usex() { + usex "$1" true false +} + +pkg_setup() { + export RUST_BACKTRACE=1 + + if use system-llvm; then + 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 + + python-any-r1_pkg_setup +} + +src_prepare() { + local rust_stage0_root="${WORKDIR}"/rust-stage0 + + local rust_stage0_name="RUST_STAGE0_${ARCH}" + local rust_stage0="${!rust_stage0_name}" + + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig --destdir="${rust_stage0_root}" --prefix=/ || die + + default +} + +src_configure() { + local rust_target="" rust_targets="" rust_target_name arch_cflags + + # Collect rust target names to compile standard libs for all ABIs. + for v in $(multilib_get_enabled_abi_pairs); do + rust_target_name="CHOST_${v##*.}" + rust_targets="${rust_targets},\"${!rust_target_name}\"" + done + if use wasm; then + rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" + fi + rust_targets="${rust_targets#,}" + + local extended="false" tools="" + if use cargo; then + extended="true" + tools="\"cargo\"," + fi + if use clippy; then + extended="true" + tools="\"clippy\",$tools" + fi + if use rls; then + extended="true" + tools="\"rls\",\"analysis\",\"src\",$tools" + fi + if use rustfmt; then + extended="true" + tools="\"rustfmt\",$tools" + fi + + local rust_stage0_root="${WORKDIR}"/rust-stage0 + + rust_target_name="CHOST_${ARCH}" + rust_target="${!rust_target_name}" + + cat <<- EOF > "${S}"/config.toml + [llvm] + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + targets = "${LLVM_TARGETS// /;}" + [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}] + [install] + prefix = "${EPREFIX}/usr" + libdir = "$(get_libdir)" + docdir = "share/doc/${P}" + mandir = "share/${P}/man" + [rust] + optimize = $(toml_usex !debug) + debuginfo = $(toml_usex debug) + debug-assertions = $(toml_usex debug) + use-jemalloc = $(toml_usex jemalloc) + default-linker = "$(tc-getCC)" + channel = "stable" + rpath = false + lld = $(toml_usex wasm) + EOF + + for v in $(multilib_get_enabled_abi_pairs); do + rust_target=$(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)" + llvm-config = "$(get_llvm_prefix "$LLVM_MAX_SLOT")/bin/llvm-config" + EOF + done + + if use wasm; then + cat <<- EOF >> "${S}"/config.toml + [target.wasm32-unknown-unknown] + linker = "rust-lld" + EOF + fi +} + +src_compile() { + env $(cat "${S}"/config.env)\ + "${EPYTHON}" ./x.py build --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 || die + + mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die + mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die + mv "${D}/usr/bin/rust-gdb" "${D}/usr/bin/rust-gdb-${PV}" || die + mv "${D}/usr/bin/rust-lldb" "${D}/usr/bin/rust-lldb-${PV}" || die + if use cargo; then + mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die + fi + if use clippy; then + mv "${D}/usr/bin/clippy-driver" "${D}/usr/bin/clippy-driver-${PV}" || die + mv "${D}/usr/bin/cargo-clippy" "${D}/usr/bin/cargo-clippy-${PV}" || die + fi + if use rls; then + mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die + fi + if use rustfmt; then + mv "${D}/usr/bin/rustfmt" "${D}/usr/bin/rustfmt-${PV}" || die + mv "${D}/usr/bin/cargo-fmt" "${D}/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=$(get_abi_CHOST ${v##*.}) + mkdir -p "${D}/usr/${abi_libdir}" + cp "${D}/usr/$(get_libdir)/rustlib/${rust_target}/lib"/*.so \ + "${D}/usr/${abi_libdir}" || die + done + + dodoc COPYRIGHT + + # FIXME: + # Really not sure if that env is needed, specailly LDPATH + cat <<-EOF > "${T}"/50${P} + LDPATH="/usr/$(get_libdir)/${P}" + MANPATH="/usr/share/${P}/man" + EOF + doenvd "${T}"/50${P} + + cat <<-EOF > "${T}/provider-${P}" + /usr/bin/rustdoc + /usr/bin/rust-gdb + /usr/bin/rust-lldb + EOF + if use cargo; then + echo /usr/bin/cargo >> "${T}/provider-${P}" + fi + 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}." + + 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 + + if has_version 'app-shells/zsh'; then + elog "install app-shells/rust-zshcomp to get zsh completion for rust." + fi +} + +pkg_postrm() { + eselect rust unset --if-invalid +}