forked from andrius/gentoo-bootstrap
add rust 1.58
This commit is contained in:
parent
1da409da28
commit
caac3b9925
|
@ -1,3 +1,5 @@
|
|||
AUX 1.49.0-gentoo-musl-target-specs.patch 6377 BLAKE2B 07e037353210292bc576ebbbda2afc489efeb696dffb34b4c5edffbb512b0ba5944cf641e625dd8a158cc7234b70d49d377397aab8cb9a86b4ec6f5a50a6cba6 SHA512 e166d4ed3e321257cef03655be98915badef432de10aa2bde2a4b9f1913dbb774a29a72d7d2861f69d02a37fd9f7c753c551a3e65fb7da4dfa78a8601eab8d38
|
||||
AUX 1.55.0-ignore-broken-and-non-applicable-tests.patch 2895 BLAKE2B cd2fd9b237786f187afe8d60e0ee6b9d1451233d554ca168e2f9d2a58f775c707d4d0a04899f8884152c3064689fa3fa31716f3b77e0002136ca7348c63e415e SHA512 993028842080ebc158ffe08f78315caaefa28958d890147286b53965eccff4d21f2edfcee153a2ceba03875d6bb03a2af7acaeb2deb8ccb7a5dc17cdffe73f0f
|
||||
AUX llvm-gcc10.patch 1275 BLAKE2B 72b455bded7ab2d7e7bc3e75dcc2c5d3c2d23efb5ccc5f9fb229ceb8e08b61610cb6744ce617466f262b16d4b4c53cf1c27b85f4271b7cf9018b6c108c4bfc19 SHA512 62c35554453a75e558c8b4751f43bd9e06037318a89f7c8afd22a16f396a2777550d4ec3ab1347d63f2ecff483ec8aab65b2baa2c4838900b9e63cfeab780883
|
||||
DIST rustc-1.39.0-src.tar.xz 96495140 BLAKE2B 6df6bf0c3b38c28753713acdc477ea6929740c32893171dd9b8620992439e45730ef6f9489a6fc411ff5884c661ac4c07b7b93f5a4174207ed53351d2dea09bf SHA512 8610b2ec77722087c572bd84ac562a5b7c5f1a644aea58c5d5daa07a9aed242703b7816e73e2eaa049f773d5907859e259744a0de700622df005584fd798dab0
|
||||
DIST rustc-1.40.0-src.tar.xz 92306352 BLAKE2B 762b9592414e5c816540f6fd37d07b3b0ffe97a151968cc8ae77be2fda03a6d66905192985edc65055cc7811dbd90faa2b2c056481f72161c6f7ccbcce13671a SHA512 b5ac3079acefb62d3c985b77f624d7fb68de23a59396fed9ccb292db61641c064f3146ee54d3cf59067b17ebfaadd14a6b2b466def60316bb5b13ba3aef01e1f
|
||||
|
@ -18,6 +20,8 @@ DIST rustc-1.54.0-src.tar.xz 116286856 BLAKE2B 5ac47822646a0b6205f09282168b4d4dd
|
|||
DIST rustc-1.55.0-src.tar.xz 117197580 BLAKE2B 8d9739ce7571146aee0e07c6287de9a8c4f1a914606cd47819eb1ef118b15772ecf22d0d43d7732f03c234a013fa54a4a7f0578a3f136af518f71bf64a03305d SHA512 7522f2fa95d5af92472404ecc97d7d9e745e88c933196a83fa373ce1efff6db3c295e0e2afdbfa1ff00644554efa0c3c7f6c11f9119ecf9010cb440b3f27c2da
|
||||
DIST rustc-1.56.1-src.tar.xz 121798264 BLAKE2B 09677b0332022f28a0d80949a6735929dbf64276f7eb57195d8c33e6c80f13c903432ff77d8834093ab551677618fb1d385f2300e2b1b4c064f9c245c696be32 SHA512 193468e211cde9ebc5f6e30b8e3733b79bd8710fe6dd45c7ed8d4392f91010d30466787afd4d0b2041cd7dd994924fee8ad111048824e248bd994959e55bf15f
|
||||
DIST rustc-1.57.0-src.tar.xz 122681768 BLAKE2B 739fe2c34b01bb0c6beeb7717badeb2ba12f00b91831977bf0d8782d806071f8ed696e94bf51d53509ae6e5c5773544b2dcf4187e81682c2f765d0975c64ca7d SHA512 7903bcfc7c1db208da5d5991bd5b7f55dbe5917d4814274a8badf0d3b767211e81f8626c355ea93142f236abf116d5921c0b542ef309fbe84ece1ce84e5af30f
|
||||
DIST rustc-1.58.1-src.tar.xz 124353160 BLAKE2B 686c7272db544ad46f7fb01b4e05f24f4e08ff959a000cadfaef5d8fc413b93f5ed839077bc9715defc7a0a179af091f65c7a5d7104b0b3153f0654c237c094b SHA512 eff3279d2e519343cea542a9ae2daab592e44f35af344e33ff43ed55fc7c824511790d1991dd36a603d12465de8c3688e7194c2b9557f288c587ffa04738c2ce
|
||||
DIST rustc-1.58.1-src.tar.xz.asc 801 BLAKE2B f0b600a503b0ca777dd5d690dca7252ecc6d7d49ca4a9cc8edc0647038f727e9052a861f9868292f837d78d6b02efe9ed5efa85843262c44cf6f73254cc7c9b0 SHA512 983c1ffdc4febf8bce6efc123c76b13f233772bc0a152ffaeb7ebf8f1f7b82a6b5d653407a4d293953d6fbf62c0df4ff4d398a1133061b53ae0f85317a14380b
|
||||
EBUILD rust-1.39.0.ebuild 2854 BLAKE2B df06652e7ac1b634ab1058a76cedcb1655ade481b85e97334639c68a8adc8c9f49f84057c71220680067a6b6a87c19d96f6281603fc711453167d290a302037a SHA512 5d06aa318dedef654ab75362cfbc075e6e526a75fb7927a998e20d8d5ac4de062e6373087c6e56e522b1e1b24cdfc5ea1c69fe2e16c9b452394731e759ba71de
|
||||
EBUILD rust-1.40.0.ebuild 7700 BLAKE2B 05d38ecd23c889dbbeff398ae0eaf002d2bd4e58f6bdd1b538f8f15694d257932b3cbbf305b9d550021b4fe71eefd31b0e7a87475160676a35d85196817c1d64 SHA512 b847237e1f35ddb3b9af51e859bfdcaf0f79ffa0b10e9cf2cbfedaa0edb6902f8fe334f12505d7c1d52e0c61770bad797704f776c6d866dd86444ee99640465e
|
||||
EBUILD rust-1.41.1.ebuild 7700 BLAKE2B 05d38ecd23c889dbbeff398ae0eaf002d2bd4e58f6bdd1b538f8f15694d257932b3cbbf305b9d550021b4fe71eefd31b0e7a87475160676a35d85196817c1d64 SHA512 b847237e1f35ddb3b9af51e859bfdcaf0f79ffa0b10e9cf2cbfedaa0edb6902f8fe334f12505d7c1d52e0c61770bad797704f776c6d866dd86444ee99640465e
|
||||
|
@ -37,3 +41,4 @@ EBUILD rust-1.54.0.ebuild 7655 BLAKE2B c3f6b1815c3ebed28f5c71085898c33861c073207
|
|||
EBUILD rust-1.55.0.ebuild 7655 BLAKE2B c3f6b1815c3ebed28f5c71085898c33861c0732075d9a1ee97b2178def3fc188f82ec49e51f6a44e97d6d93d68c002029365826ccb661639d108435a25822ebd SHA512 99d21d428fe31e7439c0b02e3450d58576b4d49db791f8223f1382c9a503b2e55ae1f6a8881b00a84d0b95b9b08f742c3019cda70eb83628d5e5d9efa0bb00ba
|
||||
EBUILD rust-1.56.1.ebuild 7655 BLAKE2B c3f6b1815c3ebed28f5c71085898c33861c0732075d9a1ee97b2178def3fc188f82ec49e51f6a44e97d6d93d68c002029365826ccb661639d108435a25822ebd SHA512 99d21d428fe31e7439c0b02e3450d58576b4d49db791f8223f1382c9a503b2e55ae1f6a8881b00a84d0b95b9b08f742c3019cda70eb83628d5e5d9efa0bb00ba
|
||||
EBUILD rust-1.57.0.ebuild 7655 BLAKE2B c3f6b1815c3ebed28f5c71085898c33861c0732075d9a1ee97b2178def3fc188f82ec49e51f6a44e97d6d93d68c002029365826ccb661639d108435a25822ebd SHA512 99d21d428fe31e7439c0b02e3450d58576b4d49db791f8223f1382c9a503b2e55ae1f6a8881b00a84d0b95b9b08f742c3019cda70eb83628d5e5d9efa0bb00ba
|
||||
EBUILD rust-1.58.1.ebuild 20385 BLAKE2B 21f953a636639e4f0a283ae4a9bdd152088863b3f20ed47a22b750b4ca06fbebb8a7fa9d3a3031b232fb0867ef8aa9923325ac65a881dc4a41d65095bf9dd752 SHA512 9ee25037488653e99039dac88086f5cfd5e4f4ff4c147333f1ee915ade858a90b8f64dd7c59b993a7a315c1b8e92fffa0ff79edce82c49624cb75a4f6b066d9f
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
From 671ef2d1c228aed031b4232b8bea96f17b825263 Mon Sep 17 00:00:00 2001
|
||||
From: Georgy Yakovlev <gyakovlev@gentoo.org>
|
||||
Date: Mon, 23 Nov 2020 14:52:04 -0800
|
||||
Subject: [PATCH] add gentoo musl target specs
|
||||
|
||||
---
|
||||
.../src/spec/aarch64_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
.../src/spec/armv7_gentoo_linux_musleabihf.rs | 11 +++++++++++
|
||||
.../rustc_target/src/spec/i686_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
compiler/rustc_target/src/spec/mod.rs | 8 ++++++++
|
||||
.../src/spec/powerpc64_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
.../src/spec/powerpc64le_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
.../src/spec/powerpc_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
.../rustc_target/src/spec/x86_64_gentoo_linux_musl.rs | 11 +++++++++++
|
||||
8 files changed, 85 insertions(+)
|
||||
create mode 100644 compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs
|
||||
create mode 100644 compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs
|
||||
|
||||
diff --git a/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..420fe7c
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/aarch64_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::aarch64_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "aarch64-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs b/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs
|
||||
new file mode 100644
|
||||
index 0000000..067e2d6
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/armv7_gentoo_linux_musleabihf.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::armv7_unknown_linux_musleabihf::target();
|
||||
+
|
||||
+ base.llvm_target = "armv7-gentoo-linux-musleabihf".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..1cd39cd
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/i686_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::i686_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "i686-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
|
||||
index f1e8330..d8c0ba0 100644
|
||||
--- a/compiler/rustc_target/src/spec/mod.rs
|
||||
+++ b/compiler/rustc_target/src/spec/mod.rs
|
||||
@@ -490,6 +490,14 @@ macro_rules! supported_targets {
|
||||
}
|
||||
|
||||
supported_targets! {
|
||||
+ ("aarch64-gentoo-linux-musl", aarch64_gentoo_linux_musl),
|
||||
+ ("armv7-gentoo-linux-musleabihf", armv7_gentoo_linux_musleabihf),
|
||||
+ ("i686-gentoo-linux-musl", i686_gentoo_linux_musl),
|
||||
+ ("powerpc-gentoo-linux-musl", powerpc_gentoo_linux_musl),
|
||||
+ ("powerpc64-gentoo-linux-musl", powerpc64_gentoo_linux_musl),
|
||||
+ ("powerpc64le-gentoo-linux-musl", powerpc64le_gentoo_linux_musl),
|
||||
+ ("x86_64-gentoo-linux-musl", x86_64_gentoo_linux_musl),
|
||||
+
|
||||
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
|
||||
("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
|
||||
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
|
||||
diff --git a/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..e840bb2
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/powerpc64_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::powerpc64_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "powerpc64-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..1037d82
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/powerpc64le_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::powerpc64le_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "powerpc64le-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..a623ffe
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/powerpc_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::powerpc_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "powerpc-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
diff --git a/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs b/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs
|
||||
new file mode 100644
|
||||
index 0000000..f330473
|
||||
--- /dev/null
|
||||
+++ b/compiler/rustc_target/src/spec/x86_64_gentoo_linux_musl.rs
|
||||
@@ -0,0 +1,11 @@
|
||||
+use crate::spec::Target;
|
||||
+
|
||||
+pub fn target() -> Target {
|
||||
+ let mut base = super::x86_64_unknown_linux_musl::target();
|
||||
+
|
||||
+ base.llvm_target = "x86_64-gentoo-linux-musl".to_string();
|
||||
+ base.options.vendor = "gentoo".to_string();
|
||||
+ base.options.crt_static_default = false;
|
||||
+
|
||||
+ base
|
||||
+}
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
From 1879d1d1a284bf51c752e47db284ce22701ed5d0 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Holland <samuel@sholland.org>
|
||||
Date: Sun, 16 Sep 2018 16:38:48 +0000
|
||||
Subject: [PATCH 12/15] Ignore broken and non-applicable tests
|
||||
|
||||
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, #56475
|
||||
env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox)
|
||||
long-linker-command-lines: takes >10 minutes to run (but still passes)
|
||||
simd-intrinsic-generic-bitmask.rs: broken on BE, #59356
|
||||
sparc-struct-abi: no sparc target
|
||||
sysroot-crates-are-unstable: can't run rustc without RPATH
|
||||
---
|
||||
src/test/codegen/sparc-struct-abi.rs | 1 +
|
||||
src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile | 2 ++
|
||||
src/test/run-make-fulldeps/long-linker-command-lines/Makefile | 2 ++
|
||||
src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile | 2 ++
|
||||
src/test/ui/env-funky-keys.rs | 1 +
|
||||
6 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs
|
||||
index 78e5b14a212..6f93e93286b 100644
|
||||
--- a/src/test/codegen/sparc-struct-abi.rs
|
||||
+++ b/src/test/codegen/sparc-struct-abi.rs
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// only-sparc64
|
||||
// compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib
|
||||
// needs-llvm-components: sparc
|
||||
+// ignore-test
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
|
||||
diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile
|
||||
index f124ca2ab61..363b18f0985 100644
|
||||
--- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile
|
||||
+++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile
|
||||
@@ -1,3 +1,5 @@
|
||||
+# ignore-aarch64
|
||||
+
|
||||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
diff --git a/src/test/run-make-fulldeps/long-linker-command-lines/Makefile b/src/test/run-make-fulldeps/long-linker-command-lines/Makefile
|
||||
index 5876fbc94bc..5f167ece1a2 100644
|
||||
--- a/src/test/run-make-fulldeps/long-linker-command-lines/Makefile
|
||||
+++ b/src/test/run-make-fulldeps/long-linker-command-lines/Makefile
|
||||
@@ -1,3 +1,5 @@
|
||||
+# ignore-test
|
||||
+
|
||||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
|
||||
index 9e770706857..6d92ec5cec8 100644
|
||||
--- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
|
||||
+++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile
|
||||
@@ -1,1 +1,3 @@
|
||||
+# ignore-test
|
||||
+
|
||||
all:
|
||||
python2.7 test.py
|
||||
diff --git a/src/test/ui/env-funky-keys.rs b/src/test/ui/env-funky-keys.rs
|
||||
index c5c824ac58d..f3fe047a79c 100644
|
||||
--- a/src/test/ui/env-funky-keys.rs
|
||||
+++ b/src/test/ui/env-funky-keys.rs
|
||||
@@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// Ignore this test on Android, because it segfaults there.
|
||||
|
||||
+// ignore-test
|
||||
// ignore-android
|
||||
// ignore-windows
|
||||
// ignore-cloudabi no execve
|
||||
--
|
||||
2.24.1
|
||||
|
|
@ -0,0 +1,679 @@
|
|||
# Copyright 1999-2022 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
PYTHON_COMPAT=( python3_{7..10} )
|
||||
|
||||
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \
|
||||
multilib multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig
|
||||
|
||||
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 -> rustc-${PV}-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 arm arm64 ppc64 ~riscv x86"
|
||||
fi
|
||||
|
||||
RUST_STAGE0_VERSION="1.$(($(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}
|
||||
verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc )
|
||||
"
|
||||
|
||||
# keep in sync with llvm ebuild of the same version as bundled one.
|
||||
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430
|
||||
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly 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="clippy cpu_flags_x86_sse2 debug dist doc miri nightly parallel-compiler rls rustfmt rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
|
||||
|
||||
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
|
||||
# we need to *really* make sure we're not pulling more than one slot
|
||||
# simultaneously.
|
||||
|
||||
# How to use it:
|
||||
# List all the working slots in LLVM_VALID_SLOTS, newest first.
|
||||
LLVM_VALID_SLOTS=( 13 )
|
||||
LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}"
|
||||
|
||||
# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation
|
||||
# (-) usedep needed because we may build with older llvm without that target
|
||||
LLVM_DEPEND="|| ( "
|
||||
for _s in ${LLVM_VALID_SLOTS[@]}; do
|
||||
LLVM_DEPEND+=" ( "
|
||||
for _x in ${ALL_LLVM_TARGETS[@]}; do
|
||||
LLVM_DEPEND+="
|
||||
${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] )"
|
||||
done
|
||||
LLVM_DEPEND+=" )"
|
||||
done
|
||||
unset _s _x
|
||||
LLVM_DEPEND+=" )
|
||||
<sys-devel/llvm-$(( LLVM_MAX_SLOT + 1 )):=
|
||||
wasm? ( sys-devel/lld )
|
||||
"
|
||||
|
||||
# to bootstrap we need at least exactly previous version, or same.
|
||||
# most of the time previous versions fail to bootstrap with newer
|
||||
# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok,
|
||||
# but it fails to bootstrap with 1.48.x
|
||||
# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt
|
||||
RUST_DEP_PREV="$(ver_cut 1).$(($(ver_cut 2) - 1))*"
|
||||
RUST_DEP_CURR="$(ver_cut 1).$(ver_cut 2)*"
|
||||
BOOTSTRAP_DEPEND="=dev-lang/rust-${RUST_DEP_PREV}"
|
||||
|
||||
BDEPEND="${PYTHON_DEPS}
|
||||
app-eselect/eselect-rust
|
||||
|| (
|
||||
>=sys-devel/gcc-4.7
|
||||
>=sys-devel/clang-3.5
|
||||
)
|
||||
${BOOTSTRAP_DEPEND}
|
||||
!system-llvm? (
|
||||
>=dev-util/cmake-3.13.4
|
||||
dev-util/ninja
|
||||
)
|
||||
test? ( sys-devel/gdb )
|
||||
verify-sig? ( sec-keys/openpgp-keys-rust )
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
>=app-arch/xz-utils-5.2
|
||||
net-misc/curl:=[http2,ssl]
|
||||
sys-libs/zlib:=
|
||||
dev-libs/openssl:0=
|
||||
elibc_musl? ( sys-libs/libunwind:= )
|
||||
system-llvm? ( ${LLVM_DEPEND} )
|
||||
"
|
||||
|
||||
# we need to block older versions due to layout changes.
|
||||
RDEPEND="${DEPEND}
|
||||
app-eselect/eselect-rust
|
||||
!<dev-lang/rust-1.47.0-r1
|
||||
!<dev-lang/rust-bin-1.47.0-r1
|
||||
"
|
||||
|
||||
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
|
||||
miri? ( nightly )
|
||||
parallel-compiler? ( nightly )
|
||||
rls? ( rust-src )
|
||||
test? ( ${ALL_LLVM_TARGETS[*]} )
|
||||
wasm? ( llvm_targets_WebAssembly )
|
||||
x86? ( cpu_flags_x86_sse2 )
|
||||
"
|
||||
|
||||
# we don't use cmake.eclass, but can get a warning
|
||||
CMAKE_WARN_UNUSED_CLI=no
|
||||
|
||||
QA_FLAGS_IGNORED="
|
||||
usr/lib/${PN}/${PV}/bin/.*
|
||||
usr/lib/${PN}/${PV}/libexec/.*
|
||||
usr/lib/${PN}/${PV}/lib/lib.*.so
|
||||
usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/.*
|
||||
usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so
|
||||
"
|
||||
|
||||
QA_SONAME="
|
||||
usr/lib/${PN}/${PV}/lib/lib.*.so.*
|
||||
usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/lib.*.so
|
||||
"
|
||||
|
||||
QA_PRESTRIPPED="
|
||||
usr/lib/${PN}/${PV}/lib/rustlib/.*/bin/rust-llvm-dwp
|
||||
"
|
||||
|
||||
# An rmeta file is custom binary format that contains the metadata for the crate.
|
||||
# rmeta files do not support linking, since they do not contain compiled object files.
|
||||
# so we can safely silence the warning for this QA check.
|
||||
QA_EXECSTACK="usr/lib/${PN}/${PV}/lib/rustlib/*/lib*.rlib:lib.rmeta"
|
||||
|
||||
# causes double bootstrap
|
||||
RESTRICT="test"
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/rust.asc
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/1.55.0-ignore-broken-and-non-applicable-tests.patch
|
||||
"${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch
|
||||
)
|
||||
|
||||
S="${WORKDIR}/${MY_P}-src"
|
||||
|
||||
toml_usex() {
|
||||
usex "${1}" true false
|
||||
}
|
||||
|
||||
bootstrap_rust_version_check() {
|
||||
# never call from pkg_pretend. eselect-rust may be not installed yet.
|
||||
[[ ${MERGE_TYPE} == binary ]] && return
|
||||
local rustc_wanted="$(ver_cut 1).$(($(ver_cut 2) - 1))"
|
||||
local rustc_toonew="$(ver_cut 1).$(($(ver_cut 2) + 1))"
|
||||
local rustc_version=( $(eselect --brief rust show 2>/dev/null) )
|
||||
rustc_version=${rustc_version[0]#rust-bin-}
|
||||
rustc_version=${rustc_version#rust-}
|
||||
|
||||
[[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output"
|
||||
|
||||
if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then
|
||||
eerror "Rust >=${rustc_wanted} is required"
|
||||
eerror "please run 'eselect rust' and set correct rust version"
|
||||
die "selected rust version is too old"
|
||||
elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then
|
||||
eerror "Rust <${rustc_toonew} is required"
|
||||
eerror "please run 'eselect rust' and set correct rust version"
|
||||
die "selected rust version is too new"
|
||||
else
|
||||
einfo "Using rust ${rustc_version} to build"
|
||||
fi
|
||||
}
|
||||
|
||||
pre_build_checks() {
|
||||
local M=4096
|
||||
# multiply requirements by 1.5 if we are doing x86-multilib
|
||||
if use amd64; then
|
||||
M=$(( $(usex abi_x86_32 15 10) * ${M} / 10 ))
|
||||
fi
|
||||
M=$(( $(usex clippy 128 0) + ${M} ))
|
||||
M=$(( $(usex miri 128 0) + ${M} ))
|
||||
M=$(( $(usex rls 512 0) + ${M} ))
|
||||
M=$(( $(usex rustfmt 256 0) + ${M} ))
|
||||
# add 2G if we compile llvm and 256M per llvm_target
|
||||
if ! use system-llvm; then
|
||||
M=$(( 2048 + ${M} ))
|
||||
local ltarget
|
||||
for ltarget in ${ALL_LLVM_TARGETS[@]}; do
|
||||
M=$(( $(usex ${ltarget} 256 0) + ${M} ))
|
||||
done
|
||||
fi
|
||||
M=$(( $(usex wasm 256 0) + ${M} ))
|
||||
M=$(( $(usex debug 2 1) * ${M} ))
|
||||
eshopts_push -s extglob
|
||||
if is-flagq '-g?(gdb)?([1-9])'; then
|
||||
M=$(( 15 * ${M} / 10 ))
|
||||
fi
|
||||
eshopts_pop
|
||||
M=$(( $(usex doc 256 0) + ${M} ))
|
||||
CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
|
||||
}
|
||||
|
||||
llvm_check_deps() {
|
||||
has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]"
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
pre_build_checks
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
pre_build_checks
|
||||
python-any-r1_pkg_setup
|
||||
|
||||
export LIBGIT2_NO_PKG_CONFIG=1 #749381
|
||||
|
||||
bootstrap_rust_version_check
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local rust_target="" rust_targets="" arch_cflags
|
||||
|
||||
# Collect rust target names to compile standard libs for all ABIs.
|
||||
for v in $(multilib_get_enabled_abi_pairs); do
|
||||
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
|
||||
done
|
||||
if use wasm; then
|
||||
rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
|
||||
if use system-llvm; then
|
||||
# un-hardcode rust-lld linker for this target
|
||||
# https://bugs.gentoo.org/715348
|
||||
sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die
|
||||
fi
|
||||
fi
|
||||
rust_targets="${rust_targets#,}"
|
||||
|
||||
local tools="\"cargo\","
|
||||
if use clippy; then
|
||||
tools="\"clippy\",$tools"
|
||||
fi
|
||||
if use miri; then
|
||||
tools="\"miri\",$tools"
|
||||
fi
|
||||
if use rls; then
|
||||
tools="\"rls\",\"analysis\",$tools"
|
||||
fi
|
||||
if use rustfmt; then
|
||||
tools="\"rustfmt\",$tools"
|
||||
fi
|
||||
if use rust-src; then
|
||||
tools="\"src\",$tools"
|
||||
fi
|
||||
|
||||
local rust_stage0_root
|
||||
rust_stage0_root="$(rustc --print sysroot || die "Can't determine rust's sysroot")"
|
||||
|
||||
# in case of prefix it will be already prefixed, as --print sysroot returns full path
|
||||
[[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory"
|
||||
|
||||
rust_target="$(rust_abi)"
|
||||
|
||||
cat <<- _EOF_ > "${S}"/config.toml
|
||||
changelog-seen = 2
|
||||
[llvm]
|
||||
download-ci-llvm = false
|
||||
optimize = $(toml_usex !debug)
|
||||
release-debuginfo = $(toml_usex debug)
|
||||
assertions = $(toml_usex debug)
|
||||
ninja = true
|
||||
targets = "${LLVM_TARGETS// /;}"
|
||||
experimental-targets = ""
|
||||
link-shared = $(toml_usex system-llvm)
|
||||
$(case "${rust_target}" in
|
||||
i586-*-linux-*)
|
||||
# https://github.com/rust-lang/rust/issues/93059
|
||||
echo 'cflags = "-fcf-protection=none"'
|
||||
echo 'cxxflags = "-fcf-protection=none"'
|
||||
echo 'ldflags = "-fcf-protection=none"'
|
||||
;;
|
||||
esac)
|
||||
[build]
|
||||
build-stage = 2
|
||||
test-stage = 2
|
||||
doc-stage = 2
|
||||
build = "${rust_target}"
|
||||
host = ["${rust_target}"]
|
||||
target = [${rust_targets}]
|
||||
cargo = "${rust_stage0_root}/bin/cargo"
|
||||
rustc = "${rust_stage0_root}/bin/rustc"
|
||||
rustfmt = "${rust_stage0_root}/bin/rustfmt"
|
||||
docs = $(toml_usex doc)
|
||||
compiler-docs = false
|
||||
submodules = false
|
||||
python = "${EPYTHON}"
|
||||
locked-deps = true
|
||||
vendor = true
|
||||
extended = true
|
||||
tools = [${tools}]
|
||||
verbose = 2
|
||||
sanitizers = false
|
||||
profiler = false
|
||||
cargo-native-static = false
|
||||
[install]
|
||||
prefix = "${EPREFIX}/usr/lib/${PN}/${PV}"
|
||||
sysconfdir = "etc"
|
||||
docdir = "share/doc/rust"
|
||||
bindir = "bin"
|
||||
libdir = "lib"
|
||||
mandir = "share/man"
|
||||
[rust]
|
||||
# https://github.com/rust-lang/rust/issues/54872
|
||||
codegen-units-std = 1
|
||||
optimize = true
|
||||
debug = $(toml_usex debug)
|
||||
debug-assertions = $(toml_usex debug)
|
||||
debug-assertions-std = $(toml_usex debug)
|
||||
debuginfo-level = $(usex debug 2 0)
|
||||
debuginfo-level-rustc = $(usex debug 2 0)
|
||||
debuginfo-level-std = $(usex debug 2 0)
|
||||
debuginfo-level-tools = $(usex debug 2 0)
|
||||
debuginfo-level-tests = 0
|
||||
backtrace = true
|
||||
incremental = false
|
||||
default-linker = "$(tc-getCC)"
|
||||
parallel-compiler = $(toml_usex parallel-compiler)
|
||||
channel = "$(usex nightly nightly stable)"
|
||||
description = "gentoo"
|
||||
rpath = false
|
||||
verbose-tests = true
|
||||
optimize-tests = $(toml_usex !debug)
|
||||
codegen-tests = true
|
||||
dist-src = false
|
||||
remap-debuginfo = true
|
||||
lld = $(usex system-llvm false $(toml_usex wasm))
|
||||
# only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it
|
||||
# https://github.com/rust-lang/rust/issues/74976
|
||||
# https://github.com/rust-lang/rust/issues/76526
|
||||
deny-warnings = $(usex wasm $(usex doc false true) true)
|
||||
backtrace-on-ice = true
|
||||
jemalloc = false
|
||||
[dist]
|
||||
src-tarball = false
|
||||
compression-formats = ["xz"]
|
||||
_EOF_
|
||||
|
||||
for v in $(multilib_get_enabled_abi_pairs); do
|
||||
rust_target=$(rust_abi $(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}]
|
||||
ar = "$(tc-getAR)"
|
||||
cc = "$(tc-getCC)"
|
||||
cxx = "$(tc-getCXX)"
|
||||
linker = "$(tc-getCC)"
|
||||
ranlib = "$(tc-getRANLIB)"
|
||||
_EOF_
|
||||
# librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
|
||||
if use elibc_musl; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
crt-static = false
|
||||
_EOF_
|
||||
fi
|
||||
if use system-llvm; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
|
||||
_EOF_
|
||||
fi
|
||||
done
|
||||
if use wasm; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
[target.wasm32-unknown-unknown]
|
||||
linker = "$(usex system-llvm lld rust-lld)"
|
||||
_EOF_
|
||||
fi
|
||||
|
||||
if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below
|
||||
# experimental cross support
|
||||
# discussion: https://bugs.gentoo.org/679878
|
||||
# TODO: c*flags, clang, system-llvm, cargo.eclass target support
|
||||
# it would be much better if we could split out stdlib
|
||||
# complilation to separate ebuild and abuse CATEGORY to
|
||||
# just install to /usr/lib/rustlib/<target>
|
||||
|
||||
# extra targets defined as a bash array
|
||||
# spec format: <LLVM target>:<rust-target>:<CTARGET>
|
||||
# best place would be /etc/portage/env/dev-lang/rust
|
||||
# Example:
|
||||
# RUST_CROSS_TARGETS=(
|
||||
# "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu"
|
||||
# )
|
||||
# no extra hand holding is done, no target transformations, all
|
||||
# values are passed as-is with just basic checks, so it's up to user to supply correct values
|
||||
# valid rust targets can be obtained with
|
||||
# rustc --print target-list
|
||||
# matching cross toolchain has to be installed
|
||||
# matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one)
|
||||
# only gcc toolchains installed with crossdev are checked for now.
|
||||
|
||||
# BUG: we can't pass host flags to cross compiler, so just filter for now
|
||||
# BUG: this should be more fine-grained.
|
||||
filter-flags '-mcpu=*' '-march=*' '-mtune=*'
|
||||
|
||||
local cross_target_spec
|
||||
for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do
|
||||
# extracts first element form <LLVM target>:<rust-target>:<CTARGET>
|
||||
local cross_llvm_target="${cross_target_spec%%:*}"
|
||||
# extracts toolchain triples, <rust-target>:<CTARGET>
|
||||
local cross_triples="${cross_target_spec#*:}"
|
||||
# extracts first element after before : separator
|
||||
local cross_rust_target="${cross_triples%%:*}"
|
||||
# extracts last element after : separator
|
||||
local cross_toolchain="${cross_triples##*:}"
|
||||
use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled"
|
||||
command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain"
|
||||
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
[target.${cross_rust_target}]
|
||||
ar = "${cross_toolchain}-ar"
|
||||
cc = "${cross_toolchain}-gcc"
|
||||
cxx = "${cross_toolchain}-g++"
|
||||
linker = "${cross_toolchain}-gcc"
|
||||
ranlib = "${cross_toolchain}-ranlib"
|
||||
_EOF_
|
||||
if use system-llvm; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config"
|
||||
_EOF_
|
||||
fi
|
||||
if [[ "${cross_toolchain}" == *-musl* ]]; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr"
|
||||
_EOF_
|
||||
fi
|
||||
|
||||
# append cross target to "normal" target list
|
||||
# example 'target = ["powerpc64le-unknown-linux-gnu"]'
|
||||
# becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]'
|
||||
|
||||
rust_targets="${rust_targets},\"${cross_rust_target}\""
|
||||
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die
|
||||
|
||||
ewarn
|
||||
ewarn "Enabled ${cross_rust_target} rust target"
|
||||
ewarn "Using ${cross_toolchain} cross toolchain"
|
||||
ewarn
|
||||
if ! has_version -b 'sys-devel/binutils[multitarget]' ; then
|
||||
ewarn "'sys-devel/binutils[multitarget]' is not installed"
|
||||
ewarn "'strip' will be unable to strip cross libraries"
|
||||
ewarn "cross targets will be installed with full debug information"
|
||||
ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files"
|
||||
ewarn
|
||||
ewarn "Alternatively llvm-strip can be used, it supports stripping any target"
|
||||
ewarn "define STRIP=\"llvm-strip\" to use it (experimental)"
|
||||
ewarn
|
||||
fi
|
||||
done
|
||||
fi # I_KNOW_WHAT_I_AM_DOING_CROSS
|
||||
|
||||
einfo "Rust configured with the following flags:"
|
||||
echo
|
||||
echo RUSTFLAGS="${RUSTFLAGS:-}"
|
||||
echo RUSTFLAGS_BOOTSTRAP="${RUSTFLAGS_BOOTSTRAP:-}"
|
||||
echo RUSTFLAGS_NOT_BOOTSTRAP="${RUSTFLAGS_NOT_BOOTSTRAP:-}"
|
||||
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
|
||||
cat "${S}"/config.env || die
|
||||
echo
|
||||
einfo "config.toml contents:"
|
||||
cat "${S}"/config.toml || die
|
||||
echo
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# we need \n IFS to have config.env with spaces loaded properly. #734018
|
||||
(
|
||||
IFS=$'\n'
|
||||
env $(cat "${S}"/config.env) RUST_BACKTRACE=1\
|
||||
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
|
||||
)
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# https://rustc-dev-guide.rust-lang.org/tests/intro.html
|
||||
|
||||
# those are basic and codegen tests.
|
||||
local tests=(
|
||||
codegen
|
||||
codegen-units
|
||||
compile-fail
|
||||
incremental
|
||||
mir-opt
|
||||
pretty
|
||||
run-make
|
||||
)
|
||||
|
||||
# fails if llvm is not built with ALL targets.
|
||||
# and known to fail with system llvm sometimes.
|
||||
use system-llvm || tests+=( assembly )
|
||||
|
||||
# fragile/expensive/less important tests
|
||||
# or tests that require extra builds
|
||||
# TODO: instead of skipping, just make some nonfatal.
|
||||
if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then
|
||||
tests+=(
|
||||
rustdoc
|
||||
rustdoc-js
|
||||
rustdoc-js-std
|
||||
rustdoc-ui
|
||||
run-make-fulldeps
|
||||
ui
|
||||
ui-fulldeps
|
||||
)
|
||||
fi
|
||||
|
||||
local i failed=()
|
||||
einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}"
|
||||
for i in "${tests[@]}"; do
|
||||
local t="src/test/${i}"
|
||||
einfo "rust_src_test: running ${t}"
|
||||
if ! (
|
||||
IFS=$'\n'
|
||||
env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \
|
||||
"${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
|
||||
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
|
||||
)
|
||||
then
|
||||
failed+=( "${t}" )
|
||||
eerror "rust_src_test: ${t} failed"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#failed[@]} -ne 0 ]]; then
|
||||
eerror "rust_src_test: failure summary: ${failed[@]}"
|
||||
die "aborting due to test failures"
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
(
|
||||
IFS=$'\n'
|
||||
env $(cat "${S}"/config.env) DESTDIR="${D}" \
|
||||
"${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
|
||||
)
|
||||
|
||||
# bug #689562, #689160
|
||||
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
|
||||
rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die
|
||||
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
|
||||
|
||||
local symlinks=(
|
||||
cargo
|
||||
rustc
|
||||
rustdoc
|
||||
rust-gdb
|
||||
rust-gdbgui
|
||||
rust-lldb
|
||||
)
|
||||
|
||||
use clippy && symlinks+=( clippy-driver cargo-clippy )
|
||||
use miri && symlinks+=( miri cargo-miri )
|
||||
use rls && symlinks+=( rls )
|
||||
use rustfmt && symlinks+=( rustfmt cargo-fmt )
|
||||
|
||||
einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}"
|
||||
local i
|
||||
for i in "${symlinks[@]}"; do
|
||||
# we need realpath on /usr/bin/* symlink return version-appended binary path.
|
||||
# so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver>
|
||||
# need to fix eselect-rust to remove this hack.
|
||||
local ver_i="${i}-${PV}"
|
||||
if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then
|
||||
einfo "Installing ${i} symlink"
|
||||
ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die
|
||||
else
|
||||
ewarn "${i} symlink requested, but source file not found"
|
||||
ewarn "please report this"
|
||||
fi
|
||||
dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}"
|
||||
done
|
||||
|
||||
# symlinks to switch components to active rust in eselect
|
||||
dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}"
|
||||
dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}"
|
||||
dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}"
|
||||
dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}"
|
||||
dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}"
|
||||
|
||||
newenvd - "50${P}" <<-_EOF_
|
||||
LDPATH="${EPREFIX}/usr/lib/rust/lib"
|
||||
MANPATH="${EPREFIX}/usr/lib/rust/man"
|
||||
$(use amd64 && usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '')
|
||||
$(use arm64 && usex elibc_musl 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '')
|
||||
_EOF_
|
||||
|
||||
rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die
|
||||
rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die
|
||||
|
||||
# note: eselect-rust adds EROOT to all paths below
|
||||
cat <<-_EOF_ > "${T}/provider-${P}"
|
||||
/usr/bin/cargo
|
||||
/usr/bin/rustdoc
|
||||
/usr/bin/rust-gdb
|
||||
/usr/bin/rust-gdbgui
|
||||
/usr/bin/rust-lldb
|
||||
/usr/lib/rustlib
|
||||
/usr/lib/rust/lib
|
||||
/usr/lib/rust/libexec
|
||||
/usr/lib/rust/man
|
||||
/usr/share/doc/rust
|
||||
_EOF_
|
||||
|
||||
if use clippy; then
|
||||
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
|
||||
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
|
||||
fi
|
||||
if use miri; then
|
||||
echo /usr/bin/miri >> "${T}/provider-${P}"
|
||||
echo /usr/bin/cargo-miri >> "${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
|
||||
|
||||
insinto /etc/env.d/rust
|
||||
doins "${T}/provider-${P}"
|
||||
|
||||
if use dist; then
|
||||
insinto "/usr/lib/${PN}/${PV}/dist"
|
||||
doins -r "${S}/build/dist/."
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
eselect rust update
|
||||
|
||||
if has_version sys-devel/gdb || has_version dev-util/lldb; then
|
||||
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}."
|
||||
fi
|
||||
|
||||
if has_version app-editors/emacs; 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
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
eselect rust cleanup
|
||||
}
|
Loading…
Reference in New Issue