diff options
-rw-r--r-- | dev-lang/rust/files/rust-9999-enable-analysis-dev.patch | 26 | ||||
-rw-r--r-- | dev-lang/rust/metadata.xml | 1 | ||||
-rw-r--r-- | dev-lang/rust/rust-9999.ebuild | 29 |
3 files changed, 53 insertions, 3 deletions
diff --git a/dev-lang/rust/files/rust-9999-enable-analysis-dev.patch b/dev-lang/rust/files/rust-9999-enable-analysis-dev.patch new file mode 100644 index 0000000..125df1b --- /dev/null +++ b/dev-lang/rust/files/rust-9999-enable-analysis-dev.patch @@ -0,0 +1,26 @@ +diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs +index 67e4dad..46e1b6f 100644 +--- a/src/bootstrap/dist.rs ++++ b/src/bootstrap/dist.rs +@@ -313,7 +313,7 @@ pub fn rust_src_location(build: &Build) -> PathBuf { + pub fn analysis(build: &Build, compiler: &Compiler, target: &str) { + println!("Dist analysis"); + +- if build.config.channel != "nightly" { ++ if build.config.channel != "nightly" && build.config.channel != "dev" { + println!("\tskipping - not on nightly channel"); + return; + } +diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs +index ceefcc9..39854c9 100644 +--- a/src/tools/build-manifest/src/main.rs ++++ b/src/tools/build-manifest/src/main.rs +@@ -218,7 +218,7 @@ impl Builder { + self.package("rust-docs", &mut manifest.pkg, TARGETS); + self.package("rust-src", &mut manifest.pkg, &["*"]); + +- if self.channel == "nightly" { ++ if self.channel == "nightly" || self.channel == "dev" { + self.package("rust-analysis", &mut manifest.pkg, TARGETS); + } + diff --git a/dev-lang/rust/metadata.xml b/dev-lang/rust/metadata.xml index 757f617..96c4776 100644 --- a/dev-lang/rust/metadata.xml +++ b/dev-lang/rust/metadata.xml @@ -17,5 +17,6 @@ <flag name="system-llvm">Use system <pkg>sys-devel/llvm</pkg> in place of the bundled one</flag> <flag name="sanitize">Add LeakSanitizer, ThreadSanitizer, AddressSanitizer and MemorySanitizer support</flag> + <flag name="analysis">Install standard library analysis data used by Rust Language Server</flag> </use> </pkgmetadata> diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild index 135a881..0c327d3 100644 --- a/dev-lang/rust/rust-9999.ebuild +++ b/dev-lang/rust/rust-9999.ebuild @@ -27,7 +27,7 @@ HOMEPAGE="http://www.rust-lang.org/" LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" KEYWORDS="" -IUSE="clang debug doc libcxx source +system-llvm sanitize" +IUSE="clang debug doc libcxx source +system-llvm sanitize analysis" REQUIRED_USE="libcxx? ( clang )" CDEPEND="libcxx? ( sys-libs/libcxx ) @@ -60,6 +60,14 @@ src_unpack() { use x86 && BUILD_TRIPLE=i686-unknown-linux-gnu } +src_prepare() { + default + + if use analysis; then + epatch ${FILESDIR}/rust-9999-enable-analysis-dev.patch + fi +} + src_configure() { export CFG_DISABLE_LDCONFIG="notempty" @@ -89,16 +97,19 @@ src_configure() { $(use_enable doc docs) \ $(use_enable libcxx libcpp) \ $(use_enable sanitize sanitizers) \ - $(usex system-llvm "--llvm-root=${EPREFIX}/usr" " ") \ + $(usex system-llvm "--llvm-root=${EPREFIX}/usr" " ") \ || die } src_compile() { + if use analysis; then + export RUSTC_SAVE_ANALYSIS="api" + fi emake dist VERBOSE=1 } src_install() { - default + default VERBOSE=1 mv "${D}/usr/bin/rustc" "${D}/usr/bin/rustc-${PV}" || die mv "${D}/usr/bin/rustdoc" "${D}/usr/bin/rustdoc-${PV}" || die @@ -135,6 +146,18 @@ src_install() { dodir /usr/share/${P} cp -R "${S}/src" "${D}/usr/share/${P}" fi + + if use debug; then + TARGET=debug + else + TARGET=release + fi + + if use analysis; then + dodir /usr/lib/rustlib/${BUILD_TRIPLE}/analysis + insinto /usr/lib/rustlib/${BUILD_TRIPLE}/analysis + doins "${S}/build/${BUILD_TRIPLE}/stage1-std/${BUILD_TRIPLE}/${TARGET}/deps/save-analysis"/* || die + fi } pkg_postinst() { |