dev-lang/rust: Sync with Gentoo

It's from Gentoo commit dc7aaf972ca0e70c9140fe43a0f9d7ac235190d8.
This commit is contained in:
Flatcar Buildbot 2025-06-16 07:07:54 +00:00 committed by Krzesimir Nowak
parent 5b13a80438
commit 6ad30946b9
45 changed files with 1879 additions and 2713 deletions

View File

@ -1,5 +1,21 @@
DIST rustc-1.71.1-src.tar.xz 151983068 BLAKE2B 3dfdbc246feb84a79ae94c2de978c5585ee06cf6b683d2245869b62e28f7c79f89cc589f5431537713bf088236a0b824acefc1b68e418e9eb72e1eea98054e3f SHA512 fd0e5a16bdbeb539184513583089e55f681cb772810df357b6b1464853f7022ac02edab3dd155b2262ed0047e2a25dea3808dd078dcdfce9d399384465009db4
DIST rustc-1.71.1-src.tar.xz.asc 801 BLAKE2B a88c073a70552d73e2d7695eceabdaa478f34501b7271fabf7f4a09f3efa545181f34353e45776b05918e6aeba88adb02f9731454f7085a7abf1602fc6589983 SHA512 9dd0406cf22f1daa7fcfd015fc1c6f8d36586aa99bf14c1491ee464c1f892ab759feb83e8b55b64713170fb777fdbe038fb5fd01a59c911b6599223baaba0677
DIST rust-patches-1.74.1-r101.tar.bz2 3887 BLAKE2B 0afb0252fe56ac8c572fe20acd989f9ef3f33cb8134cdb8fbf5cb064156556aedeb226fd50af465f35f656ebd0c0a163ca060490f44811def8535bad70f5f24d SHA512 7253728000d49fd8533182aa8961e70aef41a48e2df03e72d1ea93ca7abb924bbe1689692d874f2b18469e5a54ea572e55ddc18c9f4d81d1e8ec380f2d72095b
DIST rust-patches-1.75.0-r101.tar.bz2 4419 BLAKE2B 389a688a6e92d5f9325bade125b006deb7453d9d7ae0483c8ec0cf580f95eb03a65f600e79ed354029b4b91ab8f66929877bdc6ebf83e7b8d3b1d9451fecd8b6 SHA512 6f36e9e13e590bff72483ea4364c045579858da5db3868048f79e0dd6ac896aaf00a1fb9d156820e742a1f5ec412ddfa897677133669b77a4f219c6d90365775
DIST rust-patches-1.76.0-r101.tar.bz2 5513 BLAKE2B 52816dffac969520e7b73ceaae1201bb7abba129da1021e8e39ccd6e471281c51cf005221589c7b08fc328be54ba2d6134fc8e240cb15f0b877e370009937084 SHA512 a65d306d709e99c688e4febb439a60f9ac8b506a86fdb3021782dfbb8991ddcc07adcd19494a8e76233ad2bec7f23896b6eb80c13929b7c997fdc3fd45f8b63a
DIST rust-patches-1.77.1-r101.tar.bz2 4937 BLAKE2B 2b6cdb6d61c7bde5cfaaeea4ae0076acc4d43375805567a48d10b4c9a622ad6234dc5725c30df7ab26d8d67566f405d89b1fff384f263cf3dd404e4298a53801 SHA512 e9d16860549f2698957cbd8dd46278a5706c630ff78b8d1199be1b9ba724e60e8ae7020b0a30695841f77053294c043e5957425573db709f30a7b40d4cb53613
DIST rust-patches-1.78.0-r101.tar.bz2 4098 BLAKE2B a62ed3ca1b0ac51c6b0b01653b5ea6e831794de983f72714da36ba508aef655b9255498d7fd0c05c5034ef70a319fc00b913c0fb81f7ae17721ee53ff5e45f92 SHA512 cbe95306fe97224f2921a5846204d49a84276a38047ad8f8256fdd349fd45a63b3462810c75384b079e2141ebee3288987e9a4510e2605a5ecbb8612084694e9
DIST rust-patches-1.79.0-r101.tar.bz2 4102 BLAKE2B 42c4202d778c286122bd00f758ad3ecc6c3fc2a3d8dda7bf49baec126a4ae1112846b0d1314d9331db99f762e971815fdd3b6e47fedb7a9ecedafbf2ffa08649 SHA512 7e518ccba28bafaf03e5512c4567e3b63d17a30e8df025a8ffe1d62c521db2986cdeb6a25cdacafe1e27d05eef01bed43ad42a9dc6a9d4bda1cf7cb98505673e
DIST rust-patches-1.80.1-r101.tar.bz2 3609 BLAKE2B d13296fb44c1ab4b6bc6133b64baf7073b686f4a93b0a75cde4e73f90ee84d009ea9c931c9244081e2c86b40a91829f3768e27c339a4e3d457cb01756f689fe6 SHA512 8c9e0d06af8ce2387355a8917383686f05021b4313c9b4f0a1eaf1a81fb08323686cff6ce06e013b6919f25a50a2a5fb5d0c605740e46c68677c4d665c069b41
DIST rust-patches-1.81.0-r101.tar.bz2 3607 BLAKE2B 7a200d740920b965f6ef97e23c1f0b20b5e0f055b0c3655c85d55cd11287c07c0c4b7149bccb4ab1a7982c5a8c75d8ad44272abac131f90bd9de161821548f80 SHA512 64af65287ed551143ba2bf2e6828e3ccdb5e92b393d8ad9fe9fa3e6b38c67c856f9e37caa9cf1441ce1c7a8e37e22d78f6d15d97713df66abd95798ae9d2da9f
DIST rust-patches-1.82.0-r103.tar.bz2 5843 BLAKE2B 0083bdbdfdf564fab9709bdffadd99de024296619aace7a0cfd8cef080ec002452b8e20bb61a3a828d3ae0cd3d5174a04d89ee6351fc976f0678b9ff0dee4eaf SHA512 71296ae4991f67a5983c54800eed58b15ab0a25aa117f5ac56131f9c895014bbc42feab5cc319fd97f0fc64e7715e6b945715375bc32890e6bc5bb308ec0a5a1
DIST rust-patches-1.83.0-r3.tar.bz2 5886 BLAKE2B e7506d4b2d137d7746bd85581170401a700dbedad7c1bb063fedbfd19021a7c6312d541d33dfc7444cfbee64bd3b904cbaf64233523f1e23743925868979b75f SHA512 0f79df5617f900420eacf1e100323defc8316ac3d7733a5ef127551cf6d6667e96bc337540a25f1d464d14e0b3815d66041a0bf7570f3279a978f6eef64dfccd
DIST rust-patches-1.84.0-r2.tar.bz2 2507 BLAKE2B ffe4e5fc49deebdb8b8b3022f951dfeaad15c57c0afe17b050489ee19419f66be0bf4349b300a91c316bf669d22627c7270c013264aee176e846f5b2894f66f0 SHA512 bca8e22947c8f9073e3de67030372f326b94aea28dbdc57bfe0f35f40df2bc6380f519ffe2cc0f4014830bc9fcc902612ccf104768bde94da9e4989245e31601
DIST rust-patches-1.84.1-r2.tar.bz2 2982 BLAKE2B 2f7addfa4530f3eab79f55ea44eee6390970874ae5ed40ef8706224024db47c861326dc5a79ed9bffcffbad5b27d44b6a3aebab7987fdb61124be3083fbabd71 SHA512 cc852e1e679827390134b47bfaa68567a75a5e8559a3caa24ab3931955050bac59f4fe6a4c249d83bde0aa25667ea04749f3763ff3566daa2999df8cbf2d0981
DIST rust-patches-1.85.0-r2.tar.bz2 4462 BLAKE2B 61cfde8688fecab1a5c3c80f29b37b691581f3f8be1648f9db34fff15026dab426458cba3b9f06fc5606a0a878b0527698ea6f94c7dff014e4339154ac907d13 SHA512 317ab0bcbb792faa1a761893264a29bd650b0d6c5ab17aa762075daccfda684bc6cdd20c0ef89b51bde1a7384fb1df576b18b5303115a8cf04877b435b2d6491
DIST rust-patches-1.85.1-r1.tar.bz2 4473 BLAKE2B fad2fe3222e2625b5cbc60ea1fb805080ce70f751c930c0e3bde9cf043059e1fc3ba4d8e618166fe99a7fcf12d5cccb684c05d4c2542a89c9794869204cbcb09 SHA512 edf680a1d3a29ae5d8140031dc8b232b747d08494db2f3393ccc286d9197139583bcaf536d5125b8c896a610c075115b9a16a6e6f3f6b5da60e58433f000dba6
DIST rust-patches-1.86.0-r2.tar.bz2 5980 BLAKE2B 179d6acc8c7006eac4d00e073ec1f5496756ef51d465bc098daf1cfe650f469f4341893c72a65e21d84ecb3ccaeb46f5204ef517ae942482d835f89c0a934391 SHA512 31e902661d5ee2da82858910551393890583d9702303fed5652122c852e9384fb88a42eddd0b968558865e16b5bd4ac2a13a35bd01ec3f8c3adbb673bc465596
DIST rust-patches-1.87.0-r1.tar.bz2 4635 BLAKE2B d813ec4a602d3bb879927a44a0b9f752aac255e31dfd13c56ab71b3fae7ce46a742c1d2e7494a7e17728f1edb2327ddd6ad6ebabc0c47d66326b766bbd323fbd SHA512 596ffe744a5849b443f077bbd4edbcbb240b9ac51c9d53e0e436e46d7c93a6734477d22eba4a066a0cf474503a6357a72dfa124e594f645be6f50d9bd25bdb10
DIST rust-patches-1.88.0_beta20250526.tar.bz2 4073 BLAKE2B 4ae2fd9d87116ee6f779e60ffcbed16ef778fd4e87d4f6f8e2588348b7d0aa28de3627f8c2d43cef540b2422278d4018618c6f0da6936be03de68aba3420f5a4 SHA512 8f775901aff2c0da66c01e20c983ca965eddf38cd106d055b6e480e9ca73418abc416fe28215d4f700eb8cce52a90808c0513d23d495977ac19a3b5d82e109ff
DIST rust-patches-1.88.0_beta20250603.tar.bz2 4080 BLAKE2B 13e7ae1de79d91a2b7a6ee1368141ec0c9676a507c2a88b7dd1070e785482fe444f0e885055b9900d68ecab41f18ed1fd99c24a690e95219d387ac141c958e23 SHA512 a9929d66e583fcc21423008f5b6c0b7953715685f526c632433d4b25539810a422f8ca6f9a334664f9ad80f09a674a38e818d96cd079f86fb38948f7ae7ba56b
DIST rustc-1.74.1-src.tar.xz 155968724 BLAKE2B e05f2379ac94b286f85791a138e1928e5b5b5a7749f0981d82c40c2a12860f55bf96bb2f0e924e35a0f8b2447b13052d38adea909aaa3199105787bb5a4861b3 SHA512 14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d
DIST rustc-1.74.1-src.tar.xz.asc 801 BLAKE2B ddf73175b164233babf31ca3a381b03e20c0f36d017c1d5f85d6ab11f0986d861ab23b11c061e6b2444ced70c3d6a494cc3de4ec86f0deb221a805491bd75420 SHA512 9a96ff9ba9a4e2af4e267b2ec126fc0675c78d0eb767703daa2f28491c3d85c2ab00fbd8584390bf658812ec6c4ab6c57e43b386db59fd505bd3134a8873a09e
DIST rustc-1.75.0-src.tar.xz 159624388 BLAKE2B 8937b80585eddaa3e1f1ef948899d14a170308518c6fef9fe569560cdd870053776956743f796055f2119399b9ca6c0df12fedd789ae46324d071e5126c4e495 SHA512 7b0f25d91b1b5c317980fc88e059200bd43b56a70b445fbc72fb9b96e09775bfd3a98e9bd9d662af80f0ce3aef527c777ee82777e96ca876f47a972d63da8606
@ -30,5 +46,9 @@ DIST rustc-1.85.1-src.tar.xz 274028992 BLAKE2B 1dddbbc0d14fe9551fd2eb59a47521ac7
DIST rustc-1.85.1-src.tar.xz.asc 801 BLAKE2B 07409ef6c044b72394a28dfd5b5decb237ca540714010a4f81e4213a3bf7ffb2e14029789f930cea0dab115a6e986859f6cdefd3798be780c2ff21c3e5fa6593 SHA512 7f19653fd05c89390a4073f5184ca162863b7116cc4d8867a5aa4304568880707ebb9f9dda166d7d04f30b2df6ed223eedd98df1744f809773054edfcd2385ff
DIST rustc-1.86.0-src.tar.xz 275696736 BLAKE2B 9f33a710a3e567d92f56091920643f5ef2ddf2ad52acb5d9ee78496a7b5dbc10da5a51c72cf2a6f66d543a531d3138a49767c98501ae4e885e03988d2ccfbb59 SHA512 9ce195e24a03765f7163de16271e3d19d731d4b80fcc2bfd919106c9d42543eade018f712f6947ea3c6e57c6cb2e6841596aa668d608b8da15101a7da14f3097
DIST rustc-1.86.0-src.tar.xz.asc 801 BLAKE2B 3e10a3894c7eee68d37bc5707d797548119f830667e27e652a199d13633199713bd01bd0f41a5f2af3c682561903e36abe27b36ef78d9a1d65bdf485527d2c15 SHA512 0b74dab9ee56d0a08e26e9cd40f722e4d99de63ac678f969f0c54d50737074fb28e170db5a36ce2627ec332e5ce3bb8a92167aefbccff7c70e4cb057bc0a94ac
DIST rustc-1.87.0_beta20250420-src.tar.xz 283544556 BLAKE2B 70a59c7d695e881a4e21d500f19b7d83e3a86bc8d5dfaaaa28a4cd4631b12937a2743119e3181e84af7b348386c672f4e62675da8cfb399095fcdda527b072e0 SHA512 37e62954c21b0d5c232dca1d0fe476b165eb63b7315c1fcaa18068707f4fd00e2def09968ee1d243f62cb3eae3fbb4381493b8505179342705998dce08e23afe
DIST rustc-1.87.0_beta20250420-src.tar.xz.asc 801 BLAKE2B c0ed0686d3bc612e8b0edb96817928107905220328af81d2f9200552c3edb58d98ae8844f01b7dd20e59e6c0a173f6da11b2cd58d0c3b5d5f0bd8290528ea86c SHA512 e2e694feec13d8fb8d9b50442c0c2e3de5cef0a249730c945124880220e44d481b2109098c5a8479f765384a4298e293e63743c924e0866ed2e5aece3a35c98f
DIST rustc-1.87.0-src.tar.xz 283604208 BLAKE2B 7ede723121ff8df3908674631ceaec75797d91ccd6f1df4afd7187878adbb8d99c9e8a3b11c6027703b2e8d06785299d93d8649f3eda7f356dd2a6734d99d05b SHA512 2ef08c9be45434401f916d54b3739f52d255f8a3a4ce05a717499250c2333eeaf601f1d18085b878c027c609f44da74d0151f5bfc2c9ae1e01166919a91a1d2b
DIST rustc-1.87.0-src.tar.xz.asc 801 BLAKE2B c9740c03baedcd70defba3fd37831692adaf0e984ef6b11d259244330d044fcacf935e6dd76caf126848da0c40f38e5368c60e8aabed5d3c2655a61fdbdc7564 SHA512 ebc13374381839a997c63455b733fd2a7960b4fd497f19c29be948cce8bb59a31ddda5da54ca154c16f7de43dd1bacd6c6bd76f3b6b36c5b43f4cfaf1746b952
DIST rustc-1.88.0_beta20250526-src.tar.xz 283223628 BLAKE2B 1c21853c0b7edcafd87713823888e04d336fb9c6cd373aa05218ae5d1ddc9c68b18c06dc27d059542ddfe91c0eb04cf523e4b3621b9bbbfad5d2f82e8d1cad1e SHA512 28f64ae8b1e907f7c4044d8a0148286f6e202677417ac3b4f2ce24ee9dba34369ba18d39e443cb982ee5f3b8afd94530580a62b8f5d5473954e976708f002357
DIST rustc-1.88.0_beta20250526-src.tar.xz.asc 801 BLAKE2B a412d72e4e0f273f03f3fee41abe1aeda03f77339891469e994f3a6bde0cd3836a1da087d908e732e90cd3285743a4a3c728c718ad1dda5daf7cca9de3be2c52 SHA512 45f208555f8b2fd3b21ac4cdc8fd7a110dc53fedbbe8d11542f105c5c8657a628309c8ff4520eb2c740cf3e784bfea0f21832b71b19a356b1b99fc7d0f04f607
DIST rustc-1.88.0_beta20250603-src.tar.xz 283255312 BLAKE2B 5b46509c46c4fbb10c4b3cee3edf9a1428c4b0f54d8f4d6a042e9776e05242988c933a90654538cf9806c4d1ee1c01ff3ecdcb1711fd7240cacbf5cbeff9a96b SHA512 ebc5f2175fc7ac8b89ee68d3089272ea444cfa9375a13c989c64a267b050c1065eaa124263b440ba6513a4b6ba4c8efbf58f3a78b4d94bd0e658dfab5ca0a8e5
DIST rustc-1.88.0_beta20250603-src.tar.xz.asc 801 BLAKE2B 426fe3cf64ecbc5564feeb1c2c784b98d4aa71184006b1430c86d1b98f91592e850feefa0f6e91142f1b5c227556041cd32628aed7bacd43dddd252dc111b73f SHA512 ba4336934071fff1d9abe44d50fced7bd2fd1f6a5c116b8d17312d6ec5d143664fb570fba90f6cf417c5220cd9f42b2bb1695d73e915451b1dd2f726a451c7ec

View File

@ -1,25 +0,0 @@
From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
From: Jory Pratt <anarchy@gentoo.org>
Date: Tue, 2 Aug 2022 18:32:53 -0500
Subject: [PATCH] Enable dynamic linking by default for musl
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
---
compiler/rustc_target/src/spec/linux_musl_base.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/rustc_target/src/spec/linux_musl_base.rs b/compiler/rustc_target/src/spec/linux_musl_base.rs
index 207a87ab0..8a5a43363 100644
--- a/compiler/rustc_target/src/spec/linux_musl_base.rs
+++ b/compiler/rustc_target/src/spec/linux_musl_base.rs
@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
// These targets statically link libc by default
- base.crt_static_default = true;
+ base.crt_static_default = false;
base
}
--
2.35.1

View File

@ -1,34 +0,0 @@
From 92aa5f6b272bcdc020a34f8d90f9ef851b5b4504 Mon Sep 17 00:00:00 2001
From: John Millikin <john@john-millikin.com>
Date: Mon, 9 Jan 2023 13:54:21 +0900
Subject: [PATCH] Disable `linux_ext` in wasm32 and fortanix rustdoc builds.
The `std::os::unix` module is stubbed out when building docs for these
target platforms. The introduction of Linux-specific extension traits
caused `std::os::net` to depend on sub-modules of `std::os::unix`,
which broke rustdoc for the `wasm32-unknown-unknown` target.
Adding an additional `#[cfg]` guard solves that rustdoc failure by
not declaring `linux_ext` on targets with a stubbed `std::os::unix`.
---
library/std/src/os/net/mod.rs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/library/std/src/os/net/mod.rs b/library/std/src/os/net/mod.rs
index 5ec267c41e97c..b7046dd7c598c 100644
--- a/library/std/src/os/net/mod.rs
+++ b/library/std/src/os/net/mod.rs
@@ -1,4 +1,13 @@
//! OS-specific networking functionality.
+// See cfg macros in `library/std/src/os/mod.rs` for why these platforms must
+// be special-cased during rustdoc generation.
+#[cfg(not(all(
+ doc,
+ any(
+ all(target_arch = "wasm32", not(target_os = "wasi")),
+ all(target_vendor = "fortanix", target_env = "sgx")
+ )
+)))]
#[cfg(any(target_os = "linux", target_os = "android", doc))]
pub(super) mod linux_ext;

View File

@ -1,30 +0,0 @@
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
---
test/ui/env-funky-keys.rs | 1 +
6 files changed, 10 insertions(+)
diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs
index c5c824ac58d..f3fe047a79c 100644
--- a/tests/ui/env-funky-keys.rs
+++ b/tests/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

View File

@ -1,26 +0,0 @@
https://github.com/rust-lang/rust/pull/114440
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 3 Aug 2023 15:05:40 -0700
Subject: [PATCH] bootstrap: config: fix version comparison bug
Rust requires a previous version of Rust to build, such as the current version, or the
previous version. However, the version comparison logic did not take patch releases
into consideration when doing the version comparison for the current branch, e.g.
Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version
match, or the previous version.
Adjust the version comparison logic to tolerate mismatches in the patch version.
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -2004,7 +2004,8 @@ impl Config {
.unwrap();
if !(source_version == rustc_version
|| (source_version.major == rustc_version.major
- && source_version.minor == rustc_version.minor + 1))
+ && (source_version.minor == rustc_version.minor
+ || source_version.minor == rustc_version.minor + 1)))
{
let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1);
eprintln!(

View File

@ -1,19 +0,0 @@
https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index f606fa483ca..8a2e1c40e8b 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -237,10 +237,7 @@ fn main() {
// of llvm-config, not the target that we're attempting to link.
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");
-
- if !is_crossed {
- cmd.arg("--system-libs");
- }
+ cmd.arg("--system-libs");
if (target.starts_with("arm") && !target.contains("freebsd"))
|| target.starts_with("mips-")

View File

@ -1,45 +0,0 @@
From 4b7e0a0b56aa2446e670dfd6558380a1039a86aa Mon Sep 17 00:00:00 2001
From: Arlo Siemsen <arsiem@microsoft.com>
Date: Thu, 4 Jan 2024 11:40:56 -0600
Subject: [PATCH] Handle vendored sources when remapping paths
Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
---
src/bootstrap/src/core/builder.rs | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 4e20babc55a..3770d0687b2 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -1799,15 +1799,20 @@ pub fn cargo(
}
if self.config.rust_remap_debuginfo {
- // FIXME: handle vendored sources
- let registry_src = t!(home::cargo_home()).join("registry").join("src");
let mut env_var = OsString::new();
- for entry in t!(std::fs::read_dir(registry_src)) {
- if !env_var.is_empty() {
- env_var.push("\t");
- }
- env_var.push(t!(entry).path());
+ if self.config.vendor {
+ let vendor = self.build.src.join("vendor");
+ env_var.push(vendor);
env_var.push("=/rust/deps");
+ } else {
+ let registry_src = t!(home::cargo_home()).join("registry").join("src");
+ for entry in t!(std::fs::read_dir(registry_src)) {
+ if !env_var.is_empty() {
+ env_var.push("\t");
+ }
+ env_var.push(t!(entry).path());
+ env_var.push("=/rust/deps");
+ }
}
cargo.env("RUSTC_CARGO_REGISTRY_SRC_TO_REMAP", env_var);
}
--
2.43.0

View File

@ -1,19 +0,0 @@
From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
From: Jory Pratt <anarchy@gentoo.org>
Date: Tue, 2 Aug 2022 18:32:53 -0500
Subject: [PATCH] Enable dynamic linking by default for musl
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
// These targets statically link libc by default
- base.crt_static_default = true;
+ base.crt_static_default = false;
base
}
--
2.35.1

View File

@ -1,73 +0,0 @@
https://github.com/rust-lang/rust/pull/120661
From: WANG Xuerui <xen0n@gentoo.org>
Date: Mon, 5 Feb 2024 13:18:32 +0800
Subject: [PATCH] target: default to the medium code model on LoongArch targets
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The Rust LoongArch targets have been using the default LLVM code model
so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak.
As described in the "Code Model" section of LoongArch ELF psABI spec
v20231219 [1], one can only make function calls as far as ±128MiB with
the "normal" code model; this is insufficient for very large software
containing Rust components that needs to be linked into the big text
section, such as Chromium.
Because:
* we do not want to ask users to recompile std if they are to build
such software,
* objects compiled with larger code models can be linked with those
with smaller code models without problems, and
* the "medium" code model is comparable to the "small"/"normal" one
performance-wise (same data access pattern; each function call
becomes 2-insn long and indirect, but this may be relaxed back into
the direct 1-insn form in a future LLVM version), but is able to
perform function calls within ±128GiB,
it is better to just switch the targets to the "medium" code model,
which is also "medium" in LLVM-speak.
[1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs
@@ -1,4 +1,4 @@
-use crate::spec::{base, Target, TargetOptions};
+use crate::spec::{base, CodeModel, Target, TargetOptions};
pub fn target() -> Target {
Target {
@@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".into(),
arch: "loongarch64".into(),
options: TargetOptions {
+ code_model: Some(CodeModel::Medium),
cpu: "generic".into(),
features: "+f,+d".into(),
llvm_abiname: "lp64d".into(),
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs
@@ -16,7 +16,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
- code_model: Some(CodeModel::Small),
+ code_model: Some(CodeModel::Medium),
..Default::default()
},
}
--- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs
@@ -17,7 +17,7 @@ pub fn target() -> Target {
max_atomic_width: Some(64),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
- code_model: Some(CodeModel::Small),
+ code_model: Some(CodeModel::Medium),
..Default::default()
},
}
--
2.43.0

View File

@ -1,30 +0,0 @@
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
---
test/ui/env-funky-keys.rs | 1 +
6 files changed, 10 insertions(+)
diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs
index c5c824ac58d..f3fe047a79c 100644
--- a/tests/ui/env-funky-keys.rs
+++ b/tests/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

View File

@ -1,19 +0,0 @@
From e42709c46647dab342b826d30324f3e6e5590e00 Mon Sep 17 00:00:00 2001
From: Jory Pratt <anarchy@gentoo.org>
Date: Tue, 2 Aug 2022 18:32:53 -0500
Subject: [PATCH] Enable dynamic linking by default for musl
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -10,7 +10,7 @@ pub fn opts() -> TargetOptions {
base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
// These targets statically link libc by default
- base.crt_static_default = true;
+ base.crt_static_default = false;
base
}
--
2.35.1

View File

@ -1,18 +0,0 @@
This reverts commit 8c40426051a667673cdac9975f84cb6acd4e245f.
https://bugs.gentoo.org/933382
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index d4473e24039..58f351d17fa 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -724,8 +724,7 @@ fn configure_cmake(
}
}
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
- .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx))
- .define("CMAKE_ASM_COMPILER", sanitize_cc(&cc));
+ .define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx));
}
cfg.build_arg("-j").build_arg(builder.jobs().to_string());

View File

@ -1,15 +0,0 @@
https://bugs.gentoo.org/937525
https://bugs.gentoo.org/937164
Unnecessary on 19+ because 2222fddfc0a2ff02036542511597839856289094 adds
SmallVector and SmallVector is fixed by another patch.
--- a/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+++ b/src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
@@ -13,6 +13,7 @@
#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
+#include <cstdint>
#include <memory>
#include <string>

View File

@ -1,30 +0,0 @@
https://bugs.gentoo.org/937525
https://bugs.gentoo.org/937164
https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1
https://github.com/llvm/llvm-project/pull/101761
From 7e44305041d96b064c197216b931ae3917a34ac1 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 2 Aug 2024 23:07:21 +0100
Subject: [PATCH] [ADT] Add `<cstdint>` to SmallVector (#101761)
SmallVector uses `uint32_t`, `uint64_t` without including `<cstdint>`
which fails to build w/ GCC 15 after a change in libstdc++ [0]
[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2
---
src/llvm-project/llvm/include/llvm/ADT/SmallVector.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
index 09676d792dfebd..17444147b102a9 100644
--- a/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
+++ b/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
@@ -19,6 +19,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
+#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <functional>

View File

@ -1,29 +0,0 @@
https://bugs.gentoo.org/937525
https://bugs.gentoo.org/937164
https://github.com/llvm/llvm-project/pull/101766
From 5b69d0cf697f0d78406a5a7ed18eaa4f57a0580a Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 2 Aug 2024 23:38:55 +0100
Subject: [PATCH] [AMDGPU] Include `<cstdint>` in AMDGPUMCTargetDesc
createAMDGPUELFObjectWriter uses `uint8_t` without including `<cstdint>`
which fails to build w/ GCC 15 after a change in libstdc++ [0].
[0] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84a74e3076ee2
---
src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
index 3ef00f75735b0d..879dbe1b279b18 100644
--- a/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
+++ b/src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
@@ -15,6 +15,7 @@
#ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H
#define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H
+#include <cstdint>
#include <memory>
namespace llvm {

View File

@ -1,247 +0,0 @@
https://bugs.gentoo.org/942013
https://bugs.gentoo.org/942884
https://github.com/rust-lang/rust/issues/131944
https://github.com/rust-lang/rust/pull/132613
From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001
From: Kyle Huey <khuey@kylehuey.com>
Date: Mon, 4 Nov 2024 11:38:14 -0800
Subject: [PATCH] Add discriminators to DILocations when multiple functions are
inlined into a single point.
LLVM does not expect to ever see multiple dbg_declares for the same variable at the same
location with different values. proc-macros make it possible for arbitrary code,
including multiple calls that get inlined, to happen at any given location in the source
code. Add discriminators when that happens so these locations are different to LLVM.
This may interfere with the AddDiscriminators pass in LLVM, which is added by the
unstable flag -Zdebug-info-for-profiling.
Fixes #131944
---
.../src/debuginfo/create_scope_map.rs | 60 ++++++++++++++++++-
compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 4 ++
.../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 8 +++
.../auxiliary/macro_def.rs | 11 ++++
.../mir_inlined_twice_var_locs.rs | 53 ++++++++++++++++
5 files changed, 133 insertions(+), 3 deletions(-)
create mode 100644 tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
create mode 100644 tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
index ac6c2fb1b83a6..0f1909486ec7e 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
@@ -1,11 +1,15 @@
+use std::collections::hash_map::Entry;
+
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
use rustc_codegen_ssa::traits::*;
+use rustc_data_structures::fx::FxHashMap;
use rustc_index::bit_set::BitSet;
use rustc_index::Idx;
use rustc_middle::mir::{Body, SourceScope};
use rustc_middle::ty::layout::FnAbiOf;
use rustc_middle::ty::{self, Instance};
use rustc_session::config::DebugInfo;
+use rustc_span::BytePos;
use super::metadata::file_metadata;
use super::utils::DIB;
@@ -37,10 +41,20 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
None
};
let mut instantiated = BitSet::new_empty(mir.source_scopes.len());
+ let mut discriminators = FxHashMap::default();
// Instantiate all scopes.
for idx in 0..mir.source_scopes.len() {
let scope = SourceScope::new(idx);
- make_mir_scope(cx, instance, mir, &variables, debug_context, &mut instantiated, scope);
+ make_mir_scope(
+ cx,
+ instance,
+ mir,
+ &variables,
+ debug_context,
+ &mut instantiated,
+ &mut discriminators,
+ scope,
+ );
}
assert!(instantiated.count() == mir.source_scopes.len());
}
@@ -52,6 +66,7 @@ fn make_mir_scope<'ll, 'tcx>(
variables: &Option<BitSet<SourceScope>>,
debug_context: &mut FunctionDebugContext<'tcx, &'ll DIScope, &'ll DILocation>,
instantiated: &mut BitSet<SourceScope>,
+ discriminators: &mut FxHashMap<BytePos, u32>,
scope: SourceScope,
) {
if instantiated.contains(scope) {
@@ -60,7 +75,16 @@ fn make_mir_scope<'ll, 'tcx>(
let scope_data = &mir.source_scopes[scope];
let parent_scope = if let Some(parent) = scope_data.parent_scope {
- make_mir_scope(cx, instance, mir, variables, debug_context, instantiated, parent);
+ make_mir_scope(
+ cx,
+ instance,
+ mir,
+ variables,
+ debug_context,
+ instantiated,
+ discriminators,
+ parent,
+ );
debug_context.scopes[parent]
} else {
// The root is the function itself.
@@ -117,7 +141,37 @@ fn make_mir_scope<'ll, 'tcx>(
// FIXME(eddyb) this doesn't account for the macro-related
// `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_span);
- cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span)
+ let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span);
+
+ // NB: In order to produce proper debug info for variables (particularly
+ // arguments) in multiply-inline functions, LLVM expects to see a single
+ // DILocalVariable with multiple different DILocations in the IR. While
+ // the source information for each DILocation would be identical, their
+ // inlinedAt attributes will be unique to the particular callsite.
+ //
+ // We generate DILocations here based on the callsite's location in the
+ // source code. A single location in the source code usually can't
+ // produce multiple distinct calls so this mostly works, until
+ // proc-macros get involved. A proc-macro can generate multiple calls
+ // at the same span, which breaks the assumption that we're going to
+ // produce a unique DILocation for every scope we process here. We
+ // have to explicitly add discriminators if we see inlines into the
+ // same source code location.
+ //
+ // Note further that we can't key this hashtable on the span itself,
+ // because these spans could have distinct SyntaxContexts. We have
+ // to key on exactly what we're giving to LLVM.
+ match discriminators.entry(callsite_span.lo()) {
+ Entry::Occupied(mut o) => {
+ *o.get_mut() += 1;
+ unsafe { llvm::LLVMRustDILocationCloneWithBaseDiscriminator(loc, *o.get()) }
+ .expect("Failed to encode discriminator in DILocation")
+ }
+ Entry::Vacant(v) => {
+ v.insert(0);
+ loc
+ }
+ }
});
debug_context.scopes[scope] = DebugScope {
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 3d2e270a3868e..75a5ec44c2285 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -2174,6 +2174,10 @@ unsafe extern "C" {
Scope: &'a DIScope,
InlinedAt: Option<&'a DILocation>,
) -> &'a DILocation;
+ pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
+ Location: &'a DILocation,
+ BD: c_uint,
+ ) -> Option<&'a DILocation>;
pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64;
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 9330c83b7f230..cd70c3f266920 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1305,6 +1305,14 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
return wrap(Loc);
}
+extern "C" LLVMMetadataRef
+LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
+ unsigned BD) {
+ DILocation *Loc = unwrapDIPtr<DILocation>(Location);
+ auto NewLoc = Loc->cloneWithBaseDiscriminator(BD);
+ return wrap(NewLoc.has_value() ? NewLoc.value() : nullptr);
+}
+
extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() {
return dwarf::DW_OP_deref;
}
diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
new file mode 100644
index 0000000000000..159ecfd09743d
--- /dev/null
+++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
@@ -0,0 +1,11 @@
+//@ force-host
+//@ no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::*;
+
+#[proc_macro]
+pub fn square_twice(_item: TokenStream) -> TokenStream {
+ "(square(env::vars().count() as i32), square(env::vars().count() as i32))".parse().unwrap()
+}
diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
new file mode 100644
index 0000000000000..c3858044c0c9f
--- /dev/null
+++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
@@ -0,0 +1,53 @@
+//@ min-llvm-version: 19
+//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline
+// MSVC is different because of the individual allocas.
+//@ ignore-msvc
+
+//@ aux-build:macro_def.rs
+
+// Find the variable.
+// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} scope: ![[#var_scope:]]
+
+// Find both dbg_declares. These will proceed the variable metadata, of course, so we're looking
+// backwards.
+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], !DIExpression(), ![[#var_loc2:]])
+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), ![[#var_loc1:]])
+
+// Find the first location definition, looking forwards again.
+// CHECK: ![[#var_loc1]] = !DILocation
+// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]]
+
+// Find the first location's inlinedAt
+// NB: If we fail here it's *probably* because we failed to produce two
+// different locations and ended up reusing an earlier one.
+// CHECK: ![[#var_inlinedAt1]] = !DILocation
+// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]]
+
+// Find the second location definition, still looking forwards.
+// NB: If we failed to produce two different locations, the test will
+// definitely fail by this point (if it hasn't already) because we won't
+// be able to find the same line again.
+// CHECK: ![[#var_loc2]] = !DILocation
+// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]]
+
+// Find the second location's inlinedAt.
+// CHECK: ![[#var_inlinedAt2]] = !DILocation
+// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]]
+
+// Finally, check that a discriminator was emitted for the second scope.
+// FIXMEkhuey ideally we would check that *either* scope has a discriminator
+// but I don't know that it's possible to check that with FileCheck.
+// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile
+// CHECK-SAME: discriminator: [[#]]
+extern crate macro_def;
+
+use std::env;
+
+fn square(n: i32) -> i32 {
+ n * n
+}
+
+fn main() {
+ let (z1, z2) = macro_def::square_twice!();
+ println!("{z1} == {z2}");
+}

View File

@ -1,44 +0,0 @@
Bug: https://bugs.gentoo.org/741708
From: Ian Jordan <immoloism@gmail.com>
Date: Thu, 01 Nov 204 15:28:39 +0100
Subject: Change Pentium4 baseline to i586
Based on the Debian patch at https://sources.debian.org/patches/rustc/1.80.1%2Bdfsg1-1/behaviour/d-rustc-i686-baseline.patch/
This lowers baseline from Pentium4 to i586.
Thanks-to: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Tar
pub fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "pentium4".into();
+ base.cpu = "pentiumpro".into();
base.max_atomic_width = Some(64);
base.supported_sanitizers = SanitizerSet::ADDRESS;
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
--- a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs
+++ b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs
@@ -24,7 +24,8 @@ fn main() {
match std::env::var("TARGET") {
Ok(s) => {
// Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
- if s.contains("i586") {
+ // Debian: our i686 doesn't have SSE 2..
+ if s.contains("i586") || s.contains("i686") {
return
}
}
--- a/tests/ui/sse2.rs
+++ b/tests/ui/sse2.rs
@@ -16,7 +16,7 @@ fn main() {
}
Err(_) => return,
}
- if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
+ if cfg!(any(target_arch = "x86_64")) {
assert!(cfg!(target_feature = "sse2"),
"SSE2 was not detected as available on an x86 platform");
}

View File

@ -1,21 +0,0 @@
https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index f606fa483ca..8a2e1c40e8b 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -220,12 +220,7 @@
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");
- // Don't link system libs if cross-compiling unless targetting Windows.
- // On Windows system DLLs aren't linked directly, instead import libraries are used.
- // These import libraries are independent of the host.
- if !is_crossed || target.contains("windows") {
- cmd.arg("--system-libs");
- }
+ cmd.arg("--system-libs");
// We need libkstat for getHostCPUName on SPARC builds.
// See also: https://github.com/llvm/llvm-project/issues/64186

View File

@ -1,242 +0,0 @@
From 1dc106121b62562ead6e7d612fa136dc4b35cd5d Mon Sep 17 00:00:00 2001
From: Kyle Huey <khuey@kylehuey.com>
Date: Mon, 4 Nov 2024 11:38:14 -0800
Subject: [PATCH] Add discriminators to DILocations when multiple functions are
inlined into a single point.
LLVM does not expect to ever see multiple dbg_declares for the same variable at the same
location with different values. proc-macros make it possible for arbitrary code,
including multiple calls that get inlined, to happen at any given location in the source
code. Add discriminators when that happens so these locations are different to LLVM.
This may interfere with the AddDiscriminators pass in LLVM, which is added by the
unstable flag -Zdebug-info-for-profiling.
Fixes #131944
---
.../src/debuginfo/create_scope_map.rs | 60 ++++++++++++++++++-
compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 4 ++
.../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 8 +++
.../auxiliary/macro_def.rs | 11 ++++
.../mir_inlined_twice_var_locs.rs | 53 ++++++++++++++++
5 files changed, 133 insertions(+), 3 deletions(-)
create mode 100644 tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
create mode 100644 tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
index ac6c2fb1b83a6..0f1909486ec7e 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
@@ -1,11 +1,15 @@
+use std::collections::hash_map::Entry;
+
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
use rustc_codegen_ssa::traits::*;
+use rustc_data_structures::fx::FxHashMap;
use rustc_index::Idx;
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::{Body, SourceScope};
use rustc_middle::ty::layout::FnAbiOf;
use rustc_middle::ty::{self, Instance};
use rustc_session::config::DebugInfo;
+use rustc_span::BytePos;
use super::metadata::file_metadata;
use super::utils::DIB;
@@ -37,10 +41,20 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
None
};
let mut instantiated = BitSet::new_empty(mir.source_scopes.len());
+ let mut discriminators = FxHashMap::default();
// Instantiate all scopes.
for idx in 0..mir.source_scopes.len() {
let scope = SourceScope::new(idx);
- make_mir_scope(cx, instance, mir, &variables, debug_context, &mut instantiated, scope);
+ make_mir_scope(
+ cx,
+ instance,
+ mir,
+ &variables,
+ debug_context,
+ &mut instantiated,
+ &mut discriminators,
+ scope,
+ );
}
assert!(instantiated.count() == mir.source_scopes.len());
}
@@ -52,6 +66,7 @@ fn make_mir_scope<'ll, 'tcx>(
variables: &Option<BitSet<SourceScope>>,
debug_context: &mut FunctionDebugContext<'tcx, &'ll DIScope, &'ll DILocation>,
instantiated: &mut BitSet<SourceScope>,
+ discriminators: &mut FxHashMap<BytePos, u32>,
scope: SourceScope,
) {
if instantiated.contains(scope) {
@@ -60,7 +75,16 @@ fn make_mir_scope<'ll, 'tcx>(
let scope_data = &mir.source_scopes[scope];
let parent_scope = if let Some(parent) = scope_data.parent_scope {
- make_mir_scope(cx, instance, mir, variables, debug_context, instantiated, parent);
+ make_mir_scope(
+ cx,
+ instance,
+ mir,
+ variables,
+ debug_context,
+ instantiated,
+ discriminators,
+ parent,
+ );
debug_context.scopes[parent]
} else {
// The root is the function itself.
@@ -117,7 +141,37 @@ fn make_mir_scope<'ll, 'tcx>(
// FIXME(eddyb) this doesn't account for the macro-related
// `Span` fixups that `rustc_codegen_ssa::mir::debuginfo` does.
let callsite_scope = parent_scope.adjust_dbg_scope_for_span(cx, callsite_span);
- cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span)
+ let loc = cx.dbg_loc(callsite_scope, parent_scope.inlined_at, callsite_span);
+
+ // NB: In order to produce proper debug info for variables (particularly
+ // arguments) in multiply-inline functions, LLVM expects to see a single
+ // DILocalVariable with multiple different DILocations in the IR. While
+ // the source information for each DILocation would be identical, their
+ // inlinedAt attributes will be unique to the particular callsite.
+ //
+ // We generate DILocations here based on the callsite's location in the
+ // source code. A single location in the source code usually can't
+ // produce multiple distinct calls so this mostly works, until
+ // proc-macros get involved. A proc-macro can generate multiple calls
+ // at the same span, which breaks the assumption that we're going to
+ // produce a unique DILocation for every scope we process here. We
+ // have to explicitly add discriminators if we see inlines into the
+ // same source code location.
+ //
+ // Note further that we can't key this hashtable on the span itself,
+ // because these spans could have distinct SyntaxContexts. We have
+ // to key on exactly what we're giving to LLVM.
+ match discriminators.entry(callsite_span.lo()) {
+ Entry::Occupied(mut o) => {
+ *o.get_mut() += 1;
+ unsafe { llvm::LLVMRustDILocationCloneWithBaseDiscriminator(loc, *o.get()) }
+ .expect("Failed to encode discriminator in DILocation")
+ }
+ Entry::Vacant(v) => {
+ v.insert(0);
+ loc
+ }
+ }
});
debug_context.scopes[scope] = DebugScope {
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 3d2e270a3868e..75a5ec44c2285 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -2174,6 +2174,10 @@ unsafe extern "C" {
Scope: &'a DIScope,
InlinedAt: Option<&'a DILocation>,
) -> &'a DILocation;
+ pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
+ Location: &'a DILocation,
+ BD: c_uint,
+ ) -> Option<&'a DILocation>;
pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
pub fn LLVMRustDIBuilderCreateOpLLVMFragment() -> u64;
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 9330c83b7f230..cd70c3f266920 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1305,6 +1305,14 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
return wrap(Loc);
}
+extern "C" LLVMMetadataRef
+LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
+ unsigned BD) {
+ DILocation *Loc = unwrapDIPtr<DILocation>(Location);
+ auto NewLoc = Loc->cloneWithBaseDiscriminator(BD);
+ return wrap(NewLoc.has_value() ? NewLoc.value() : nullptr);
+}
+
extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() {
return dwarf::DW_OP_deref;
}
diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
new file mode 100644
index 0000000000000..159ecfd09743d
--- /dev/null
+++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs
@@ -0,0 +1,11 @@
+//@ force-host
+//@ no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::*;
+
+#[proc_macro]
+pub fn square_twice(_item: TokenStream) -> TokenStream {
+ "(square(env::vars().count() as i32), square(env::vars().count() as i32))".parse().unwrap()
+}
diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
new file mode 100644
index 0000000000000..c3858044c0c9f
--- /dev/null
+++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs
@@ -0,0 +1,53 @@
+//@ min-llvm-version: 19
+//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline
+// MSVC is different because of the individual allocas.
+//@ ignore-msvc
+
+//@ aux-build:macro_def.rs
+
+// Find the variable.
+// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} scope: ![[#var_scope:]]
+
+// Find both dbg_declares. These will proceed the variable metadata, of course, so we're looking
+// backwards.
+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], !DIExpression(), ![[#var_loc2:]])
+// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), ![[#var_loc1:]])
+
+// Find the first location definition, looking forwards again.
+// CHECK: ![[#var_loc1]] = !DILocation
+// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]]
+
+// Find the first location's inlinedAt
+// NB: If we fail here it's *probably* because we failed to produce two
+// different locations and ended up reusing an earlier one.
+// CHECK: ![[#var_inlinedAt1]] = !DILocation
+// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]]
+
+// Find the second location definition, still looking forwards.
+// NB: If we failed to produce two different locations, the test will
+// definitely fail by this point (if it hasn't already) because we won't
+// be able to find the same line again.
+// CHECK: ![[#var_loc2]] = !DILocation
+// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]]
+
+// Find the second location's inlinedAt.
+// CHECK: ![[#var_inlinedAt2]] = !DILocation
+// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]]
+
+// Finally, check that a discriminator was emitted for the second scope.
+// FIXMEkhuey ideally we would check that *either* scope has a discriminator
+// but I don't know that it's possible to check that with FileCheck.
+// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile
+// CHECK-SAME: discriminator: [[#]]
+extern crate macro_def;
+
+use std::env;
+
+fn square(n: i32) -> i32 {
+ n * n
+}
+
+fn main() {
+ let (z1, z2) = macro_def::square_twice!();
+ println!("{z1} == {z2}");
+}

View File

@ -1,30 +0,0 @@
https://github.com/rust-lang/rust/issues/133629
https://github.com/rust-lang/rust/commit/a24d859f19bbefe5371694f318568b0ab5a13299
From: onur-ozkan <work@onurozkan.dev>
Date: Thu, 30 Jan 2025 16:51:08 +0000
Subject: [PATCH] set rustc dylib on manually constructed rustc command
Signed-off-by: onur-ozkan <work@onurozkan.dev>
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -653,7 +653,10 @@ impl Builder<'_> {
// Build proc macros both for the host and the target unless proc-macros are not
// supported by the target.
if target != compiler.host && cmd_kind != Kind::Check {
- let error = command(self.rustc(compiler))
+ let mut rustc_cmd = command(self.rustc(compiler));
+ self.add_rustc_lib_path(compiler, &mut rustc_cmd);
+
+ let error = rustc_cmd
.arg("--target")
.arg(target.rustc_target_arg())
.arg("--print=file-names")
@@ -661,6 +664,7 @@ impl Builder<'_> {
.arg("-")
.run_capture(self)
.stderr();
+
let not_supported = error
.lines()
.any(|line| line.contains("unsupported crate type `proc-macro`"));

View File

@ -1,26 +0,0 @@
From 768f7e50a6d9a3db4e4eef45dcb4c56e9b580389 Mon Sep 17 00:00:00 2001
From: Matt Jolly <kangie@gentoo.org>
Date: Sun, 9 Feb 2025 21:12:43 +1000
Subject: [PATCH] Update libz cross-compile patch for 9999 (1.86.0)
See-also: https://paste.sr.ht/~kchibisov/682321e0fd4a3ece4a4b7b71591896f5cd3cdb22
See-also: https://github.com/gentoo/gentoo/pull/35246#discussion_r1484525497
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -219,13 +219,7 @@ fn main() {
// of llvm-config, not the target that we're attempting to link.
let mut cmd = Command::new(&llvm_config);
cmd.arg(llvm_link_arg).arg("--libs");
-
- // Don't link system libs if cross-compiling unless targeting Windows.
- // On Windows system DLLs aren't linked directly, instead import libraries are used.
- // These import libraries are independent of the host.
- if !is_crossed || target.contains("windows") {
- cmd.arg("--system-libs");
- }
+ cmd.arg("--system-libs");
// We need libkstat for getHostCPUName on SPARC builds.
// See also: https://github.com/llvm/llvm-project/issues/64186
--
2.48.0

View File

@ -1,271 +0,0 @@
From be965af5421e55c0032a989b220bc0da005d2272 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <vadorovsky@protonmail.com>
Date: Tue, 25 Feb 2025 16:24:21 +0100
Subject: [PATCH] Enable dynamic linking by default for musl
---
.../src/spec/targets/aarch64_unknown_linux_musl.rs | 3 ---
.../src/spec/targets/arm_unknown_linux_musleabi.rs | 3 +--
.../src/spec/targets/arm_unknown_linux_musleabihf.rs | 3 +--
.../src/spec/targets/armv5te_unknown_linux_musleabi.rs | 3 +--
.../src/spec/targets/armv7_unknown_linux_musleabi.rs | 3 +--
.../src/spec/targets/armv7_unknown_linux_musleabihf.rs | 3 +--
.../rustc_target/src/spec/targets/i586_unknown_linux_musl.rs | 2 --
.../rustc_target/src/spec/targets/i686_unknown_linux_musl.rs | 2 --
.../src/spec/targets/mips64_unknown_linux_muslabi64.rs | 3 +--
.../src/spec/targets/mips64el_unknown_linux_muslabi64.rs | 2 --
.../src/spec/targets/powerpc64_unknown_linux_musl.rs | 2 --
.../src/spec/targets/powerpc64le_unknown_linux_musl.rs | 2 --
.../src/spec/targets/powerpc_unknown_linux_musl.rs | 2 --
.../src/spec/targets/powerpc_unknown_linux_muslspe.rs | 2 --
.../src/spec/targets/riscv32gc_unknown_linux_musl.rs | 3 +--
.../rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs | 2 --
.../src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs | 3 +--
.../rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs | 2 --
18 files changed, 8 insertions(+), 37 deletions(-)
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 4fefdfa5c5e..bb65048a56d 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -12,9 +12,6 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
-
Target {
llvm_target: "aarch64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
index 26241dd0bd4..cab79e2bf7d 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs
@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
features: "+strict-align,+v6".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
index 4bbde7667b9..c5f6c180a95 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
features: "+strict-align,+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
index 62619546891..680dafe6943 100644
--- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs
@@ -20,8 +20,7 @@ pub(crate) fn target() -> Target {
max_atomic_width: Some(32),
mcount: "\u{1}mcount".into(),
has_thumb_interworking: true,
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
index 0436e0d8df4..e862b28ca92 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs
@@ -24,8 +24,7 @@ pub(crate) fn target() -> Target {
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
index 22e49f2f1b0..acb7c99cdaf 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
index 8ad93496f3a..623422a89ea 100644
--- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
@@ -4,7 +4,5 @@ pub(crate) fn target() -> Target {
let mut base = super::i686_unknown_linux_musl::target();
base.cpu = "pentium".into();
base.llvm_target = "i586-unknown-linux-musl".into();
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
base
}
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
index 6ba87c732b7..b805b80b85b 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
// implementation, apparently relies on frame pointers existing... somehow.
diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
index 32f5c79d653..9a25fe773fb 100644
--- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs
@@ -22,8 +22,7 @@ pub(crate) fn target() -> Target {
abi: "abi64".into(),
endian: Endian::Big,
mcount: "_mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base
},
}
diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
index 5e7c37fd46c..4f50e8b7033 100644
--- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs
@@ -5,8 +5,6 @@ pub(crate) fn target() -> Target {
base.cpu = "mips64r2".into();
base.features = "+mips64r2".into();
base.max_atomic_width = Some(64);
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
// LLVM doesn't recognize "muslabi64" yet.
llvm_target: "mips64el-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
index a54b17c87a7..a964f417799 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
@@ -7,8 +7,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "powerpc64-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
index f763c37f535..d0335506f16 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "powerpc64le-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
index 0cd0ea96ad3..5372a83e29a 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs
@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
index b86c3c2e8e0..2305db81c5e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs
@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-muslspe".into(),
diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
index a07429bb0c5..cf2d7669a8a 100644
--- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs
@@ -23,8 +23,7 @@ pub(crate) fn target() -> Target {
llvm_abiname: "ilp32d".into(),
max_atomic_width: Some(32),
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
index fbe8c48eca7..7a78004927b 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs
@@ -12,8 +12,6 @@ pub(crate) fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "s390x-unknown-linux-musl".into(),
diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
index 1149b6d16eb..e1e060c211d 100644
--- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs
@@ -27,8 +27,7 @@ pub(crate) fn target() -> Target {
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
+ crt_static_default: false,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
index 8dcdc5be8a9..8be0f335db9 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
@@ -14,8 +14,6 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
base.supports_xray = true;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "x86_64-unknown-linux-musl".into(),
--
2.45.3

View File

@ -0,0 +1,18 @@
diff '--color=auto' -Nuar rustc-1.86.0-src.orig/src/bootstrap/src/utils/helpers.rs rustc-1.86.0-src/src/bootstrap/src/utils/helpers.rs
--- rustc-1.86.0-src.orig/src/bootstrap/src/utils/helpers.rs 2025-03-31 22:37:24.000000000 +0100
+++ rustc-1.86.0-src/src/bootstrap/src/utils/helpers.rs 2025-04-17 12:31:37.651607535 +0100
@@ -451,12 +451,12 @@
if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() {
match builder.config.lld_mode {
LldMode::External => {
- args.push("-Clinker-flavor=gnu-lld-cc".to_string());
+ args.push("-Zlinker-features=+lld".to_string());
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
args.push("-Zunstable-options".to_string());
}
LldMode::SelfContained => {
- args.push("-Clinker-flavor=gnu-lld-cc".to_string());
+ args.push("-Zlinker-features=+lld".to_string());
args.push("-Clink-self-contained=+linker".to_string());
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
args.push("-Zunstable-options".to_string());

View File

@ -0,0 +1,29 @@
From 76e13020767e7ff783284b5bcf7a7509259ceb51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= <berykubik@gmail.com>
Date: Fri, 4 Apr 2025 18:29:20 +0200
Subject: [PATCH] Use target-agnostic LLD flags in bootstrap for use-lld
---
src/bootstrap/src/utils/helpers.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index f8e4d4e04717d..78dcdcbd1874a 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -474,13 +474,13 @@ pub fn linker_flags(
if stage == 0 && target.is_windows() {
args.push("-Clink-arg=-fuse-ld=lld".to_string());
} else {
- args.push("-Clinker-flavor=gnu-lld-cc".to_string());
+ args.push("-Zlinker-features=+lld".to_string());
}
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
args.push("-Zunstable-options".to_string());
}
LldMode::SelfContained => {
- args.push("-Clinker-flavor=gnu-lld-cc".to_string());
+ args.push("-Zlinker-features=+lld".to_string());
args.push("-Clink-self-contained=+linker".to_string());
// FIXME(kobzol): remove this flag once MCP510 gets stabilized
args.push("-Zunstable-options".to_string());

View File

@ -9,10 +9,6 @@
<email>navi@vlhl.dev</email>
<name>Anna Figueiredo Gomes</name>
</maintainer>
<maintainer type="person" proxied="yes">
<email>matoro_gentoo@matoro.tk</email>
<name>Matoro Mahri</name>
</maintainer>
<use>
<flag name="clippy">Install clippy, Rust code linter</flag>
<flag name="dist">Install dist tarballs (used for bootstrapping)</flag>
@ -20,9 +16,9 @@
<flag name="mrustc-bootstrap">Use <pkg>dev-lang/mrustc</pkg> to build the bootstrap Rust sysroot from this package's source</flag>
<flag name="nightly">Enable nightly (UNSTABLE) features (NOTE: it does not install nightly version, just enables features marked as nightly at time of release)</flag>
<flag name="parallel-compiler">Build a multi-threaded rustc (experimental, not tested by upstream)</flag>
<flag name="rustfmt">Install rustfmt, Rust code formatter</flag>
<flag name="rust-analyzer">Install rust-analyzer, A Rust compiler front-end for IDEs (language server)</flag>
<flag name="rust-src">Install rust-src, needed by developer tools and for build-std (cross)</flag>
<flag name="rustfmt">Install rustfmt, Rust code formatter</flag>
<flag name="system-llvm">Use the system LLVM installation</flag>
<flag name="wasm">Build support for the wasm32-unknown-unknown target</flag>
</use>

View File

@ -1,718 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LLVM_COMPAT=( 16 )
PYTHON_COMPAT=( python3_{10..12} )
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust 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"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Language empowering everyone to build reliable and efficient software"
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?}
# https://github.com/rust-lang/llvm-project/blob/rustc-1.71.0/llvm/CMakeLists.txt
_ALL_RUST_EXPERIMENTAL_TARGETS=()
declare -A ALL_RUST_EXPERIMENTAL_TARGETS
for _x in "${_ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
ALL_RUST_EXPERIMENTAL_TARGETS["llvm_targets_${_x}"]=0
done
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4 UoI-NCSA"
SLOT="${PV}"
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto miri nightly parallel-compiler rustfmt rust-analyzer rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
LLVM_DEPEND=()
# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation
for _x in "${ALL_LLVM_TARGETS[@]}"; do
LLVM_DEPEND+=( " ${_x}? ( $(llvm_gen_dep "llvm-core/llvm:\${LLVM_SLOT}[${_x}]") )" )
if [[ -v ALL_RUST_EXPERIMENTAL_TARGETS["${_x}"] ]] ; then
ALL_RUST_EXPERIMENTAL_TARGETS["${_x}"]=1
fi
done
LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" )
LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
BDEPEND="${PYTHON_DEPS}
app-eselect/eselect-rust
|| (
>=sys-devel/gcc-4.7[cxx]
>=llvm-core/clang-3.5
)
!system-llvm? (
>=dev-build/cmake-3.13.4
app-alternatives/ninja
)
test? ( dev-debug/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=
system-llvm? (
${LLVM_DEPEND[*]}
llvm-libunwind? ( llvm-runtimes/libunwind:= )
)
!system-llvm? (
!llvm-libunwind? (
elibc_musl? ( sys-libs/libunwind:= )
)
)
"
RDEPEND="${DEPEND}
app-eselect/eselect-rust
dev-lang/rust-common
sys-apps/lsb-release
!dev-lang/rust:stable
!dev-lang/rust-bin:stable
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
miri? ( nightly )
parallel-compiler? ( nightly )
rust-analyzer? ( 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
usr/lib/${PN}/${PV}/lib/rustlib/.*/lib/self-contained/crtn.o
"
# 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=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.71.1-fix-bootstrap-version-comparison.patch
"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.62.1-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
toml_usex() {
usex "${1}" true false
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
if use amd64; then
M=$(( $(usex abi_x86_32 13 10) * ${M} / 10 ))
fi
M=$(( $(usex clippy 128 0) + ${M} ))
M=$(( $(usex miri 128 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 "llvm-core/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]"
}
# Is LLVM being linked against libc++?
is_libcxx_linked() {
local code='#include <ciso646>
#if defined(_LIBCPP_VERSION)
HAVE_LIBCXX
#endif
'
local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1
[[ ${out} == *HAVE_LIBCXX* ]]
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
export LIBGIT2_NO_PKG_CONFIG=1 #749381
rust_pkg_setup
if use system-llvm; then
llvm-r1_pkg_setup
local llvm_config="$(get_llvm_prefix)/bin/llvm-config"
export LLVM_LINK_SHARED=1
export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
fi
}
src_configure() {
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
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_abi $(get_abi_CHOST ${v##*.}))\""
done
if use wasm; then
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#,}"
# cargo and rustdoc are mandatory and should always be included
local tools='"cargo","rustdoc", "rust-demangler"'
use clippy && tools+=',"clippy"'
use miri && tools+=',"miri"'
use rustfmt && tools+=',"rustfmt"'
use rust-analyzer && tools+=',"rust-analyzer"'
use rust-src && tools+=',"src"'
local 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)"
RUST_EXPERIMENTAL_TARGETS=()
for _x in "${!ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
if [[ ${ALL_RUST_EXPERIMENTAL_TARGETS[${_x}]} == 1 ]] && use ${_x} ; then
RUST_EXPERIMENTAL_TARGETS+=( ${_x#llvm_targets_} )
fi
done
RUST_EXPERIMENTAL_TARGETS=${RUST_EXPERIMENTAL_TARGETS[@]}
local cm_btype="$(usex debug DEBUG RELEASE)"
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 = "${RUST_EXPERIMENTAL_TARGETS// /;}"
link-shared = $(toml_usex system-llvm)
$(if is_libcxx_linked; then
# https://bugs.gentoo.org/732632
echo "use-libcxx = true"
echo "static-libstdcpp = false"
fi)
$(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)
enable-warnings = false
[llvm.build-config]
CMAKE_VERBOSE_MAKEFILE = "ON"
CMAKE_C_FLAGS_${cm_btype} = "${CFLAGS}"
CMAKE_CXX_FLAGS_${cm_btype} = "${CXXFLAGS}"
CMAKE_EXE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = "${LDFLAGS}"
CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = "${ARFLAGS}"
[build]
build-stage = 2
test-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 = true
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 = "${CHOST}-cc"
parallel-compiler = $(toml_usex parallel-compiler)
channel = "$(usex nightly nightly stable)"
description = "gentoo"
rpath = true
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
lto = "$(usex lto fat off)"
[dist]
src-tarball = false
compression-formats = ["xz"]
compression-profile = "balanced"
_EOF_
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/config.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
cxx = "$(tc-getCXX)"
linker = "$(tc-getCC)"
ranlib = "$(tc-getRANLIB)"
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/config.toml
crt-static = false
_EOF_
fi
done
if use wasm; then
cat <<- _EOF_ >> "${S}"/config.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
profiler = false
_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)/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}\""
echo MAGIC_EXTRA_RUSTFLAGS="\"${MAGIC_EXTRA_RUSTFLAGS}\""
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "config.toml contents:"
cat "${S}"/config.toml || die
echo
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --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 ! 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() {
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
local symlinks=(
cargo
rustc
rustdoc
rust-gdb
rust-gdbgui
rust-lldb
rust-demangler
)
use clippy && symlinks+=( clippy-driver cargo-clippy )
use miri && symlinks+=( miri cargo-miri )
use rustfmt && symlinks+=( rustfmt cargo-fmt )
use rust-analyzer && symlinks+=( rust-analyzer )
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_
MANPATH="${EPREFIX}/usr/lib/rust/man-${PV}"
_EOF_
rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die
rm -rf "${ED}/usr/lib/${PN}/${PV}/bin"/*.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-demangler
/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 rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
if use rust-analyzer; then
echo /usr/bin/rust-analyzer >> "${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_preinst() {
# 943308 and friends; basically --keep-going can forget to unmerge old rust
# but the soft blocker allows us to install conflicting files.
# This results in duplicated .{rlib,so} files which confuses rustc and results in
# the need for manual intervention.
if has_version -b "dev-lang/rust:stable/$(ver_cut 1-2)"; then
# we need to find all .{rlib,so} files in the old rust lib directory
# and store them in an array for later use
readarray -d '' old_rust_libs < <(
find "${EROOT}/usr/lib/rust/${PV}/lib/rustlib" \
-type f \( -name '*.rlib' -o -name '*.so' \) -print0)
export old_rust_libs
if [[ ${#old_rust_libs[@]} -gt 0 ]]; then
einfo "Found old .rlib and .so files in the old rust lib directory"
else
die "Found no old .rlib and .so files but old rust version is installed. Bailing!"
fi
fi
}
pkg_postinst() {
local old_rust="dev-lang/rust:stable/$(ver_cut 1-2)"
if has_version -b ${old_rust}; then
# Be _extra_ careful here as we're removing files from the live filesystem
local f
local only_one_file=()
einfo "Tidying up libraries files from non-slotted \`${old_rust}\`."
for f in "${old_rust_libs[@]}"; do
[[ -f ${f} ]] || die "old_rust_libs array contains non-existent file"
local base_name="${f%-*}"
local ext="${f##*.}"
local matching_files=("${base_name}"-*.${ext})
case ${#matching_files[@]} in
2)
einfo "Removing old .${ext}: ${f}"
rm "${f}" || die
;;
1)
# Turns out fingerprints are not as unique as we'd thought, _sometimes_ they collide,
# so we may have already installed over the old file.
# We'll warn about this just in case, but it's probably fine.
only_one_file+=( "${matching_files[0]}" )
;;
*)
die "Expected one or two files matching ${base_name}-\*.rlib, but found ${#matching_files[@]}"
;;
esac
done
if [[ ${#only_one_file} -gt 0 ]]; then
einfo "While tidying up non-slotted rust libraries for \`${old_rust}\`,"
einfo "the following file(s) did not have a duplicate where one was expected:"
for f in "${only_one_file[@]}"; do
einfo " * ${f}"
done
einfo ""
einfo "This is unlikely to cause problems; the fingerprint for the library ended up being the same."
einfo "However, if you encounter any issues please report them to the Gentoo Rust Team."
fi
fi
eselect rust update
if has_version dev-debug/gdb || has_version llvm-core/lldb; then
elog "Rust installs helper scripts for calling GDB and LLDB,"
elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${PV}."
fi
optfeature "Emacs support" "app-emacs/rust-mode"
optfeature "Vim support" "app-vim/rust-vim"
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 17 )
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{11..12} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -16,27 +18,38 @@ MRUSTC_RUST_VERSION="1.74.0"
inherit check-reqs cmake edo estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Language empowering everyone to build reliable and efficient software"
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -151,13 +164,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.62.1-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -247,7 +253,20 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
# We'll need to revert this after the bootstrap.
if use mrustc-bootstrap; then
@ -564,7 +583,8 @@ llvm_bootstrap() {
"-G Ninja"
"-DLLVM_TARGET_ARCH=${CFG_COMPILER_HOST_TRIPLE%%-*}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${CFG_COMPILER_HOST_TRIPLE}"
"-DLLVM_TARGETS_TO_BUILD=${BOOTSTRAP_LLVM_TARGETS:=X86;ARM;AArch64}" #;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
#;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX
"-DLLVM_TARGETS_TO_BUILD=${BOOTSTRAP_LLVM_TARGETS:=X86;ARM;AArch64}"
"-DLLVM_ENABLE_ASSERTIONS=OFF"
"-DLLVM_INCLUDE_EXAMPLES=OFF"
"-DLLVM_INCLUDE_TESTS=OFF"
@ -804,7 +824,7 @@ mrustc_bootstrap() {
src_compile() {
use mrustc-bootstrap && mrustc_bootstrap
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -860,7 +880,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 17 )
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{11..12} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Language empowering everyone to build reliable and efficient software"
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,16 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
# This patch shouldn't be necessary for later versions of Rust because its
# code was backported from master.
"${FILESDIR}"/1.75.0-handle-vendored-sources.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -228,6 +232,24 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -524,7 +546,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -580,7 +602,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 17 )
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{11..12} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,15 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.75.0-handle-vendored-sources.patch
"${FILESDIR}"/1.76.0-loong-code-model.patch # remove for >=1.78.0
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -227,6 +232,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -441,7 +463,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -497,7 +519,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 17 )
PYTHON_COMPAT=( python3_{10..12} )
PYTHON_COMPAT=( python3_{11..12} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,14 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.75.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.70.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.76.0-loong-code-model.patch # remove for >=1.78.0
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -226,6 +232,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -523,7 +546,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -579,7 +602,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 18 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,14 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.78.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.79.0-revert-8c40426.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -226,6 +232,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -525,7 +548,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -581,7 +604,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
@ -668,7 +691,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 18 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,14 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.78.0-ignore-broken-and-non-applicable-tests.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.79.0-revert-8c40426.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -226,6 +232,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -525,7 +548,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -581,7 +604,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
@ -668,7 +691,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 18 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing multilib multilib-build \
optfeature python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,13 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.79.0-revert-8c40426.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -225,6 +232,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -524,7 +548,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -580,7 +604,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
@ -665,7 +689,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 18 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,14 +14,32 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
@ -27,12 +47,6 @@ RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).1"
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -141,16 +155,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.79.0-revert-8c40426.patch
"${FILESDIR}/1.81.0-backport-bug937164.patch"
"${FILESDIR}/1.81.0-backport-llvm-pr101761.patch"
"${FILESDIR}/1.81.0-backport-llvm-pr101766.patch"
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -229,6 +233,23 @@ pkg_setup() {
fi
}
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
@ -528,7 +549,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -584,7 +605,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die
@ -669,7 +690,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,13 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.74.1-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.82.0-dwarf-llvm-assertion.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -225,14 +232,20 @@ pkg_setup() {
fi
}
src_prepare() {
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
@ -536,7 +549,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -592,7 +605,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${PV}/share/man/
@ -680,7 +693,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -140,13 +154,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.83.0-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.83.0-dwarf-llvm-assertion.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -225,14 +232,20 @@ pkg_setup() {
fi
}
src_prepare() {
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
default
}
@ -536,7 +549,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -592,7 +605,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${PV}/share/man/
@ -680,7 +693,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -146,12 +160,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.83.0-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -230,14 +238,20 @@ pkg_setup() {
fi
}
src_prepare() {
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -550,7 +564,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -606,7 +620,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${PV}/share/man/
@ -694,7 +708,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV}
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -12,26 +14,38 @@ RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *beta* ]]; then
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
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 )
"
S="${WORKDIR}/${MY_P}-src"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
@ -146,13 +160,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.78.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.83.0-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
"${FILESDIR}"/1.84.1-fix-cross.patch # already upstreamed
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -231,14 +238,20 @@ pkg_setup() {
fi
}
src_prepare() {
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
src_unpack() {
if use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -551,7 +564,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -607,7 +620,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${PV}/share/man/
@ -695,7 +708,7 @@ src_install() {
doins "${T}/provider-${P}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${PV}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,6 +47,7 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
@ -170,12 +174,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -184,48 +182,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -298,19 +254,61 @@ pkg_setup() {
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -638,7 +636,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -694,7 +692,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -784,7 +782,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,10 +47,11 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv ~sparc x86"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Systems programming language originally developed by Mozilla"
@ -170,12 +174,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -184,48 +182,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -298,19 +254,61 @@ pkg_setup() {
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -638,7 +636,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -694,7 +692,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -784,7 +782,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,10 +47,11 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Systems programming language originally developed by Mozilla"
@ -171,12 +175,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -185,48 +183,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -299,25 +255,69 @@ pkg_setup() {
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
fi
default
eapply "${FILESDIR}"/rust-1.86.0-issue-139372-bgo-953956-fix-hardcoded-gnu-linker-flags.patch
}
src_configure() {
@ -639,7 +639,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -695,7 +695,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -785,7 +785,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -4,7 +4,9 @@
EAPI=8
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..14} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
@ -37,6 +39,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,10 +47,11 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc ppc64 ~riscv sparc x86"
fi
DESCRIPTION="Systems programming language originally developed by Mozilla"
@ -88,8 +92,10 @@ done
LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" )
LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
# dev-libs/oniguruma is used for documentation
BDEPEND="${PYTHON_DEPS}
app-eselect/eselect-rust
dev-libs/oniguruma
|| (
>=sys-devel/gcc-4.7[cxx]
>=llvm-core/clang-3.5
@ -170,12 +176,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -184,48 +184,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -298,25 +256,69 @@ pkg_setup() {
fi
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
fi
default
eapply "${FILESDIR}"/rust-1.87.0-issue-139372-bgo-953956-fix-hardcoded-gnu-linker-flags.patch
}
src_configure() {
@ -327,6 +329,12 @@ src_configure() {
export OPENSSL_LIB_DIR="${ESYSROOT}/usr/$(get_libdir)"
fi
# Avoid bundled copies of libraries
export RUSTONIG_SYSTEM_LIBONIG=1
# Need to check if these can be optional
#export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
#export LIBSSH2_SYS_USE_PKG_CONFIG=1
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
local rust_target="" rust_targets="" arch_cflags
@ -638,7 +646,7 @@ src_configure() {
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -694,7 +702,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -784,7 +792,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/config.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -3,18 +3,16 @@
EAPI=8
LLVM_COMPAT=( 19 )
PYTHON_COMPAT=( python3_{10..13} )
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{11..14} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
RUST_MIN_VER="1.85.0" # Update this as new `beta` releases come out.
RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out.
elif [[ ${PV} == *beta* ]]; then
# Enforce that `beta` is built from `stable`.
# While uncommon it is possible for feature changes within `beta` to result
# in an older snapshot being unable to build a newer one without modifying the sources.
# 'stable' releases should always be able to build a beta snapshot so just use those.
RUST_MAX_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).1"
RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0"
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
else
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -25,11 +23,6 @@ inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
@ -37,6 +30,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,6 +38,7 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
@ -70,7 +65,7 @@ done
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
if [[ ${PV} = *9999* ]]; then
# These USE flags require nightly rust
@ -88,8 +83,10 @@ done
LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" )
LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
# dev-libs/oniguruma is used for documentation
BDEPEND="${PYTHON_DEPS}
app-eselect/eselect-rust
dev-libs/oniguruma
|| (
>=sys-devel/gcc-4.7[cxx]
>=llvm-core/clang-3.5
@ -170,11 +167,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -183,48 +175,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -297,19 +247,82 @@ pkg_setup() {
fi
}
rust_live_get_sources() {
EGIT_REPO_URI="
https://anongit.gentoo.org/git/proj/rust-patches.git
"
EGIT_CHECKOUT_DIR="${WORKDIR}/rust-patches-${RUST_PATCH_VER}"
git-r3_src_unpack
EGIT_REPO_URI="
https://github.com/rust-lang/rust.git
"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
S="${WORKDIR}/rust"
EGIT_CHECKOUT_DIR="${S}"
git-r3_src_unpack
}
src_unpack() {
if [[ ${PV} == *9999* ]] ; then
rust_live_get_sources
# Vendor dependencies
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/bootstrap.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-bootstrap.toml"
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-bootstrap.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -326,6 +339,12 @@ src_configure() {
export OPENSSL_LIB_DIR="${ESYSROOT}/usr/$(get_libdir)"
fi
# Avoid bundled copies of libraries
export RUSTONIG_SYSTEM_LIBONIG=1
# Need to check if these can be optional
#export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
#export LIBSSH2_SYS_USE_PKG_CONFIG=1
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
local rust_target="" rust_targets="" arch_cflags
@ -385,7 +404,9 @@ src_configure() {
build_channel="stable"
;;
esac
cat <<- _EOF_ > "${S}"/config.toml
cat <<- _EOF_ > "${S}"/bootstrap.toml
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[llvm]
@ -479,6 +500,7 @@ src_configure() {
verbose-tests = true
optimize-tests = $(toml_usex !debug)
codegen-tests = true
omit-git-hash = false
dist-src = false
remap-debuginfo = true
lld = $(usex system-llvm false $(toml_usex wasm))
@ -505,7 +527,7 @@ src_configure() {
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
@ -515,14 +537,14 @@ src_configure() {
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
crt-static = false
musl-root = "$($(tc-getCC) -print-sysroot)/usr"
_EOF_
@ -531,7 +553,7 @@ src_configure() {
if use wasm; then
wasm_target="wasm32-unknown-unknown"
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
@ -579,7 +601,7 @@ src_configure() {
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
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${cross_rust_target}]
ar = "${cross_toolchain}-ar"
cc = "${cross_toolchain}-gcc"
@ -588,12 +610,12 @@ src_configure() {
ranlib = "${cross_toolchain}-ranlib"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
if [[ "${cross_toolchain}" == *-musl* ]]; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr"
_EOF_
fi
@ -603,7 +625,7 @@ src_configure() {
# 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
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" bootstrap.toml || die
ewarn
ewarn "Enabled ${cross_rust_target} rust target"
@ -631,13 +653,14 @@ src_configure() {
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "config.toml contents:"
cat "${S}"/config.toml || die
einfo "bootstrap.toml contents:"
cat "${S}"/bootstrap.toml || die
echo
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
# -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -678,7 +701,7 @@ src_test() {
for i in "${tests[@]}"; do
local t="src/test/${i}"
einfo "rust_src_test: running ${t}"
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.toml \
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
then
failed+=( "${t}" )
@ -693,7 +716,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -783,7 +806,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -0,0 +1,835 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{11..14} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out.
elif [[ ${PV} == *beta* ]]; then
RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0"
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
else
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
fi
inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs verify-sig
if [[ ${PV} = *9999* ]]; then
inherit git-r3
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
DESCRIPTION="Systems programming language originally developed by Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
# keep in sync with llvm ebuild of the same version as bundled one.
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai
LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE
WebAssembly X86 XCore Xtensa )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?}
# https://github.com/rust-lang/llvm-project/blob/rustc-1.84.0/llvm/CMakeLists.txt
_ALL_RUST_EXPERIMENTAL_TARGETS=( ARC CSKY DirectX M68k SPIRV Xtensa )
declare -A ALL_RUST_EXPERIMENTAL_TARGETS
for _x in "${_ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
ALL_RUST_EXPERIMENTAL_TARGETS["llvm_targets_${_x}"]=0
done
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
if [[ ${PV} = *9999* ]]; then
# These USE flags require nightly rust
IUSE+=" miri"
fi
LLVM_DEPEND=()
# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation
for _x in "${ALL_LLVM_TARGETS[@]}"; do
LLVM_DEPEND+=( " ${_x}? ( $(llvm_gen_dep "llvm-core/llvm:\${LLVM_SLOT}[${_x}]") )" )
if [[ -v ALL_RUST_EXPERIMENTAL_TARGETS["${_x}"] ]] ; then
ALL_RUST_EXPERIMENTAL_TARGETS["${_x}"]=1
fi
done
LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" )
LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
# dev-libs/oniguruma is used for documentation
BDEPEND="${PYTHON_DEPS}
app-eselect/eselect-rust
dev-libs/oniguruma
|| (
>=sys-devel/gcc-4.7[cxx]
>=llvm-core/clang-3.5
)
lto? ( system-llvm? (
|| (
$(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}')
sys-devel/mold
)
) )
!system-llvm? (
>=dev-build/cmake-3.13.4
app-alternatives/ninja
)
test? ( dev-debug/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=
system-llvm? (
${LLVM_DEPEND[*]}
llvm-libunwind? ( llvm-runtimes/libunwind:= )
)
!system-llvm? (
!llvm-libunwind? (
elibc_musl? ( sys-libs/libunwind:= )
)
)
"
RDEPEND="${DEPEND}
app-eselect/eselect-rust
dev-lang/rust-common
sys-apps/lsb-release
!dev-lang/rust:stable
!dev-lang/rust-bin:stable
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
rust-analyzer? ( 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}/${SLOT}/bin/.*
usr/lib/${PN}/${SLOT}/libexec/.*
usr/lib/${PN}/${SLOT}/lib/lib.*.so
usr/lib/${PN}/${SLOT}/lib/rustlib/.*/bin/.*
usr/lib/${PN}/${SLOT}/lib/rustlib/.*/lib/lib.*.so
"
QA_SONAME="
usr/lib/${PN}/${SLOT}/lib/lib.*.so.*
usr/lib/${PN}/${SLOT}/lib/rustlib/.*/lib/lib.*.so
"
QA_PRESTRIPPED="
usr/lib/${PN}/${SLOT}/lib/rustlib/.*/bin/rust-llvm-dwp
usr/lib/${PN}/${SLOT}/lib/rustlib/.*/lib/self-contained/crtn.o
"
# 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}/${SLOT}/lib/rustlib/*/lib*.rlib:lib.rmeta"
# causes double bootstrap
RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
toml_usex() {
usex "${1}" true false
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
if use amd64; then
M=$(( $(usex abi_x86_32 13 10) * ${M} / 10 ))
fi
M=$(( $(usex clippy 128 0) + ${M} ))
if [[ ${PV} == *9999* ]]; then
M=$(( $(usex miri 128 0) + ${M} ))
fi
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 "llvm-core/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]"
}
# Is LLVM being linked against libc++?
is_libcxx_linked() {
local code='#include <ciso646>
#if defined(_LIBCPP_VERSION)
HAVE_LIBCXX
#endif
'
local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1
[[ ${out} == *HAVE_LIBCXX* ]]
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
export LIBGIT2_NO_PKG_CONFIG=1 #749381
if tc-is-cross-compiler; then
use system-llvm && die "USE=system-llvm not allowed when cross-compiling"
local cross_llvm_target="$(llvm_tuple_to_target "${CBUILD}")"
use "llvm_targets_${cross_llvm_target}" || \
die "Must enable LLVM_TARGETS=${cross_llvm_target} matching CBUILD=${CBUILD} when cross-compiling"
fi
rust_pkg_setup
if use system-llvm; then
llvm-r1_pkg_setup
local llvm_config="$(get_llvm_prefix)/bin/llvm-config"
export LLVM_LINK_SHARED=1
export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)"
fi
}
rust_live_get_sources() {
EGIT_REPO_URI="
https://anongit.gentoo.org/git/proj/rust-patches.git
"
EGIT_CHECKOUT_DIR="${WORKDIR}/rust-patches-${RUST_PATCH_VER}"
git-r3_src_unpack
EGIT_REPO_URI="
https://github.com/rust-lang/rust.git
"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
S="${WORKDIR}/rust"
EGIT_CHECKOUT_DIR="${S}"
git-r3_src_unpack
}
src_unpack() {
if [[ ${PV} == *9999* ]] ; then
rust_live_get_sources
# Vendor dependencies
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/bootstrap.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-bootstrap.toml"
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-bootstrap.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
fi
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH="${ESYSROOT}/usr/$(get_libdir)/pkgconfig"
export OPENSSL_INCLUDE_DIR="${ESYSROOT}/usr/include"
export OPENSSL_LIB_DIR="${ESYSROOT}/usr/$(get_libdir)"
fi
# Avoid bundled copies of libraries
export RUSTONIG_SYSTEM_LIBONIG=1
# Need to check if these can be optional
#export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
#export LIBSSH2_SYS_USE_PKG_CONFIG=1
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
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_abi $(get_abi_CHOST ${v##*.}))\""
done
if use wasm; then
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/base/wasm.rs || die
fi
fi
rust_targets="${rust_targets#,}"
# cargo and rustdoc are mandatory and should always be included
local tools='"cargo","rustdoc"'
use clippy && tools+=',"clippy"'
use rustfmt && tools+=',"rustfmt"'
use rust-analyzer && tools+=',"rust-analyzer","rust-analyzer-proc-macro-srv"'
use rust-src && tools+=',"src"'
if [[ ${PV} == *9999* ]]; then
use miri && tools+=',"miri"'
fi
local 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)"
rust_build="$(rust_abi "${CBUILD}")"
rust_host="$(rust_abi "${CHOST}")"
RUST_EXPERIMENTAL_TARGETS=()
for _x in "${!ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
if [[ ${ALL_RUST_EXPERIMENTAL_TARGETS[${_x}]} == 1 ]] && use ${_x} ; then
RUST_EXPERIMENTAL_TARGETS+=( ${_x#llvm_targets_} )
fi
done
RUST_EXPERIMENTAL_TARGETS=${RUST_EXPERIMENTAL_TARGETS[@]}
local cm_btype="$(usex debug DEBUG RELEASE)"
local build_channel
local build_miri="false"
case "${PV}" in
*9999*)
build_channel="nightly"
;;
*beta*)
build_channel="beta"
;;
*)
build_channel="stable"
;;
esac
cat <<- _EOF_ > "${S}"/bootstrap.toml
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[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 = "${RUST_EXPERIMENTAL_TARGETS// /;}"
link-shared = $(toml_usex system-llvm)
$(if is_libcxx_linked; then
# https://bugs.gentoo.org/732632
echo "use-libcxx = true"
echo "static-libstdcpp = false"
fi)
$(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)
enable-warnings = false
[llvm.build-config]
CMAKE_VERBOSE_MAKEFILE = "ON"
$(if ! tc-is-cross-compiler; then
# When cross-compiling, LLVM is compiled twice, once for host and
# once for target. Unfortunately, this build configuration applies
# to both, which means any flags applicable to one target but not
# the other will break. Conditionally disable respecting user
# flags when cross-compiling.
echo "CMAKE_C_FLAGS_${cm_btype} = \"${CFLAGS}\""
echo "CMAKE_CXX_FLAGS_${cm_btype} = \"${CXXFLAGS}\""
echo "CMAKE_EXE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = \"${ARFLAGS}\""
fi)
[build]
build-stage = 2
test-stage = 2
build = "${rust_build}"
host = ["${rust_host}"]
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 = true
cargo-native-static = false
[install]
prefix = "${EPREFIX}/usr/lib/${PN}/${SLOT}"
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
$(if ! tc-is-cross-compiler; then
echo "default-linker = \"${CHOST}-cc\""
fi)
channel = "${build_channel}"
description = "gentoo"
rpath = true
verbose-tests = true
optimize-tests = $(toml_usex !debug)
codegen-tests = true
omit-git-hash = false
dist-src = false
remap-debuginfo = true
lld = $(usex system-llvm false $(toml_usex wasm))
$(if use lto && tc-is-clang && ! tc-ld-is-mold; then
echo "use-lld = true"
fi)
# 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
# See https://github.com/rust-lang/rust/issues/121124
lto = "$(usex lto thin off)"
[dist]
src-tarball = false
compression-formats = ["xz"]
compression-profile = "balanced"
_EOF_
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
cxx = "$(tc-getCXX)"
linker = "$(tc-getCC)"
ranlib = "$(tc-getRANLIB)"
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
crt-static = false
musl-root = "$($(tc-getCC) -print-sysroot)/usr"
_EOF_
fi
done
if use wasm; then
wasm_target="wasm32-unknown-unknown"
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
profiler = false
_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}"/bootstrap.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}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
if [[ "${cross_toolchain}" == *-musl* ]]; then
cat <<- _EOF_ >> "${S}"/bootstrap.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}\]#" bootstrap.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}\""
echo MAGIC_EXTRA_RUSTFLAGS="\"${MAGIC_EXTRA_RUSTFLAGS}\""
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "bootstrap.toml contents:"
cat "${S}"/bootstrap.toml || die
echo
}
src_compile() {
# -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.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 ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.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() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${SLOT}/etc/bash_completion.d/cargo" || die
rmdir -v "${ED}/usr/lib/${PN}/${SLOT}"/etc{/bash_completion.d,} || die
local symlinks=(
cargo
rustc
rustdoc
rust-gdb
rust-gdbgui
rust-lldb
)
use clippy && symlinks+=( clippy-driver cargo-clippy )
if [[ ${PV} = *9999* ]]; then
use miri && symlinks+=( miri cargo-miri )
fi
use rustfmt && symlinks+=( rustfmt cargo-fmt )
use rust-analyzer && symlinks+=( rust-analyzer )
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}/${SLOT}/bin/${i}" ]]; then
einfo "Installing ${i} symlink"
ln -v "${ED}/usr/lib/${PN}/${SLOT}/bin/${i}" "${ED}/usr/lib/${PN}/${SLOT}/bin/${ver_i}" || die
else
ewarn "${i} symlink requested, but source file not found"
ewarn "please report this"
fi
dosym "../lib/${PN}/${SLOT}/bin/${ver_i}" "/usr/bin/${ver_i}"
done
# symlinks to switch components to active rust in eselect
dosym "${SLOT}/lib" "/usr/lib/${PN}/lib-${SLOT}"
use rust-analyzer && dosym "${SLOT}/libexec" "/usr/lib/${PN}/libexec-${SLOT}"
dosym "${SLOT}/share/man" "/usr/lib/${PN}/man-${SLOT}"
dosym "rust/${SLOT}/lib/rustlib" "/usr/lib/rustlib-${SLOT}"
dosym "../../lib/${PN}/${SLOT}/share/doc/rust" "/usr/share/doc/${P}"
newenvd - "50${P}" <<-_EOF_
MANPATH="${EPREFIX}/usr/lib/rust/man-${SLOT}"
_EOF_
rm -rf "${ED}/usr/lib/${PN}/${SLOT}"/*.old || die
rm -rf "${ED}/usr/lib/${PN}/${SLOT}/bin"/*.old || die
rm -rf "${ED}/usr/lib/${PN}/${SLOT}/doc"/*.old || die
# note: eselect-rust adds EROOT to all paths below
cat <<-_EOF_ > "${T}/provider-${PN}-${SLOT}"
/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/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 [[ ${SLOT} == *9999* ]] && use miri; then
echo /usr/bin/miri >> "${T}/provider-${P}"
echo /usr/bin/cargo-miri >> "${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 rust-analyzer; then
echo /usr/lib/rust/libexec >> "${T}/provider-${P}"
echo /usr/bin/rust-analyzer >> "${T}/provider-${P}"
fi
insinto /etc/env.d/rust
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi
}
pkg_postinst() {
eselect rust update
if has_version dev-debug/gdb || has_version llvm-core/lldb; then
elog "Rust installs helper scripts for calling GDB and LLDB,"
elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${PV}."
fi
if has_version app-editors/emacs; then
optfeature "emacs support for rust" app-emacs/rust-mode
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
optfeature "vim support for rust" app-vim/rust-vim
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -4,17 +4,15 @@
EAPI=8
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..14} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
RUST_MIN_VER="1.86.0" # Update this as new `beta` releases come out.
RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out.
elif [[ ${PV} == *beta* ]]; then
# Enforce that `beta` is built from `stable`.
# While uncommon it is possible for feature changes within `beta` to result
# in an older snapshot being unable to build a newer one without modifying the sources.
# 'stable' releases should always be able to build a beta snapshot so just use those.
RUST_MAX_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).1"
RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0"
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
else
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -25,11 +23,6 @@ inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
@ -37,6 +30,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,6 +38,7 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
@ -70,7 +65,7 @@ done
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
if [[ ${PV} = *9999* ]]; then
# These USE flags require nightly rust
@ -88,8 +83,10 @@ done
LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" )
LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" )
# dev-libs/oniguruma is used for documentation
BDEPEND="${PYTHON_DEPS}
app-eselect/eselect-rust
dev-libs/oniguruma
|| (
>=sys-devel/gcc-4.7[cxx]
>=llvm-core/clang-3.5
@ -170,12 +167,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -184,48 +175,6 @@ toml_usex() {
usex "${1}" true false
}
src_unpack() {
if [[ ${PV} = *9999* ]]; then
git-r3_src_unpack
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/config.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
else
verify-sig_src_unpack
fi
}
pre_build_checks() {
local M=9216
# multiply requirements by 1.3 if we are doing x86-multilib
@ -298,19 +247,82 @@ pkg_setup() {
fi
}
rust_live_get_sources() {
EGIT_REPO_URI="
https://anongit.gentoo.org/git/proj/rust-patches.git
"
EGIT_CHECKOUT_DIR="${WORKDIR}/rust-patches-${RUST_PATCH_VER}"
git-r3_src_unpack
EGIT_REPO_URI="
https://github.com/rust-lang/rust.git
"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
S="${WORKDIR}/rust"
EGIT_CHECKOUT_DIR="${S}"
git-r3_src_unpack
}
src_unpack() {
if [[ ${PV} == *9999* ]] ; then
rust_live_get_sources
# Vendor dependencies
mkdir "${S}/.cargo" || die # The vendor script has a check for .cargo/config{,.toml}
touch "${S}/.cargo/bootstrap.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-bootstrap.toml"
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
[build]
build = "$(rust_abi "${CBUILD}")"
host = ["$(rust_abi "${CHOST}")"]
target = ["$(rust_abi "${CHOST}")"]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
_EOF_
# We're using git sources so we need to run the Vendor script
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -v --config="${T}"/vendor-bootstrap.toml -j$(makeopts_jobs) ||
die "Failed to vendor dependencies"
# TODO: This has to be generated somehow, this is from a 1.84.x tarball I had lying around.
cat <<- _EOF_ > "${S}/.cargo/config.toml"
[source.crates-io]
replace-with = "vendored-sources"
[source."git+https://github.com/rust-lang/team"]
git = "https://github.com/rust-lang/team"
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
_EOF_
elif use verify-sig ; then
# Patch tarballs are not signed (but we trust Gentoo infra)
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
fi
# Rust baselines to Pentium4 on x86, this patch lowers the baseline to i586 when sse2 is not set.
if use x86; then
if ! use cpu_flags_x86_sse2; then
eapply "${FILESDIR}/1.82.0-i586-baseline.patch"
#grep -rl cmd.args.push\(\"-march=i686\" . | xargs sed -i 's/march=i686/-march=i586/g' || die
fi
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
@ -327,6 +339,12 @@ src_configure() {
export OPENSSL_LIB_DIR="${ESYSROOT}/usr/$(get_libdir)"
fi
# Avoid bundled copies of libraries
export RUSTONIG_SYSTEM_LIBONIG=1
# Need to check if these can be optional
#export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
#export LIBSSH2_SYS_USE_PKG_CONFIG=1
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
local rust_target="" rust_targets="" arch_cflags
@ -386,7 +404,9 @@ src_configure() {
build_channel="stable"
;;
esac
cat <<- _EOF_ > "${S}"/config.toml
cat <<- _EOF_ > "${S}"/bootstrap.toml
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[llvm]
@ -507,7 +527,7 @@ src_configure() {
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
@ -517,14 +537,14 @@ src_configure() {
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
crt-static = false
musl-root = "$($(tc-getCC) -print-sysroot)/usr"
_EOF_
@ -533,7 +553,7 @@ src_configure() {
if use wasm; then
wasm_target="wasm32-unknown-unknown"
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
@ -581,7 +601,7 @@ src_configure() {
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
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${cross_rust_target}]
ar = "${cross_toolchain}-ar"
cc = "${cross_toolchain}-gcc"
@ -590,12 +610,12 @@ src_configure() {
ranlib = "${cross_toolchain}-ranlib"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
if [[ "${cross_toolchain}" == *-musl* ]]; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr"
_EOF_
fi
@ -605,7 +625,7 @@ src_configure() {
# 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
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" bootstrap.toml || die
ewarn
ewarn "Enabled ${cross_rust_target} rust target"
@ -633,13 +653,14 @@ src_configure() {
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "config.toml contents:"
cat "${S}"/config.toml || die
einfo "bootstrap.toml contents:"
cat "${S}"/bootstrap.toml || die
echo
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
# -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -680,7 +701,7 @@ src_test() {
for i in "${tests[@]}"; do
local t="src/test/${i}"
einfo "rust_src_test: running ${t}"
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.toml \
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
then
failed+=( "${t}" )
@ -695,7 +716,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -785,7 +806,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi