Skip to content

Commit

Permalink
dev-lang/rust-bin-9999: add "source" useflag
Browse files Browse the repository at this point in the history
Downloads and installs the sourcecode. Required for RLS.

Signed-off-by: Mikhail Pukhlikov <[email protected]>
  • Loading branch information
gentoo90 authored and cnd committed Aug 3, 2020
1 parent fcb10c8 commit 8395fe3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dev-lang/rust-bin/rust-bin-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ inherit eutils bash-completion-r1
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
MY_SRC_URI="https://static.rust-lang.org/dist/rust-nightly"
MY_SRC_SRC_URI="https://static.rust-lang.org/dist/rust-src-nightly.tar.xz"
MY_STDLIB_SRC_URI="https://static.rust-lang.org/dist/rust-std-nightly"

if [[ -v RUST_NIGHTLY_DATE ]]; then
MY_SRC_URI="https://static.rust-lang.org/dist/${RUST_NIGHTLY_DATE}/rust-nightly"
MY_SRC_SRC_URI="https://static.rust-lang.org/dist/${RUST_NIGHTLY_DATE}/rust-src-nightly.tar.xz"
MY_STDLIB_SRC_URI="https://static.rust-lang.org/dist/${RUST_NIGHTLY_DATE}/rust-std-nightly"
fi

Expand All @@ -25,7 +27,7 @@ SLOT="nightly"
KEYWORDS=""
RESTRICT="network-sandbox"

IUSE="clippy cpu_flags_x86_sse2 doc libressl rls rustfmt ${ALL_RUSTLIB_TARGETS[*]}"
IUSE="clippy cpu_flags_x86_sse2 doc libressl rls rustfmt source ${ALL_RUSTLIB_TARGETS[*]}"

CDEPEND="
>=app-eselect/eselect-rust-0.3_pre20150425
Expand All @@ -43,7 +45,8 @@ RDEPEND="${CDEPEND}
net-misc/curl[ssl]
!dev-util/cargo
"
REQUIRED_USE="x86? ( cpu_flags_x86_sse2 )"
REQUIRED_USE="x86? ( cpu_flags_x86_sse2 )
rls? ( source )"

QA_PREBUILT="
opt/${P}/bin/*-${PV}
Expand Down Expand Up @@ -74,12 +77,20 @@ src_unpack() {
cat "${WORKDIR}/rust-std-nightly-${target}/components" >> "${S}/components"
fi
done

if use source; then
wget "${MY_SRC_SRC_URI}" || die
unpack ./"rust-src-nightly.tar.xz"
mv "${WORKDIR}/rust-src-nightly/rust-src" "${S}/" || die
cat "${WORKDIR}/rust-src-nightly/components" >> "${S}/components"
fi
}

src_install() {
local std=$(grep 'std' ./components | paste -s -d',')
local components="rustc,cargo,${std}"
use doc && components="${components},rust-docs"
use source && components="${components},rust-src"
use clippy && components="${components},clippy-preview"
if use rls; then
local analysis=$(grep 'analysis' ./components)
Expand Down

0 comments on commit 8395fe3

Please sign in to comment.