diff options
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/rust/metadata.xml | 3 | ||||
-rw-r--r-- | dev-lang/rust/rust-9999.ebuild | 155 |
2 files changed, 93 insertions, 65 deletions
diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml index 555c6f2..07ffe0b 100644 --- a/dev-lang/rust/metadata.xml +++ b/dev-lang/rust/metadata.xml @@ -6,13 +6,12 @@ <name>Rust Project</name> </maintainer> <use> - <flag name="extended">Install extended rust tools (RLS, analysis data, ...)</flag> - <flag name="clang">Use <pkg>sys-devel/clang</pkg> for building</flag> <flag name="system-llvm">Use system <pkg>sys-devel/llvm</pkg> in place of the bundled one</flag> <flag name="jemalloc">Use <pkg>sys-libs/jemalloc</pkg> as the standard memory allocator</flag> <flag name="sanitize">Check for kernel version</flag> <flag name="wasm">Enable WebAssembly support</flag> + <flag name="clippy">Install clippy</flag> </use> </pkgmetadata> diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild index b7b54a8..353c0e9 100644 --- a/dev-lang/rust/rust-9999.ebuild +++ b/dev-lang/rust/rust-9999.ebuild @@ -14,16 +14,17 @@ MY_P="rust-git" EGIT_REPO_URI="https://github.com/rust-lang/rust.git" EGIT_CHECKOUT_DIR="${MY_P}-src" +KEYWORDS="" CHOST_amd64=x86_64-unknown-linux-gnu CHOST_x86=i686-unknown-linux-gnu CHOST_arm64=aarch64-unknown-linux-gnu +CARGO_DEPEND_VERSION="9999" + DESCRIPTION="Systems programming language from Mozilla" -HOMEPAGE="http://www.rust-lang.org/" +HOMEPAGE="https://www.rust-lang.org/" -LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" -KEYWORDS="" RESTRICT="network-sandbox" ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 @@ -31,35 +32,30 @@ ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?} -IUSE="clang debug doc source +system-llvm sanitize extended wasm ${ALL_LLVM_TARGETS[*]}" +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" -CDEPEND="clang? ( sys-libs/libcxx ) - >=app-eselect/eselect-rust-0.3_pre20150425 - !dev-lang/rust:0 - system-llvm? ( >=sys-devel/llvm-3.8.1-r2:= - <sys-devel/llvm-5.0.0:= ) -" -DEPEND="${CDEPEND} +IUSE="cargo debug doc system-llvm +jemalloc sanitize rls rustfmt source clippy wasm ${ALL_LLVM_TARGETS[*]}" + +RDEPEND=">=app-eselect/eselect-rust-0.3_pre20150425 + jemalloc? ( dev-libs/jemalloc )" +DEPEND="${RDEPEND} ${PYTHON_DEPS} - net-misc/curl - clang? ( - <sys-devel/clang-6_pre:= - || ( - sys-devel/clang:4 - >=sys-devel/clang-3.5:0 - ) + || ( + >=sys-devel/gcc-4.7 + >=sys-devel/clang-3.5 ) - !clang? ( >=sys-devel/gcc-4.7 ) + net-misc/curl + cargo? ( !dev-util/cargo ) + rustfmt? ( !dev-util/rustfmt ) dev-util/cmake sanitize? ( >=sys-kernel/linux-headers-3.2 ) + system-llvm? ( >=sys-devel/llvm-3.8.1-r2:= + <sys-devel/llvm-5.0.0:= ) " -RDEPEND="${CDEPEND} -" -PDEPEND="dev-util/cargo" +PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )" -REQUIRED_USE="source? ( extended ) -wasm? ( !system-llvm ) -|| ( ${ALL_LLVM_TARGETS[*]} )" +REQUIRED_USE=" || ( ${ALL_LLVM_TARGETS[*]} ) +wasm? ( !system-llvm ) " S="${WORKDIR}/${MY_P}-src" @@ -67,12 +63,6 @@ toml_usex() { usex "$1" true false } -toml_tools_list() { - if use extended; then - echo "tools=[$(usex source "\"src\", " "")\"rls\", \"analysis\"]" - fi -} - pkg_setup() { python-any-r1_pkg_setup if use system-llvm; then @@ -100,8 +90,6 @@ src_configure() { local llvm_config="$(get_llvm_prefix)/bin/${CBUILD}-llvm-config" fi - python_setup - local rust_target="" rust_targets="" rust_target_name arch_cflags # Collect rust target names to compile standard libs for all ABIs. @@ -114,10 +102,33 @@ src_configure() { fi rust_targets="${rust_targets#,}" - local rust_target_name="CHOST_${ARCH}" - local rust_target="${!rust_target_name}" + local extended="false" tools="" + if use cargo; then + extended="true" + tools="\"cargo\"," + fi + if use rls; then + extended="true" + tools="\"rls\",$tools" + fi + if use rustfmt; then + extended="true" + tools="\"rustfmt\",$tools" + fi + if use source; then + extended="true" + tools="\"src\",$tools" + fi + if use clippy; then + extended="true" + tools="\"clippy\",$tools" + fi + - export CFG_DISABLE_LDCONFIG="notempty" + rust_target_name="CHOST_${ARCH}" + rust_target="${!rust_target_name}" + + #export CFG_DISABLE_LDCONFIG="notempty" cat <<- EOF > "${S}"/config.toml [llvm] @@ -136,8 +147,8 @@ src_configure() { vendor = false verbose = 2 sanitizers = $(toml_usex sanitize) - extended = $(toml_usex extended) - $(toml_tools_list) + extended = ${extended} + tools = [${tools}] [install] prefix = "${EPREFIX}/usr" libdir = "$(get_libdir)/${P}" @@ -147,11 +158,12 @@ src_configure() { optimize = $(toml_usex !debug) debuginfo = $(toml_usex debug) debug-assertions = $(toml_usex debug) - use-jemalloc = true + use-jemalloc = $(toml_usex jemalloc) default-linker = "$(tc-getCC)" rpath = false ignore-git = false lld = $(toml_usex wasm) + llvm-tools = true EOF for v in $(multilib_get_enabled_abi_pairs); do @@ -162,17 +174,10 @@ src_configure() { CFLAGS_${rust_target}=${arch_cflags} EOF - local c_compiler="$(tc-getBUILD_CC)" - local cxx_compiler="$(tc-getBUILD_CXX)" - if use clang ; then - c_compiler="${CBUILD}-clang" - cxx_compiler="${CBUILD}-clang++" - fi - cat <<- EOF >> "${S}"/config.toml [target.${rust_target}] - cc = "${c_compiler}" - cxx = "${cxx_compiler}" + cc = "$(tc-getBUILD_CC)" + cxx = "$(tc-getBUILD_CXX)" linker = "$(tc-getCC)" ar = "$(tc-getAR)" EOF @@ -187,7 +192,7 @@ src_configure() { if use wasm; then cat <<- EOF >> "${S}"/config.toml [target.wasm32-unknown-unknown] - linker = "lld" + linker = "rust-lld" EOF if use system-llvm; then @@ -200,11 +205,12 @@ src_configure() { src_compile() { env $(cat "${S}"/config.env)\ - ${EPYTHON} x.py build --verbose --config="${S}"/config.toml $(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+') || die + ${EPYTHON} x.py build --verbose --config="${S}"/config.toml $(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+') \ + --exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305 } src_install() { - local rust_target_abi_libdir + local rust_target abi_libdir env DESTDIR="${D}" ${EPYTHON} x.py install --verbose --config="${S}"/config.toml $(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+') || die @@ -212,9 +218,20 @@ src_install() { 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 extended; then + if use cargo; then + mv "${D}/usr/bin/cargo" "${D}/usr/bin/cargo-${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 + 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 # Copy shared library versions of standard libraries for all targets # into the system's abi-dependent lib directories because the rust @@ -230,11 +247,11 @@ src_install() { ${D}/usr/${abi_libdir} || die done - dodoc COPYRIGHT LICENSE-APACHE LICENSE-MIT + dodoc COPYRIGHT cat <<-EOF > "${T}"/50${P} - LDPATH="/usr/$(get_libdir)/${P}" - MANPATH="/usr/share/${P}/man" + LDPATH="/usr/$(get_libdir)/${P}" + MANPATH="/usr/share/${P}/man" EOF if use source; then cat <<-EOF >> "${T}"/50${P} @@ -244,13 +261,25 @@ src_install() { doenvd "${T}"/50${P} cat <<-EOF > "${T}/provider-${P}" - /usr/bin/rustdoc - /usr/bin/rust-gdb - /usr/bin/rust-lldb + /usr/bin/rustdoc + /usr/bin/rust-gdb + /usr/bin/rust-lldb EOF - if use extended; then + if use cargo; then + echo /usr/bin/cargo >> "${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 + + if use clippy; then cat <<-EOF >> "${T}/provider-${P}" - /usr/bin/rls + /usr/bin/cargo-clippy + /usr/bin/clippy-driver EOF fi dodir /etc/env.d/rust @@ -263,15 +292,15 @@ src_install() { pkg_postinst() { eselect rust update --if-unset - elog "Rust installs a helper script for calling GDB now," - elog "for your convenience it is installed under /usr/bin/rust-gdb-${PV}." + 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-mode to get vim support for rust." + elog "install app-vim/rust-vim to get vim support for rust." fi if has_version 'app-shells/zsh'; then |