From bb1d7c7cdda622f97581f62189c355170f1720fe Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 27 Oct 2018 13:44:37 +0100 Subject: dev-lang/rust : version bump --- dev-lang/rust/Manifest | 12 +- dev-lang/rust/files/1.29.2-clippy-sysroot.patch | 62 ++++++ dev-lang/rust/rust-1.29.1-r1337.ebuild | 268 ------------------------ dev-lang/rust/rust-1.29.2-r1337.ebuild | 260 +++++++++++++++++++++++ 4 files changed, 333 insertions(+), 269 deletions(-) create mode 100644 dev-lang/rust/files/1.29.2-clippy-sysroot.patch delete mode 100644 dev-lang/rust/rust-1.29.1-r1337.ebuild create mode 100644 dev-lang/rust/rust-1.29.2-r1337.ebuild diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest index 2cb3a292..3c08cc1d 100644 --- a/dev-lang/rust/Manifest +++ b/dev-lang/rust/Manifest @@ -1,4 +1,14 @@ DIST rust-1.28.0-aarch64-unknown-linux-gnu.tar.xz 98937652 BLAKE2B 836d3dd4e583fa50dd317c3bea56257e6ea19defdb38c16be6debb2854e147c8a92c4832263e4ac314136022a176526fe7d3774a3c5a84cd8d364cd2a1532860 SHA512 8d9acbc90ddaa1e0de0234a21798b19b5365ea371a12f9a143c6ebacbb48f57344da6e827e867513be502bce2801de27a0dbbacdf8618c653aeb58026b6c469c +DIST rust-1.28.0-arm-unknown-linux-gnueabi.tar.xz 104676648 BLAKE2B b26b23c3605e6584c51e0e914dbb3be60996e079e52ff2d4850ed43c1f1f7cd5ac575b40dbe852f927d36654f5ab7e384548f3a92b3466bfbb1cda7f9f069bcb SHA512 a1eaf1d7826ebfe222d233cabd8b88073ca2c8dd42a0b870e324dfc63e7290308418222c56802bc421c9bda119dc7c5f3e225ff33cacad5776b79cbcc1a877b2 +DIST rust-1.28.0-arm-unknown-linux-gnueabihf.tar.xz 104992084 BLAKE2B df97766d7abf73f668a2936834bc0f35739289eeeb5395276a2fdfd5b6c0baee3ba1eee1099f19d4f4f1cbd1a33cf62ad888dd3d1856b613ac853c6a17650741 SHA512 3b58b83f38bf8d8e841ae6614d72bb6e6faf75fb7c19abc5451548b0e6de0ef3b64dfbc70481a1e40f74074bfad701aa7a58296b4a0d07957a418bd3cd769917 +DIST rust-1.28.0-armv7-unknown-linux-gnueabihf.tar.xz 105144132 BLAKE2B d9e0791c7dc77ade26d383a5c57117a2b7b50c6a523b31fbf604c0b779c966c5055554f85c718353f2e581bfe8a228369671a8b731f808bc0133ad3fad61f853 SHA512 9142110e0c24657aca41468648d9364c2e6fce60b08ca7113c944a53701fc5a309481a8fdd5845b229bcc750ccad63af561d452c3a3a0727ab1ca7a461b06d3d DIST rust-1.28.0-i686-unknown-linux-gnu.tar.xz 136925948 BLAKE2B 85d9239533920c3f16d7c61bada0caeabceceade29032b70bb4562bfd04fa0158cdd85b8a0a1119506416fa5916ade8a0466bf6c10da457299a6319aa25f9dd6 SHA512 ffdfab46db14f07354b553e02fdb9dc6602c2c52b78d8f17c499f4ddb1e257aa53479df836eb3f06a2548d34296b0277cdb6b4c6f3cec57265823df22752c135 +DIST rust-1.28.0-mips-unknown-linux-gnu.tar.xz 102116424 BLAKE2B 72c7cfa9157c0d7fb6a9dc0698322e5285bc2ef9f914a1be5063c8aeaed8a7d29bbcd71090aa5f09ec5229e38ac08e6883119f03af42ffa794cadf227450049d SHA512 0d2e2785178e235b0effd2a7251e9004c87c21e158c2e6f122eeb10942ce2545e5d67d7ff040b7c277627cc402321fff5ad5186a41f2de581f46633adb1894bf +DIST rust-1.28.0-mips64-unknown-linux-gnuabi64.tar.xz 101617356 BLAKE2B eb0cc524e40cdf20ec16b72418cae9ea03ce946006412153a7c0a173f27a3f8e193a41685295be9917b10ca39565be57b6d3f7c7a7122cbee088a5652081dda1 SHA512 0d7bfafa1340de97efab8db3100d5462afde94e8e54d6543e229d9240aca5a69d469a3e5ac750527d5e40dad11286b40d6be22812655721a0b8bf3ecba485ad6 +DIST rust-1.28.0-mipsel-unknown-linux-gnu.tar.xz 103574324 BLAKE2B 671e8ee0de674e37c8156825603e3cea659c0ad016698c8f208a78afe18cf0411dc953cf683d297079e3eaedddad540dbfa1821950585fb5ffcf74267f0ebcdd SHA512 40233beb18c937f7293a8191d6a9d98c5628b0709ef808e48fac4db10ce0af91cb8d6bec9056dae00149e8e0b1613b1c66960e23302bc0b66b50fbb0994cb018 +DIST rust-1.28.0-powerpc-unknown-linux-gnu.tar.xz 100580084 BLAKE2B 2487976f495e78d8cc8129d81e1eb29cc86d7c523133d9ea42e6425f7607fea74c8a848877e926c53c2dd9599a0c3bede46109e96c3851fd7726b251442fca6c SHA512 450aa028644fc73cf8dadccfabc1a66c360880300479df9c0041f773b3f6b6072afb9aee0221fe51abd4194b86f8cc8b7f14c788b3792858a44bfc8c83bcc03d +DIST rust-1.28.0-powerpc64-unknown-linux-gnu.tar.xz 105788856 BLAKE2B 828082612561ddd186472472e11e1afb9bc24a3332ff5f82a9924fc950b29655e892c974a88ce6c0b04c34a9c7d13856a8629027069808234ffb1e3cfb788e01 SHA512 1bd2c5069beecb765a2305715070e4052d5a66dafe50a5b53bea2c2082b22b3f9a2d2b9fb059c93476f88ee5e602effc18b807e5c964610e8255a3a945931f51 +DIST rust-1.28.0-powerpc64le-unknown-linux-gnu.tar.xz 105822856 BLAKE2B 0cf534a55efff99daf700127fc7bc7b82b93054d054fbf8479a8b247b41381fd82f8672ac12f3e3f53566d816964d83069593817d1932b33902f83994f1bdc33 SHA512 bdbdf3a64a184dd4510a113bbe20c058f42e35321cd2fb7c938487dfc9b1f04320b523ea215dd92a23c2537292eeb064097119e2097d6e24a1c4e237d9d4fc8b +DIST rust-1.28.0-s390x-unknown-linux-gnu.tar.xz 98839840 BLAKE2B bbff015b3d2daf1443781cccb80527cf8c7f86a01ed928b49cc7e87e17f8c6354f6a47dd2356ff75357e09f7f79ec85812bd8458aee9455800fdf88761243e94 SHA512 5ffb44d16c990b8a6377b64e5042a3b2e709bcc7187013dbe4ab3c9d8cd781b6bf07b0d374340e2ccabe9f84fd4731b606cb05a10a739ebcfa49652518a2aa46 DIST rust-1.28.0-x86_64-unknown-linux-gnu.tar.xz 134120432 BLAKE2B 56fb79a98659d9c8e56b8eef87dea3302ee5901bc4507d1c204628370b20cf34b2875c9586faa0acc2bc2b1a5beedeb9b5ba199cfb85d52f268f084a02f04f27 SHA512 4f427c11a9cd22aedd01bd7ed5bee2ba5e00a27db25af4f596cf8627d88eff8e72625eb83729d2e6c6780aaffd44c0e7065a1c8fa22f4899349b72c726cf6a5f -DIST rustc-1.29.1-src.tar.xz 61937676 BLAKE2B 6a60249538e1ec62471f4d0e3fc31c0a648433aa6f85ca7341657ea07772e338eb92a629941685808f4b80e84cb025d78aee9d0d6fa71c6635a1647c61bca9bc SHA512 1ded651b4c460e11e5e44c26de88a80fb13c2000097de2ee1e5af89638e12a7e8f43dd756689d4cc4fad45c52d4d43a3c70dd6a3ae550735b9dad5f8defea6a7 +DIST rustc-1.29.2-src.tar.xz 61888912 BLAKE2B f59b0bf45caa6f6136f92ffbaa612bbc6a340c8694ec69d75aadace9180c36753f985641915524388b52cc108f8f5b71840ee3a6c0b1fcff6decb61d2d8a161e SHA512 d8fa9501764348ace8f60f2069bcd016925abe56c8bbc2b87fb52ff796e4bc7284c1fccbb1671416437bb82fde7d9240eeae875d6099914e27e75cfe050e2d38 diff --git a/dev-lang/rust/files/1.29.2-clippy-sysroot.patch b/dev-lang/rust/files/1.29.2-clippy-sysroot.patch new file mode 100644 index 00000000..6a527e5a --- /dev/null +++ b/dev-lang/rust/files/1.29.2-clippy-sysroot.patch @@ -0,0 +1,62 @@ +--- a/src/tools/clippy/src/driver.rs 2018-10-04 16:30:42.438486058 +0300 ++++ b/src/tools/clippy/src/driver.rs 2018-10-04 16:31:45.044484028 +0300 +@@ -20,54 +20,22 @@ + return; + } + +- let sys_root = option_env!("SYSROOT") +- .map(String::from) +- .or_else(|| std::env::var("SYSROOT").ok()) +- .or_else(|| { +- let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); +- let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); +- home.and_then(|home| toolchain.map(|toolchain| format!("{}/toolchains/{}", home, toolchain))) +- }) +- .or_else(|| { +- Command::new("rustc") +- .arg("--print") +- .arg("sysroot") +- .output() +- .ok() +- .and_then(|out| String::from_utf8(out.stdout).ok()) +- .map(|s| s.trim().to_owned()) +- }) +- .expect("need to specify SYSROOT env var during clippy compilation, or use rustup or multirust"); +- + // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument. + // We're invoking the compiler programmatically, so we ignore this/ +- let mut orig_args: Vec = env::args().collect(); +- if orig_args.len() <= 1 { ++ let mut args: Vec = env::args().collect(); ++ if args.len() <= 1 { + std::process::exit(1); + } +- if orig_args[1] == "rustc" { ++ if args[1] == "rustc" { + // we still want to be able to invoke it normally though +- orig_args.remove(1); ++ args.remove(1); + } +- // this conditional check for the --sysroot flag is there so users can call +- // `clippy_driver` directly +- // without having to pass --sysroot or anything +- let mut args: Vec = if orig_args.iter().any(|s| s == "--sysroot") { +- orig_args.clone() +- } else { +- orig_args +- .clone() +- .into_iter() +- .chain(Some("--sysroot".to_owned())) +- .chain(Some(sys_root)) +- .collect() +- }; + + // this check ensures that dependencies are built but not linted and the final + // crate is + // linted but not built + let clippy_enabled = env::var("CLIPPY_TESTS").ok().map_or(false, |val| val == "true") +- || orig_args.iter().any(|s| s == "--emit=dep-info,metadata"); ++ || args.iter().any(|s| s == "--emit=dep-info,metadata"); + + if clippy_enabled { + args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]); diff --git a/dev-lang/rust/rust-1.29.1-r1337.ebuild b/dev-lang/rust/rust-1.29.1-r1337.ebuild deleted file mode 100644 index be9e849e..00000000 --- a/dev-lang/rust/rust-1.29.1-r1337.ebuild +++ /dev/null @@ -1,268 +0,0 @@ -# Copyright 1999-2018 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) - -inherit 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 - SLOT="stable/1.29" - MY_P="rustc-${PV}" - SRC="${MY_P}-src.tar.xz" - KEYWORDS="amd64 ~arm64 x86" -fi - -CHOST_amd64=x86_64-unknown-linux-gnu -CHOST_x86=i686-unknown-linux-gnu -CHOST_arm64=aarch64-unknown-linux-gnu - -RUST_STAGE0_VERSION="1.28.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.30.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://static.rust-lang.org/dist/${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 +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" - -toml_usex() { - usex "$1" true false -} - -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)" - 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 - - # Redcore Linux (install unversioned binaries as well) - cp "${D}/usr/bin/rustc-${PV}" "${D}/usr/bin/rustc" || die - cp "${D}/usr/bin/rustdoc-${PV}" "${D}/usr/bin/rustdoc" || die - cp "${D}/usr/bin/rust-gdb-${PV}" "${D}/usr/bin/rust-gdb" || die - cp "${D}/usr/bin/rust-lldb-${PV}" "${D}/usr/bin/rust-lldb" || die - - if use cargo; then - mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die - # Redcore Linux (install unversioned binaries as well) - cp "${D}/usr/bin/cargo-${PV}" "${D}/usr/bin/cargo" || 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 - # Redcore Linux (install unversioned binaries as well) - cp "${D}/usr/bin/clippy-driver-${PV}" "${D}/usr/bin/clippy-driver" || die - cp "${D}/usr/bin/cargo-clippy-${PV}" "${D}/usr/bin/cargo-clippy" || die - fi - if use rls; then - mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die - # Redcore Linux (install unversioned binaries as well) - cp "${D}/usr/bin/rls-${PV}" "${D}/usr/bin/rls" || 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 - # Redcore Linux (install unversioned binaries as well) - cp "${D}/usr/bin/rustfmt-${PV}" "${D}/usr/bin/rustfmt" || die - cp "${D}/usr/bin/cargo-fmt-${PV}" "${D}/usr/bin/cargo-fmt" || 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} -} - -pkg_postinst() { - eselect rust update --if-unset -} - -pkg_postrm() { - eselect rust unset --if-invalid -} diff --git a/dev-lang/rust/rust-1.29.2-r1337.ebuild b/dev-lang/rust/rust-1.29.2-r1337.ebuild new file mode 100644 index 00000000..345e3bb4 --- /dev/null +++ b/dev-lang/rust/rust-1.29.2-r1337.ebuild @@ -0,0 +1,260 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{5,6} pypy ) + +inherit multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs + +SLOT="stable/1.29" +MY_P="rustc-${PV}" +SRC="${MY_P}-src.tar.xz" +KEYWORDS="~amd64" + +CHOST_amd64=x86_64-unknown-linux-gnu +CHOST_x86=i686-unknown-linux-gnu +CHOST_arm64=aarch64-unknown-linux-gnu + +RUST_STAGE0_VERSION="1.28.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.30.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 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 +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}"/${PV}-clippy-sysroot.patch ) + +toml_usex() { + usex "$1" true false +} + +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_abi)" + + 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)/${P}" + 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)" + 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 + + + # Redcore Linux (install unversioned binaries as well) + cp "${D}/usr/bin/rustc-${PV}" "${D}/usr/bin/rustc" || die + cp "${D}/usr/bin/rustdoc-${PV}" "${D}/usr/bin/rustdoc" || die + cp "${D}/usr/bin/rust-gdb-${PV}" "${D}/usr/bin/rust-gdb" || die + cp "${D}/usr/bin/rust-lldb-${PV}" "${D}/usr/bin/rust-lldb" || die + + if use cargo; then + mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die + # Redcore Linux (install unversioned binaries as well) + cp "${D}/usr/bin/cargo-${PV}" "${D}/usr/bin/cargo" || 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 + # Redcore Linux (install unversioned binaries as well) + cp "${D}/usr/bin/clippy-driver-${PV}" "${D}/usr/bin/clippy-driver" || die + cp "${D}/usr/bin/cargo-clippy-${PV}" "${D}/usr/bin/cargo-clippy" || die + fi + if use rls; then + mv "${D}/usr/bin/rls" "${D}/usr/bin/rls-${PV}" || die + # Redcore Linux (install unversioned binaries as well) + cp "${D}/usr/bin/rls-${PV}" "${D}/usr/bin/rls" || 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 + # Redcore Linux (install unversioned binaries as well) + cp "${D}/usr/bin/rustfmt-${PV}" "${D}/usr/bin/rustfmt" || die + cp "${D}/usr/bin/cargo-fmt-${PV}" "${D}/usr/bin/cargo-fmt" || 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)/${P}/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} +} + +pkg_postinst() { + eselect rust update --if-unset +} + +pkg_postrm() { + eselect rust unset --if-invalid +} -- cgit v1.2.3