dev-lang/rust: add 1.95.0_beta30360310

Signed-off-by: Matt Jolly <kangie@gentoo.org>
This commit is contained in:
Matt Jolly
2026-03-10 18:45:50 +10:00
parent e14105168d
commit d0653fc1c0
9 changed files with 1518 additions and 0 deletions

View File

@@ -822,6 +822,34 @@ DIST rust-1.94.0-x86_64-unknown-linux-gnu.tar.xz 191856892 BLAKE2B fd5c644e56e6b
DIST rust-1.94.0-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B b88f0dd8daf268a914dbfb3ebaf9c48f0b74c3a84076db3e01e0d1d29c2d2502f81208eee55b063c1641965c4c1aa1cc08cc0c2668702e21b7766af7ca42f313 SHA512 330b12351d6a667c2bcc446e08048549e57d75f2eb3f7733f6313312c0c0064ddcd8426b9351c59cae99e5f2a436f5998e3b6b04e1d334a6c09b685c94474578
DIST rust-1.94.0-x86_64-unknown-linux-musl.tar.xz 294178664 BLAKE2B 705ca28c01ae4eba4777ac636656be2c21c9004ba1dfec0382325e6c8c61dc2fca997a0c62a6e090f7d35fc41fb26fc300b06a5f15a2f489ab57c1a9b9529185 SHA512 43a87ff89ac4715f60643ed0de51ab505d53a86b6942b58df180a1cc81ea5da00e1be3bc101ffb25bc92831c88ef0264a7d7b92efd63cf7a0d472d169d919c22
DIST rust-1.94.0-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B 7e0cf69a5d5c4eade8dfef4b0527362184671a284616352138d1073d9ffa5e08dda1979dd35757874e5241a7b2195a8abde6cca96f50dd44e1af50e06152b736 SHA512 e3b7eb37bfb5c7713bb6fae9d20d36d7554324712740e5453946936af30029e9200bb26e11c532df8936db178526398cbb5607c598a2945b12f85ee60f507d8e
DIST rust-1.95.0_beta20260310-aarch64-unknown-linux-gnu.tar.xz 170950156 BLAKE2B 5b52175c4ca2e7e7b5d89dd3cace7ddc2c1612004f73838dc7134c17a8f8736fc2a3f01059edf7f33cc4cc8847520d10e46d83e734eb96767871430e32580cc6 SHA512 efd6b3c4d8807c18a39e0758dd01fd204f7599d9fab00dc7b55cabad9d0bb00a57c96958f58186dd3508b13fbe208e602fe28afc811bd49ff6d3029530224481
DIST rust-1.95.0_beta20260310-aarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B a9b015f6cd00c5f063480386f681bdb02d2ab178eb905c554c702d30fe24d648bbc531cdd755ceb1784839e6ef9c9bde490fea81145676a4c8ed1edac78a130d SHA512 1d46fcf56733615ab185238375f2069fbcf837bb51ed80e699f75c2bd0f7a87225988ba3c6280dd98b8bff5583b2c02750505cc55df2c32c130f40e0a22ee4d6
DIST rust-1.95.0_beta20260310-aarch64-unknown-linux-musl.tar.xz 247079820 BLAKE2B 6299c4501d32bc7451ff4ea5b65898174447229c2a474c6c37a46da7b70c278050a0b2c0888a6d90888f4d31524f41a3c94c4e7effe0c92ebcbf874faaed8a7f SHA512 e17f0521042fd4836af6f6c706ad55457b527f91abe275c583ee6aa9b3f7b5ccae9decaf5b979db71d0a8e19c35bcbd31db5e49ce31aa9f2c7e6a2b477fd3c03
DIST rust-1.95.0_beta20260310-aarch64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B 907c0d72125db33f6ec92043cc662a051d987507520abc9c379585044247b58948c7dd7ade0fb6014d69e2580b63a993a19537fa4ff5c0e972a7b594a0b6186b SHA512 b954f281416028cc01c94d902296cd6138b2fc57c8b66e43cce85bcd80b0eecda9dc905721ef82eafe9c246675b8feaf24e16a531a265617c57c2ed916cd2cf6
DIST rust-1.95.0_beta20260310-arm-unknown-linux-gnueabi.tar.xz 230441080 BLAKE2B 56b680cd0e8b2e3abbd8a1c750d4d5c8f7413818d4c6f46df314fe6ce2391cf6aca3dd5296c88bcd000070d4f7a58914b7e600beea0db8ec27e1a37fc30f3707 SHA512 17087c926afa14583c9b080e7ef19328d1a59a48232ab726914bd33acf35cf27592c844497a8b3d5810a89fcb717d02f9db6803544cbe94ec9d6c95535d0a3e9
DIST rust-1.95.0_beta20260310-arm-unknown-linux-gnueabi.tar.xz.asc 801 BLAKE2B b1176d73146b7abe2ee8729255152c7c442befee014562d3e2bfeb592843d042784f6b21e65e7de7014dd8de03fafb721dd9691177bdaa5876a1da66639cb270 SHA512 6dbd882ad889b34acad8743c162278f0272895fd5a65482af81ea143f009e4feff70595a752f3de74831b77c3169ffd7ae461b2724702b6a469bb53672b3e561
DIST rust-1.95.0_beta20260310-arm-unknown-linux-gnueabihf.tar.xz 230686256 BLAKE2B bcd56881305fe2f30a046de0dae74f73a3c86052da3cceea3062b1f1c8584f3fc87966297be31198b128293a4f89c9b70eb1a5c335ce3d25f957ffbc19943bf7 SHA512 28c6038edd3c52342d67951c84895743c3e36ebc5f47e1e9367fc37d90ecd0e9a8777a9a61cd93f78e66f7cbe09604f1ae6e5a2d679ab075091d7a234c42e4fd
DIST rust-1.95.0_beta20260310-arm-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B 01bbade3525c32a6decb24ceb4a3ff47c0d0872391d5506ca67599840c4f23d73adc5d52ad339ad8efda65d5c825698f628b45e0477d7ce2bd091e3cb3101cd1 SHA512 366716c256da4d9f54b51c422a262877ffe71f4fbba987b9712aace6ec3d56005e46bed6a8897c55c3cf9ba222b2553c1b8ab46b55feef78262137a0ed7dbae7
DIST rust-1.95.0_beta20260310-armv7-unknown-linux-gnueabihf.tar.xz 235236220 BLAKE2B 7d5ae2c568046954dd3e35bc23d43bcf5e2ca7675d4f7ebc35843850a9c0bc3b4588de99c38f728509d609c1806227cd21f12b46eb9412969925d3ccfb3746ba SHA512 d8a896a4609db25a9f32046e47645c3f629d7fe1d58f912ed0d29d94f69fa2dc17b5846643d9c912e3cd70e150cd8a7757c898fd99f79e08042fb6f437cd878c
DIST rust-1.95.0_beta20260310-armv7-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B 71209a10ddb6f80a0e842da61ce19d956fbdc1fac75b6b2f0f85e06fa43991a13a3ff40e81eea2f97a1ba0e1e8d3d1253e56db2d3ee818e4dfc19bcfe0d49c7a SHA512 ba8c0dfb6bda9a2276155724dc349d22e4e644ea89ced99cb3ad2da84ce08f5a09002aaafc1f5e22dd06d793138cbc2085f60c62d3e032f283d5465ad6cb7879
DIST rust-1.95.0_beta20260310-i686-unknown-linux-gnu.tar.xz 272594364 BLAKE2B 48541973a47affc9dcf62950bb9b5c0f720644a93a92b4c47ce46a67caaac04b07d257ad099810e1e52ceb1619bfea252b470d06b0e3012bedebfbf27d6ecbbd SHA512 388621b20fe4fb5f7878eef15f19851178aaf1c741c6f09bcce577696c371052785475dca452eb5b26885e5bef2029ba2e952e55151db19558cb21fd2411507e
DIST rust-1.95.0_beta20260310-i686-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 8769c0cc5195d852f166b388cd689bb55fb392d234c9ba161b562ef4260873ed26754045459ea199f1c6e2f2055b1439a6392b3a622a79d6b72f318a54608c5b SHA512 423dd4972a809265b0cde3bd3f5e6e715866a45597835020056c51824ce1018929103d6ecf052a47334dc734674cbfde62552af38937957397740a4cb964a6ce
DIST rust-1.95.0_beta20260310-loongarch64-unknown-linux-gnu.tar.xz 262655676 BLAKE2B eb00f4a8510dc37e3173f1570352435c3c104553d63e8c9f2c399d132626574c87fd815850c615c5e66f86544e5a173798dfd03628db8216ddf18ab5c0b9a4c4 SHA512 3f97421ed0d40f72f896dc710a7d51e643a53c6d356b030ea0a02027fa9cbe76647868842c20cc0ebdde349f4c5326117153fd6c8dac383a1828cc22f3acdbf4
DIST rust-1.95.0_beta20260310-loongarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 3616e10ed7d44c2e96e9b9573fca34610f1c520e6a13eac15521ed050f932b9fba179c94346fbe19cad1444e7bc56eaf6cdce78cf0de78b813c7530ead647c9b SHA512 edccd8a8907249342556e07816e443ddcf9ca91ca2883905c03316a964be4af560f7169d1b5d6d6e40f8534886ff02cbb95641b56771e931263875891eba77f8
DIST rust-1.95.0_beta20260310-powerpc-unknown-linux-gnu.tar.xz 253872556 BLAKE2B ae2102b8762e58d980e455254c2741542f5a804620b21f4d1c5d0da31b1b496e1fa55f70f0d2260bdd2a2873d0fb01048428c7633b9272f424800946daae94f2 SHA512 0f8a2016c221a0d4b283e06203384bb8d938ca07c7fc1c4bcf55f51e6921edcdcca9e8eba82a122366fa6364ba13665cbd4491fec323832cd9730f91fb351688
DIST rust-1.95.0_beta20260310-powerpc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B d7eff81fb93a56c89312373e3df6c4908a53f3b5242525b6ffa9701bd3ceb5117f276420513f549d981c027bf9bafb1b605919a870407dafadda02ccce933925 SHA512 df6edfefa44975f141a514a1989e21d985f1ebf2bd984ae3c6ac8a04de43666c827b3bea5e4723ce42ce4417dfac0e23437062ddbd0577430efb0032aeffe564
DIST rust-1.95.0_beta20260310-powerpc64-unknown-linux-gnu.tar.xz 254606904 BLAKE2B 123eafd62a9a6f54f0508288f668ed6b4eec84d70be0cdf7588074ea5acecae81706cf0ff596cbc7f5e7bd763142fd8a69f29405d06ead228a95e52ded6d9ecc SHA512 402a668081c9a8cf87e2ce7f8c50b9726315d79fbcb0d3fab98f8f1eaba9dd2b58985e1afd34c4a3d2e426bef4c53d92111f2352520d6a236f58b45d4157892f
DIST rust-1.95.0_beta20260310-powerpc64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 464608ca922dac68431a0657949255d96ff63fd1e7431462a41896535ac5c220fe2c733279bfd02cb71a2ef2c135a57fd648b8f09d5d239672a0b9ed8d44c291 SHA512 4dd2db0d921e0361d8f4c30be36909a89930f319802892f6d3efb23250309b4dc327729687fc376a8714df2890e3fe254e25c603194fb1f56c750325f5a00601
DIST rust-1.95.0_beta20260310-powerpc64le-unknown-linux-gnu.tar.xz 274363936 BLAKE2B b9eea48772873850479f65bc98488e9dd355b2f212c830c30ac5cfedb9e5f666edc768bbff1a88888518743e402c1bce17b514f3ba7423e7561212040f8964d9 SHA512 a26f96fe8be091b616a52d439a5ec47ee7f7c9a80e4e894a83c19fea1179e11491729b716741e790c7638e45da341a5006a132534a3241b2059e15827aadf3c1
DIST rust-1.95.0_beta20260310-powerpc64le-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B fc04ff2f5dff98bef27c4d41070dc9059310e85b4f2f60ecdd2f5de9f8752b86b97701c65d85808caf80346bdf8297b876ff80939064cc11b31db4113d967e20 SHA512 ba3adc944eb7a4006a51c1b3a559a3ad1e46be7a9e3eb8e19f84fb1fcd14d6e0d9954a317e272d3e6727a994d10f0e5ad35492aa5a97b0f0f64071b2fc7da75f
DIST rust-1.95.0_beta20260310-riscv64gc-unknown-linux-gnu.tar.xz 251078536 BLAKE2B a01732d405878ca8d13cfa8f90079af27806da23e92073b14c4d9fdea4b7168f53d0bee93409effc7336cf8b0996c02b52123a0c174c7426c792ecd3323a9e40 SHA512 a2306180fe452eadaad906a7c2633e87fde07ec7aad5260521aec0e73c96f8fc9f48f99272bf978385523fd4c336709ad3b599622889bc8d695d94e8ea665e6c
DIST rust-1.95.0_beta20260310-riscv64gc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B ac7f3ec4f4cb35ee40bf8920f238e97acdd658308bc3f901ca1b0755c16dd57ed550de6a27c9be49b1444e60982fdc047806076a709ea98e62f99913ce381000 SHA512 b809c1724cf4ec79e096717bd7404e135e6ff41d80aa82ab913bf59d1f24070c3753112e45fbeedf711b28b5dd2ac1c8e8e91da21a8aae32ea2786e307f0e3e4
DIST rust-1.95.0_beta20260310-s390x-unknown-linux-gnu.tar.xz 241723584 BLAKE2B c55a4ee44d4a035c5f82b98adbb63ecc67f5d01634627e85a2b5ce2f78d12ffe85049e899eacc980f3172ef815736b2718920e1be019d39f06e964e3503395a1 SHA512 f72049d7900b3ab4d7d7c5ed9f6eb66a060147a045020fda2b7eceab934043200f88137e6813b3e5dd343e8f7787b977e0cae838f7c571d1c5a2c46b682a72f9
DIST rust-1.95.0_beta20260310-s390x-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 974a008ae1c6b1f85c924adc0696cd4052ab839a076e10da228349817dd073701e5e03ff257da75366f22e726080e676a248655de41b3b9e32642c05be808c00 SHA512 06cec9d046cb167aab98fdfaaece6516245a9a2d962c8e883f9052325a06df3f16a95bde23bef4a0ef99d816df2d3d69fd850e2822ae905a5034a6e4fad19f52
DIST rust-1.95.0_beta20260310-x86_64-unknown-linux-gnu.tar.xz 197290900 BLAKE2B a2c16baf1dc0ae54e8a184072eb242bb1d0e3ca1dfef591389c994ede87b10dd1742365006068f475ffb6a957b14622cbd1bdb919ad76fbebfc6fe2eb205d0c8 SHA512 224de0216c51e0f7fcf7de5d7b48849d26685845c4e1bfacc7229c8746142e66790a671b89c6b30092e85121a83a6e6b5774d25ba187bc5fb0fa76916c44e2a3
DIST rust-1.95.0_beta20260310-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 4d297881cff678eecbbef10f5346d3feb1cce0fe41766b25807545103e8ac03f198f348ff0667d0709a8df6220e763d0f866dadad04edf769c16195f04d400d6 SHA512 327c9f8a930fa5b652933b7b328384b9a4a245451a7fd6dbb05a278679a852a63883f461613d124087bb549566b2347dc6e7a6b6eb1ac283a59ffd30d20aff86
DIST rust-1.95.0_beta20260310-x86_64-unknown-linux-musl.tar.xz 299248076 BLAKE2B 6ce87d599dee5e5363a9c470a4ea5d51abcd2edec701fee928e86bb1f684f06e87e4afe45fd4327b085adb3269fd7837de5bf8b2dd79059d9574d8c66037b3df SHA512 8c269ce743e92faf89731bfd1d80b3843c79721f30bd21631564c516b0478d6a4c9f7302c8f2c4b3c56ac13932a3c00a76b6977688b9665c59e0f63cc3e80821
DIST rust-1.95.0_beta20260310-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B be1f0fa731455740452c284ddbf4d29b6a84141db71b18743faf7996471e4416e1db5610fcde65086f24a4161047eb1d87ec7bc78900e0c4f15aa15d244682bf SHA512 a6a0cba4b336c5609f5ac44c44fde345dc4b87f0e37d197b7518447ecde3730d381212ae791bb73af9b8f45335800ff0aebf4a9d8b3319236ce7853df384ccb3
DIST rust-src-1.74.1.tar.xz 2544036 BLAKE2B d95431b69f102782f51878ff73ce8802cac6dab7909497c3231d1c479b95dc2a618cc6efd8bac9c6bd59a2b10dc6be05199f1e1bd74e45cc640ee52352c29268 SHA512 11467d0936193c5a5be8c2eba1aefe2b7028af48494698863de2c4057d68ce33dcee1fc66dc2d68b1d32f0202ce49e9b906727849de8f8d904dd07930e76d5a4
DIST rust-src-1.75.0.tar.xz 2570256 BLAKE2B 9db7ccff07ffe6991233e9f530321fd6ba48c561dcf1226537afa70c7d045421d8e83c5300b0866ec6fccfaae96dd67b9f204e9e0e12108c0c766d467cd78909 SHA512 e7565cea2f1658a05237a698e38880df2544319b41b6d8b0805db5f1f94fd3bb4f986967d0440fcdfe3a135e33246f3c747665b964f57ff5942f56133af78cdd
DIST rust-src-1.76.0.tar.xz 2590884 BLAKE2B d1a6215dab34d7b10c3177d2b248f997d3a846388f3442567572880aa5c5bc51b56398f5d4dc32727cee7c9dbef494430d6534a76b66c4ae5ac4fed07266644d SHA512 39d2fe58fae8c8c5a6cb3fb1ef2a1c7548c018fef6ccea531659fdfecd68a4aa77125299d2cbe5b58e500337b4d074928318fa9ebce358af500d0ef27260e3ca
@@ -846,3 +874,4 @@ DIST rust-src-1.92.0.tar.xz 3530724 BLAKE2B 1385e8cc8062dffa69829e4ffeee7daaaedd
DIST rust-src-1.93.0.tar.xz 3722768 BLAKE2B 9b80cd62e3345cb523fc1596dc1957c03a5edb42e9144fdf1466959ebf347dba3725a1a777e9197dcdbdb7b99ef3cc6d2de9e6359c245db2a919064a2a92f91e SHA512 02535cf5aca3efdc708d959c641994dc3f7f60385afbe3c4aa14037b5b7107ddfe1af0bca6493b97e0144e5d31e45937fe86b026e48bf6231ac7efd404762d83
DIST rust-src-1.93.1.tar.xz 3722488 BLAKE2B 61a63c8eb169917dd9140ddba06fbbf8e05ce54ee7331e6fb906eb705c69615922502da72f3646d35cf2a126b1624f3afe3ca45b611b6c7ebed843a38f8e6a3a SHA512 5d4a5a3dede3b0334c779e9936030cfa46577600ee6d69e92e190d04c26c6020d262a6fd4e9b4516e7325a0e256ad18bc6d659bab0c638aa53dbe76f7d4dfa0f
DIST rust-src-1.94.0.tar.xz 3750144 BLAKE2B d73556a8615f43dd00f61d78df329c2a203e8af2347a82c60d134a039af0a23e8fd01715c255600cb73d78195fa3f3be018c983bbf26f7340c5fb637a7d43128 SHA512 2e9dfe1419eb32e65e6585b2f777aa48c97485f36daf49fe04759821ad5b961923b19c1c0c67fe6f4dbd82cb27748f3f7709bf481ec0ea6bccae7ab878f97712
DIST rust-src-1.95.0_beta20260310.tar.xz 3825516 BLAKE2B 1d608ccbf025d99b4a65604ffdcde223d464373dd04147829f3839b2e65f15741cc499385360d40eb86fead78500f26a51248bf7e39aa9b3a191089a1910c970 SHA512 5a455bc545d15bb1039a2fa7e91ab988fe913dfa5875985e3a70336fe699efeba73024118f1ae57f6f51f17738fbbf3b922f281449d79cc95f74a9c49d95a422

View File

@@ -0,0 +1,337 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LLVM_COMPAT=( 21 )
LLVM_OPTIONAL="yes"
inherit edo llvm-r1 multilib prefix rust-toolchain verify-sig multilib-minimal optfeature
if [[ ${PV} == *9999* ]]; then
# We need to fetch a tarball in src_unpack
PROPERTIES+=" live"
elif [[ ${PV} == *beta* ]]; then
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep "xz_url.*rust-src"
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
RUST_TOOLCHAIN_BASEURL=https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/
SRC_URI="$(rust_all_arch_uris rust-beta rust-${PV})
rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/rust-src-beta.tar.xz -> rust-src-${PV}.tar.xz )
"
else
# curl -Ls static.rust-lang.org/dist/channel-rust-${PV}.toml | grep "xz_url.*rust-src"
SRC_URI="$(rust_all_arch_uris "rust-${PV}")
rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2026-03-05/rust-src-${PV}.tar.xz )
"
KEYWORDS=""~mips # ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86""
fi
GENTOO_BIN_BASEURI="https://github.com/projg2/rust-bootstrap/releases/download/${PVR}" # omit trailing slash
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
if false; then
# Keep this separate to allow easy commenting out if not yet built
SRC_URI+=" sparc? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-sparc64-unknown-linux-gnu.tar.xz ) "
SRC_URI+=" mips? (
abi_mips_o32? (
big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-mips-unknown-linux-gnu.tar.xz )
!big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-mipsel-unknown-linux-gnu.tar.xz )
)
abi_mips_n64? (
big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-mips64-unknown-linux-gnuabi64.tar.xz )
!big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-mips64el-unknown-linux-gnuabi64.tar.xz )
)
)"
SRC_URI+=" riscv? (
elibc_musl? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-riscv64gc-unknown-linux-musl.tar.xz )
)"
SRC_URI+=" ppc64? ( elibc_musl? (
big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-powerpc64-unknown-linux-musl.tar.xz )
!big-endian? ( ${GENTOO_BIN_BASEURI}/rust-${PVR}-powerpc64le-unknown-linux-musl.tar.xz )
) )"
fi
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 +doc prefix rust-analyzer rust-src +rustfmt"
# net-misc/curl is needed for our own bootstrapped rustc, since cross-compiling bundled curl is not supported
RDEPEND="
>=app-eselect/eselect-rust-20190311
dev-libs/openssl
net-misc/curl
sys-apps/lsb-release
|| (
llvm-runtimes/libgcc
sys-devel/gcc:*
)
!dev-lang/rust:stable
!dev-lang/rust-bin:stable
"
BDEPEND="
prefix? ( dev-util/patchelf )
verify-sig? ( sec-keys/openpgp-keys-rust )
"
[[ ${PV} == *9999* ]] && BDEPEND+=" net-misc/curl"
REQUIRED_USE="x86? ( cpu_flags_x86_sse2 )"
# stripping rust may break it (at least on x86_64)
# https://github.com/rust-lang/rust/issues/112286
RESTRICT="strip"
QA_PREBUILT="
opt/rust-bin-${SLOT}/bin/.*
opt/rust-bin-${SLOT}/lib/.*.so*
opt/rust-bin-${SLOT}/libexec/.*
opt/rust-bin-${SLOT}/lib/rustlib/.*/bin/.*
opt/rust-bin-${SLOT}/lib/rustlib/.*/lib/.*
"
# 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="opt/${PN}-${SLOT}/lib/rustlib/*/lib*.rlib:lib.rmeta"
VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/rust.asc"
src_unpack() {
if [[ ${PV} == *9999* ]]; then
# We need to fetch the latest nightly listing and get the apprapriate src_uri for our arch
local rust_bin_url rustc_src_url
# Cut down on webrequests by fetching the nightly toml once
curl -Ls static.rust-lang.org/dist/channel-rust-nightly.toml > "${WORKDIR}/channel-rust-nightly.toml" ||
die "Failed to fetch nightly revision info"
rustc_src_url=$(grep 'xz_url.*rust-src' "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2)
if use rust-src; then
einfo "Using nightly Rust-src from: ${rustc_src_url}"
# We need to fetch the rust-src tarball
einfo "Fetching nightly rust-src tarball ..."
curl --progress-bar -L "${rustc_src_url}" -o "${WORKDIR}/rust-src-${PV}.tar.xz" ||
die "Failed to fetch nightly rust-src tarball."
# no verify-sig here, just unpack it
tar -xf "${WORKDIR}/rust-src-${PV}.tar.xz" || die "Failed to unpack nightly rust-src tarball"
fi
local v
for v in $(multilib_get_enabled_abi_pairs); do
rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))"
rust_bin_url=$(grep "xz_url.*rust-nightly-${rust_target}" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2)
einfo "Using nightly Rust from ${rust_bin_url} for ${rust_target}"
einfo "Fetching nightly Rust tarball for ${rust_target} ..."
curl --progress-bar -L "${rust_bin_url}" -O || die "Failed to fetch nightly tarball for ${rust_target}"
if use verify-sig; then
einfo "Fetching nightly signature for ${rust_target} ..."
curl --progress-bar -L "${rust_bin_url}.asc" -O || die "Failed to fetch nightly signature for ${rust_target}"
verify-sig_verify_detached "${WORKDIR}/rust-nightly-${rust_target}.tar.xz" \
"${WORKDIR}/rust-nightly-${rust_target}.tar.xz.asc"
fi
tar -xf "${WORKDIR}/rust-nightly-${rust_target}.tar.xz" || die "Failed to unpack nightly tarball for ${rust_target}"
done
else
# sadly rust-src tarball does not have corresponding .asc file
# so do partial verification
if use verify-sig; then
for f in ${A}; do
if [[ -f ${DISTDIR}/${f}.asc ]]; then
verify-sig_verify_detached "${DISTDIR}/${f}" "${DISTDIR}/${f}.asc"
fi
done
fi
default_src_unpack
fi
# We only want to do this for the native ABI. Non-native ABIs are
# handled differently in multilib_src_install.
case ${PV} in
*9999*)
mv "${WORKDIR}/rust-nightly-$(rust_abi)" "${S}" || die
;;
*beta*)
mv "${WORKDIR}/rust-beta-$(rust_abi)" "${S}" || die
;;
*)
mv "${WORKDIR}/rust-${PV}-$(rust_abi)" "${S}" || die
;;
esac
}
patchelf_for_bin() {
local filetype=$(file -b ${1})
if [[ ${filetype} == *ELF*interpreter* ]]; then
einfo "${1}'s interpreter changed"
patchelf ${1} --set-interpreter ${2} || die
elif [[ ${filetype} == *script* ]]; then
hprefixify ${1}
fi
}
rust_native_abi_install() {
pushd "${S}" >/dev/null || die
local std="$(grep 'std' ./components || die "std not found in components")"
local components=( "rustc" "cargo" "${std}" )
use doc && components+=( "rust-docs" )
use clippy && components+=( "clippy-preview" )
use rustfmt && components+=( "rustfmt-preview" )
if use rust-analyzer; then
local analysis="$(grep 'analysis' ./components || die "analysis not found in components")"
components+=( "rust-analyzer-preview" "${analysis}" )
fi
# Rust component 'rust-src' is extracted from separate archive
if use rust-src; then
einfo "Combining rust and rust-src installers"
case ${PV} in
*9999*)
mv -v "${WORKDIR}/rust-src-nightly/rust-src" "${S}" || die
;;
*beta*)
mv -v "${WORKDIR}/rust-src-beta/rust-src" "${S}" || die
;;
*)
mv -v "${WORKDIR}/rust-src-${PV}/rust-src" "${S}" || die
;;
esac
echo rust-src >> ./components || die
components+=( "rust-src" )
fi
edo ./install.sh \
--components="$(IFS=,; echo "${components[*]}")" \
--disable-verify \
--prefix="${ED}/opt/rust-bin-${SLOT}" \
--mandir="${ED}/opt/rust-bin-${SLOT}/man" \
--disable-ldconfig
docompress /opt/${P}/man/
if use prefix; then
local interpreter=$(patchelf --print-interpreter "${EPREFIX}"/bin/bash)
ebegin "Changing interpreter to ${interpreter} for Gentoo prefix at ${ED}/opt/rust-bin-${SLOT}/bin"
find "${ED}/opt/rust-bin-${SLOT}/bin" -type f -print0 | \
while IFS= read -r -d '' filename; do
patchelf_for_bin ${filename} ${interpreter} \; || die
done
eend $?
fi
local symlinks=(
cargo
rustc
rustdoc
rust-gdb
rust-gdbgui
rust-lldb
)
use clippy && symlinks+=( clippy-driver cargo-clippy )
use rustfmt && symlinks+=( rustfmt cargo-fmt )
use rust-analyzer && symlinks+=( rust-analyzer )
einfo "installing eselect-rust symlinks and paths"
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 /opt/rust-bin-<ver>/bin/rustc-<ver>
local ver_i="${i}-bin-${SLOT}"
ln -v "${ED}/opt/rust-bin-${SLOT}/bin/${i}" "${ED}/opt/rust-bin-${SLOT}/bin/${ver_i}" || die
dosym -r "/opt/rust-bin-${SLOT}/bin/${ver_i}" "/usr/bin/${ver_i}"
done
# symlinks to switch components to active rust in eselect
dosym -r "/opt/rust-bin-${SLOT}/lib" "/usr/lib/rust/lib-bin-${SLOT}"
dosym -r "/opt/rust-bin-${SLOT}/man" "/usr/lib/rust/man-bin-${SLOT}"
dosym -r "/opt/rust-bin-${SLOT}/lib/rustlib" "/usr/lib/rustlib-bin-${SLOT}"
dosym -r "/opt/rust-bin-${SLOT}/share/doc/rust" "/usr/share/doc/rust-bin-${SLOT}"
# make all capital underscored variable
local CARGO_TRIPLET="$(rust_abi)"
CARGO_TRIPLET="${CARGO_TRIPLET//-/_}"
CARGO_TRIPLET="${CARGO_TRIPLET^^}"
cat <<-_EOF_ > "${T}/50${P}"
MANPATH="${EPREFIX}/usr/lib/rust/man-bin-${SLOT}"
$(usev elibc_musl "CARGO_TARGET_${CARGO_TRIPLET}_RUSTFLAGS=\"-C target-feature=-crt-static\"")
_EOF_
doenvd "${T}/50${P}"
# 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-${PN}-${SLOT}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${PN}-${SLOT}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${PN}-${SLOT}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${PN}-${SLOT}"
fi
if use rust-analyzer; then
echo /usr/bin/rust-analyzer >> "${T}/provider-${PN}-${SLOT}"
fi
insinto /etc/env.d/rust
doins "${T}/provider-${PN}-${SLOT}"
popd >/dev/null || die
}
multilib_src_install() {
if multilib_is_native_abi; then
rust_native_abi_install
else
local rust_target version
case ${PV} in
*9999*)
version=nightly
;;
*beta*)
version=beta
;;
*)
version=${PV}
;;
esac
rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))"
dodir "/opt/${P}/lib/rustlib"
cp -vr "${WORKDIR}/rust-${version}-${rust_target}/rust-std-${rust_target}/lib/rustlib/${rust_target}"\
"${ED}/opt/${P}/lib/rustlib" || die
fi
# BUG: installs x86_64 binary on other arches
rm -f "${ED}/opt/${P}/lib/rustlib/"*/bin/rust-llvm-dwp || die
}
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

@@ -28,3 +28,5 @@ DIST rustc-1.93.1-src.tar.xz 270888296 BLAKE2B fe5a9072161cf758221974f1f59b1a198
DIST rustc-1.93.1-src.tar.xz.asc 801 BLAKE2B 9e059c894770a402d5fee2a29ffdb42030d8d723a40d6312d983e53cd4fa64e97019a0ea6054dcb17ba2ead7f27db17eec2632950f13e4ef1410324afc4dcaf8 SHA512 8a290300e370b3833d2d365a451ed4708dbe1fa69fc57b73eef0b2b5d9dd4fb3d87344315aee3aea474d4071cfb535234e167f6576abf2e06ef3225c85e3c30d
DIST rustc-1.94.0-src.tar.xz 273916448 BLAKE2B cab2e007c1a5401c653218ff0dd542d10c0d7a4fcc7bf2ee269cbbb9760bdd04c78276beddc2f6b1f4d47df96a11079087f109e248951c2a157be73ca2c3e8db SHA512 8397fa68055827363bff5a1dd228a05e4c4ca5a179d072ecc1b330a874c183529cb9346ec9c531fb3f066b7b6094fc8711d7c341a49755af7b50d63bf0ecff2b
DIST rustc-1.94.0-src.tar.xz.asc 801 BLAKE2B d6ce44d51e59ecd22b953b391134ba470ec4ee1089031c34f7809199bd4eda3f54c5907a92f362cf5c0151d75b14360cd44d5a2556f785cbc1c3de5a0335573b SHA512 0a5b067e0e137489f49c7e445992f7a456e884d39158e4d9b5b59af41c62e5dbfe8abeaa02af33ca072b663dbc649004bc83ff18899bf1bfaed0eb90aac5f67f
DIST rustc-1.95.0_beta20260310-src.tar.xz 238950800 BLAKE2B b2d5cf01102ffa96f0b41ee7f4e20f003d3a006da99ef1d697a21e952edbbda8820309d97cb9b3adc0b867951a03422d458f9b32aecba40b2fad4a76c9e95a7f SHA512 9749191b022554cd537b9f4337d378f566cdde4c8501daf98de78669919933bd3ffd1dd43b2530ea05740f2686d46d02fef79e08a00909635d63b993ffadd0fb
DIST rustc-1.95.0_beta20260310-src.tar.xz.asc 801 BLAKE2B dc7c8613c749e9131c0caba62b30a8239cea8656058f03f0f8722017e733f703e8d76e7b6a37beee985968cdcc06bf2732bb4ce8471b735117c1b9b9d2069248 SHA512 ff83f761cc171e9789b460e9bb38c5db1ac063538a36dd550c02c4ea4027f50d67da073ee4021f248f799e72f72c3684926e4dc1246bb75b4cfb5dbef1548eb8

View File

@@ -0,0 +1,73 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
inherit shell-completion verify-sig
DESCRIPTION="Common files shared between multiple slots of Rust"
HOMEPAGE="https://www.rust-lang.org/"
if [[ ${PV} = *9999* ]]; then
inherit git-r3
# In case cargo is not in sync we'll fetch it as a submodule
# Nightly users will probably already have the repo cloned and up-to-date anyway.
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=( "-*" "src/tools/cargo" )
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
MY_PV=beta
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/rustc-${MY_PV}-src"
else
MY_PV=${PV}
SRC_URI="https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz
verify-sig? ( https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz.asc )
"
S="${WORKDIR}/rustc-${MY_PV}-src"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
SLOT="0"
# Legacy non-slotted versions bash completions will collide.
RDEPEND="
!dev-lang/rust:stable
!dev-lang/rust-bin:stable
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-rust )"
src_unpack() {
if [[ ${PV} == *9999* ]]; then
git-r3_src_unpack
else
if use verify-sig ; then
verify-sig_verify_detached "${DISTDIR}"/rustc-${PV}-src.tar.xz "${DISTDIR}"/rustc-${PV}-src.tar.xz.asc
fi
# Avoid unpacking the whole tarball which would need check-reqs
tar -xf "${DISTDIR}"/rustc-${PV}-src.tar.xz \
"rustc-${MY_PV}-src/src/tools/cargo/src/etc/"{_cargo,cargo.bashcomp.sh} || die
fi
}
src_configure() {
:
}
src_compile() {
:
}
src_install() {
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
dozshcomp src/tools/cargo/src/etc/_cargo
}

View File

@@ -22,6 +22,7 @@ DIST rust-patches-1.92.0_p1.tar.bz2 5993 BLAKE2B aa3183a46834b9442fd79fcda61a308
DIST rust-patches-1.93.0.tar.bz2 3175 BLAKE2B 4849208072cf0a047a9fe2ee27d384349b713149b7d087a6ff39a41ec1a7b77884710374dcac44c4378b320da0b4061fa531edd8b2b1cc04199fd51cdb1c2e78 SHA512 b818e14653a66447a221f84363cad54ee893842025c2b6c02c08df76bdf8666664564a5bc405ee988223048c2b986ea818d685babfddee5ff7559f9567bb9dbb
DIST rust-patches-1.93.1.tar.bz2 3186 BLAKE2B 6ff137eb2c1b43857922ac3d9b0cc3dbe71180c05d318c5b0f54c371117426ad8daa8ec19cffc19c2550564ac4b7cfd38f4c0fa42a5b8d2ae94fe668a94aa567 SHA512 ded2af5cc9516d8bbce675f323747a96fea814f2344065a45ca7968a21e31aaa5e0bf0a45f6f831a9d62047e782306d5319c6c3ed887e3ceb75011d1849a5303
DIST rust-patches-1.94.0.tar.bz2 3165 BLAKE2B 07187fcc95458cf3323490a54d648209ae24c9c44522f5c0bf2b12ac469e86dd1145d70557c7c09a097019b262f557af162fc3687bfda10451e2e164a0f4ec78 SHA512 39f9288335c62b477465c44904e922f1ce8b62c840a9b6ce2d13dee670f6935cfbccc88faf314d5e766103ada969513badee251b6485e8abaeadca7b65cf9e23
DIST rust-patches-1.95.0_beta20260310.tar.bz2 2977 BLAKE2B 1f864917aac82110cb283fe87351de83822f62e4b27fd45f0b619d652eda4e04a64d2828446d8b7a1cfc1c62e366fccf0a8e2a21c6eb9294d65c3dac875393d5 SHA512 99a7eb784f51f74da34de4cf4d712054fd469ac928e1f316ec33a30f0ff1f77642d926cc769bd221d14f16a42f675721e559f9b012f1b65343f014e1b8df7dd6
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
@@ -70,3 +71,5 @@ DIST rustc-1.93.1-src.tar.xz 270888296 BLAKE2B fe5a9072161cf758221974f1f59b1a198
DIST rustc-1.93.1-src.tar.xz.asc 801 BLAKE2B 9e059c894770a402d5fee2a29ffdb42030d8d723a40d6312d983e53cd4fa64e97019a0ea6054dcb17ba2ead7f27db17eec2632950f13e4ef1410324afc4dcaf8 SHA512 8a290300e370b3833d2d365a451ed4708dbe1fa69fc57b73eef0b2b5d9dd4fb3d87344315aee3aea474d4071cfb535234e167f6576abf2e06ef3225c85e3c30d
DIST rustc-1.94.0-src.tar.xz 273916448 BLAKE2B cab2e007c1a5401c653218ff0dd542d10c0d7a4fcc7bf2ee269cbbb9760bdd04c78276beddc2f6b1f4d47df96a11079087f109e248951c2a157be73ca2c3e8db SHA512 8397fa68055827363bff5a1dd228a05e4c4ca5a179d072ecc1b330a874c183529cb9346ec9c531fb3f066b7b6094fc8711d7c341a49755af7b50d63bf0ecff2b
DIST rustc-1.94.0-src.tar.xz.asc 801 BLAKE2B d6ce44d51e59ecd22b953b391134ba470ec4ee1089031c34f7809199bd4eda3f54c5907a92f362cf5c0151d75b14360cd44d5a2556f785cbc1c3de5a0335573b SHA512 0a5b067e0e137489f49c7e445992f7a456e884d39158e4d9b5b59af41c62e5dbfe8abeaa02af33ca072b663dbc649004bc83ff18899bf1bfaed0eb90aac5f67f
DIST rustc-1.95.0_beta20260310-src.tar.xz 238950800 BLAKE2B b2d5cf01102ffa96f0b41ee7f4e20f003d3a006da99ef1d697a21e952edbbda8820309d97cb9b3adc0b867951a03422d458f9b32aecba40b2fad4a76c9e95a7f SHA512 9749191b022554cd537b9f4337d378f566cdde4c8501daf98de78669919933bd3ffd1dd43b2530ea05740f2686d46d02fef79e08a00909635d63b993ffadd0fb
DIST rustc-1.95.0_beta20260310-src.tar.xz.asc 801 BLAKE2B dc7c8613c749e9131c0caba62b30a8239cea8656058f03f0f8722017e733f703e8d76e7b6a37beee985968cdcc06bf2732bb4ce8471b735117c1b9b9d2069248 SHA512 ff83f761cc171e9789b460e9bb38c5db1ac063538a36dd550c02c4ea4027f50d67da073ee4021f248f799e72f72c3684926e4dc1246bb75b4cfb5dbef1548eb8

View File

@@ -0,0 +1,890 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Bump notes: https://wiki.gentoo.org/wiki/Project:Rust/Rust_bump
LLVM_COMPAT=( 21 )
PYTHON_COMPAT=( python3_{11..14} )
# Patches are kept in rust-patches.git, see its README.rst for the versioning
# scheme.
#
# We use _pN from the ebuild version for the patchset but it can be overridden
# in the ebuild for changes that don't require a revbump.
#
# Uncomment this line when the ebuild needs a patchset update but no revbump.
#RUST_PATCH_VER=${PV}-1
RUST_MAX_VER=${PV%%_*}
RUST_PV=${PV%%_p*}
RUST_P=${PN}-${RUST_PV}
[[ -z ${RUST_PATCH_VER} ]] && RUST_PATCH_VER=${PV}
if [[ ${PV} == *9999* ]]; then
# Update this as new `beta` releases come out.
RUST_MIN_VER="1.93.0"
elif [[ ${PV} == *beta* ]]; then
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
inherit multilib multilib-build python-any-r1 rust rust-toolchain toolchain-funcs
inherit 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-${RUST_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-${RUST_PV}-src.tar.xz.asc
)
"
S="${WORKDIR}/${MY_P}-src"
else
MY_P="rustc-${RUST_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 )
ALL_LLVM_TARGETS+=( LoongArch M68k Mips MSP430 NVPTX PowerPC RISCV Sparc SPIRV )
ALL_LLVM_TARGETS+=( 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.87.0/llvm/CMakeLists.txt
_ALL_RUST_EXPERIMENTAL_TARGETS=( ARC CSKY DirectX M68k Xtensa )
declare -A ALL_RUST_EXPERIMENTAL_TARGETS
for _x in "${_ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
ALL_RUST_EXPERIMENTAL_TARGETS["llvm_targets_${_x}"]=0
done
# Bare metal targets which can be built on the host system and have no
# dependency on compiler runtime, libc and unwinder.
ALL_RUST_SYSROOTS=( bpf wasm )
ALL_RUST_SYSROOTS=( "${ALL_RUST_SYSROOTS[@]/#/rust_sysroots_}" )
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"
IUSE+=" +rustfmt rust-analyzer rust-src +system-llvm test"
IUSE+=" ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}"
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+=( " rust_sysroots_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
)
) )
rust_sysroots_wasm? ( llvm-core/clang )
!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]
virtual/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[*]} )
rust_sysroots_bpf? ( llvm_targets_BPF )
rust_sysroots_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 rust_sysroots_bpf 256 0) + ${M} ))
M=$(( $(usex rust_sysroots_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-${RUST_PV}-src.tar.xz{,.asc}
default
else
default
fi
}
src_prepare() {
# Commit patches to the appropriate branch in proj/rust-patches.git
# then cut a new tag / tarball. Don't add patches to ${FILESDIR}
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 rust_sysroots_bpf; then
rust_targets+=",\"bpfeb-unknown-none\",\"bpfel-unknown-none\""
fi
if use rust_sysroots_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
# TODO: Add optimized-compiler-builtins for system-llvm to avoid
# building bundled compiler-rt.
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"
description = "gentoo"
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}"
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 rust_sysroots_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 rust_sysroots_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 rust_sysroots_wasm; then
wasm_target="wasm32-unknown-unknown"
if tc-is-clang; then
local wasm_cc=$(tc-getCC)
local wasm_cxx=$(tc-getCXX)
else
local wasm_cc=${CHOST}-clang
local wasm_cxx=${CHOST}-clang++
fi
export CFLAGS_${wasm_target//-/_}="$(
CC="${wasm_cc} --target=wasm32-unknown-unknown"
filter-flags '-mcpu*' '-march*' '-mtune*'
strip-unsupported-flags
echo "${CFLAGS}"
)"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
cc = "${wasm_cc}"
cxx = "${wasm_cxx}"
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
if [[ "${cross_rust_target}" == *-uefi ]]; then
# Profiler is not supported on bare-metal
cat <<- _EOF_ >> "${S}"/bootstrap.toml
profiler = false
_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/
# bash-completion files are installed by dev-lang/rust-common instead
# 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}-${RUST_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/${RUST_P}"
newenvd - "50${RUST_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-${RUST_P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${RUST_P}"
fi
if [[ ${SLOT} == *9999* ]] && use miri; then
echo /usr/bin/miri >> "${T}/provider-${RUST_P}"
echo /usr/bin/cargo-miri >> "${T}/provider-${RUST_P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${RUST_P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${RUST_P}"
fi
if use rust-analyzer; then
echo /usr/lib/rust/libexec >> "${T}/provider-${RUST_P}"
echo /usr/bin/rust-analyzer >> "${T}/provider-${RUST_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}-${RUST_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

@@ -68,6 +68,7 @@ fi
# Definitive list of Rust slots and the associated LLVM slot, newest first.
declare -A -g -r _RUST_LLVM_MAP=(
["9999"]=22
["1.95.0"]=22
["1.94.0"]=21
["1.93.1"]=21
["1.93.0"]=21
@@ -102,6 +103,7 @@ declare -A -g -r _RUST_LLVM_MAP=(
# this array is used to store the Rust slots in a more convenient order for iteration.
declare -a -g -r _RUST_SLOTS_ORDERED=(
"9999"
"1.95.0"
"1.94.0"
"1.93.1"
"1.93.0"

View File

@@ -28,3 +28,5 @@ DIST rustc-1.93.1-src.tar.xz 270888296 BLAKE2B fe5a9072161cf758221974f1f59b1a198
DIST rustc-1.93.1-src.tar.xz.asc 801 BLAKE2B 9e059c894770a402d5fee2a29ffdb42030d8d723a40d6312d983e53cd4fa64e97019a0ea6054dcb17ba2ead7f27db17eec2632950f13e4ef1410324afc4dcaf8 SHA512 8a290300e370b3833d2d365a451ed4708dbe1fa69fc57b73eef0b2b5d9dd4fb3d87344315aee3aea474d4071cfb535234e167f6576abf2e06ef3225c85e3c30d
DIST rustc-1.94.0-src.tar.xz 273916448 BLAKE2B cab2e007c1a5401c653218ff0dd542d10c0d7a4fcc7bf2ee269cbbb9760bdd04c78276beddc2f6b1f4d47df96a11079087f109e248951c2a157be73ca2c3e8db SHA512 8397fa68055827363bff5a1dd228a05e4c4ca5a179d072ecc1b330a874c183529cb9346ec9c531fb3f066b7b6094fc8711d7c341a49755af7b50d63bf0ecff2b
DIST rustc-1.94.0-src.tar.xz.asc 801 BLAKE2B d6ce44d51e59ecd22b953b391134ba470ec4ee1089031c34f7809199bd4eda3f54c5907a92f362cf5c0151d75b14360cd44d5a2556f785cbc1c3de5a0335573b SHA512 0a5b067e0e137489f49c7e445992f7a456e884d39158e4d9b5b59af41c62e5dbfe8abeaa02af33ca072b663dbc649004bc83ff18899bf1bfaed0eb90aac5f67f
DIST rustc-1.95.0_beta20260310-src.tar.xz 238950800 BLAKE2B b2d5cf01102ffa96f0b41ee7f4e20f003d3a006da99ef1d697a21e952edbbda8820309d97cb9b3adc0b867951a03422d458f9b32aecba40b2fad4a76c9e95a7f SHA512 9749191b022554cd537b9f4337d378f566cdde4c8501daf98de78669919933bd3ffd1dd43b2530ea05740f2686d46d02fef79e08a00909635d63b993ffadd0fb
DIST rustc-1.95.0_beta20260310-src.tar.xz.asc 801 BLAKE2B dc7c8613c749e9131c0caba62b30a8239cea8656058f03f0f8722017e733f703e8d76e7b6a37beee985968cdcc06bf2732bb4ce8471b735117c1b9b9d2069248 SHA512 ff83f761cc171e9789b460e9bb38c5db1ac063538a36dd550c02c4ea4027f50d67da073ee4021f248f799e72f72c3684926e4dc1246bb75b4cfb5dbef1548eb8

View File

@@ -0,0 +1,180 @@
# Copyright 2020-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..13} )
inherit edo flag-o-matic multiprocessing python-any-r1 rust-toolchain toolchain-funcs verify-sig
DESCRIPTION="Rust standard library, standalone (for crossdev)"
HOMEPAGE="https://www.rust-lang.org"
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_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
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
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
fi
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4"
SLOT="stable/$(ver_cut 1-2)"
# please do not keyword
#KEYWORDS="" #nowarn
IUSE="debug"
BDEPEND="
${PYTHON_DEPS}
~dev-lang/rust-${PV}:=
verify-sig? ( sec-keys/openpgp-keys-rust )
"
DEPEND="||
(
>="${CATEGORY}"/gcc-4.7:*
>="${CATEGORY/sys-devel/llvm-core}"/clang-3.5:*
)
"
RDEPEND="${DEPEND}"
# need full compiler to run tests
RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
QA_FLAGS_IGNORED="usr/lib/rust/${PV}/rustlib/.*/lib/lib.*.so"
#
# The cross magic
#
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
if [[ ${CATEGORY} == cross-* ]] ; then
export CTARGET=${CATEGORY#cross-}
fi
fi
is_cross() {
[[ ${CHOST} != ${CTARGET} ]]
}
toml_usex() {
usex "$1" true false
}
pkg_pretend() {
is_cross || die "${PN} should only be used for cross"
}
pkg_setup() {
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
# do the great cleanup
strip-flags
filter-flags '-mcpu=*' '-march=*' '-mtune=*' '-m32' '-m64'
strip-unsupported-flags
local rust_root x
rust_root="$(rustc --print sysroot)"
rtarget="$(rust_abi ${CTARGET})"
rtarget="${ERUST_STD_RTARGET:-${rtarget}}" # some targets need to be custom.
rbuild="$(rust_abi ${CBUILD})"
rhost="$(rust_abi ${CHOST})"
echo
for x in CATEGORY rust_root rbuild rhost rtarget RUSTFLAGS CFLAGS CXXFLAGS LDFLAGS; do
einfo "$(printf '%10s' ${x^^}:) ${!x}"
done
cat <<- EOF > "${S}"/bootstrap.toml
[build]
build = "${rbuild}"
host = ["${rhost}"]
target = ["${rtarget}"]
cargo = "${rust_root}/bin/cargo"
rustc = "${rust_root}/bin/rustc"
submodules = false
local-rebuild = true
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = true
verbose = 2
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)
debuginfo-level-rustc = 0
backtrace = true
incremental = false
default-linker = "$(tc-getCC)"
rpath = false
dist-src = false
remap-debuginfo = true
jemalloc = false
[dist]
src-tarball = false
[target.${rtarget}]
ar = "$(tc-getAR ${CTARGET})"
cc = "$(tc-getCC ${CTARGET})"
cxx = "$(tc-getCXX ${CTARGET})"
linker = "$(tc-getCC ${CTARGET})"
ranlib = "$(tc-getRANLIB ${CTARGET})"
$(usev elibc_musl 'crt-static = false')
EOF
einfo "${PN^} configured with the following settings:"
cat "${S}"/bootstrap.toml || die
}
src_compile() {
edo env RUST_BACKTRACE=1 \
"${EPYTHON}" ./x.py build -vv --config="${S}"/bootstrap.toml -j$(makeopts_jobs) \
library/std --stage 0
}
src_test() {
ewarn "${PN} can't run tests"
}
src_install() {
local rustlib="lib/rust/${PV}/lib/rustlib"
dodir "/usr/${rustlib}"
pushd "build/${rhost}/stage0-sysroot/lib/rustlib" > /dev/null || die
cp -pPRv "${rtarget}" "${ED}/usr/${rustlib}" || die
popd > /dev/null || die
}