diff options
Diffstat (limited to 'dev-lang')
| -rw-r--r-- | dev-lang/rust-bin/Manifest | 29 | ||||
| -rw-r--r-- | dev-lang/rust-bin/rust-bin-1.91.0_beta20251009.ebuild | 320 | ||||
| -rw-r--r-- | dev-lang/rust-common/Manifest | 2 | ||||
| -rw-r--r-- | dev-lang/rust-common/rust-common-1.91.0_beta20251009.ebuild | 73 | ||||
| -rw-r--r-- | dev-lang/rust/Manifest | 3 | ||||
| -rw-r--r-- | dev-lang/rust/rust-1.91.0_beta20251009.ebuild | 837 |
6 files changed, 1264 insertions, 0 deletions
diff --git a/dev-lang/rust-bin/Manifest b/dev-lang/rust-bin/Manifest index 275899b19197..d51e61e9959d 100644 --- a/dev-lang/rust-bin/Manifest +++ b/dev-lang/rust-bin/Manifest @@ -692,6 +692,34 @@ DIST rust-1.91.0_beta20250928-x86_64-unknown-linux-gnu.tar.xz 207672796 BLAKE2B DIST rust-1.91.0_beta20250928-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 0cca15af7dd687338b4bf1c3466d3361516a9a3a75d0101a4b2668f3b9b3b7ab495138c6b93160f10f1362d4ef8392c05d0a32c793f817686abc6db9f3de07ed SHA512 7bfca67933a63fc2802c9b000a4d986d0b87d3f075fc5fa7ab71f3cc9994e0d8625c8d88c95c8a7ed328c4cdfb9fb959955d4988c097163e7abb336b4ce3d6c6 DIST rust-1.91.0_beta20250928-x86_64-unknown-linux-musl.tar.xz 303415480 BLAKE2B a8bad917244cf6641d5ede5e41cefc262e7edb8cf6cb2498c63d2af1b93b08286c86cc0e39928c9061d6ae21e344d91a2f569f61a7464981929883f2ac21ee17 SHA512 676ad4f6ed23dc5152a0d19f522d36d65d70d6d43adf5ef6a622f77f69c2fd6074988a3b58405eafc06d6004eb56cf49638a23ac10db53adc18fd20ea3f3c3e0 DIST rust-1.91.0_beta20250928-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B b54b7007ae859d6a096c9bb927d4cfef976874a426b74ece4f147a6914484fd21beb30cef71736ca38260d0d551cd00a45e936cce27fddf191b958770ac91f31 SHA512 3c796d3e4e0c13fafca3693e9a0c6ab3dc76fcb464b6157147ef5af05152c9d8620d89be5ca7a0a2815d74633fd40ff496ef602b4deb0d38d85bd07d8a497207 +DIST rust-1.91.0_beta20251009-aarch64-unknown-linux-gnu.tar.xz 169413468 BLAKE2B 5f15fb75cc40be2389da96f77c78d59f61ec966c5b5747b4363bb638661d88f8944e6adc42f64e42a1f56f9022a32fbdeb446bf6fcc92bd455c72c256ba9ce5f SHA512 cb96e3760da1138e67d11023d0bd45c3d8e9f6fcf6097244e0e3dffe8ffc606dc907000799db590c4686a62341a71ae5f144602e558378d1cd7db18b0ab5a85b +DIST rust-1.91.0_beta20251009-aarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 467955d95c435bdf02c38a087431abcf3fd2a7ae53d452f7f8f47c0a62206fbdf60ad6ebb674d4a33ccc82dca179ef0156ad66fe6e7229df0ad0b742105f2a49 SHA512 fff55a39cc3c9a0d3e8f59004163d27ea74d4a80ebc2f26851c73ad2bc67f97153258be79a5b7e613d1aecca8064de9c58ab56dbb29372d327af48c162f39fb3 +DIST rust-1.91.0_beta20251009-aarch64-unknown-linux-musl.tar.xz 244357468 BLAKE2B 5218537948b4ab12005382058ff2d506190bec936a08db7ae74ca7aa525cbbff863dc468ab13037b6839abb82306593825a4aad0517fa5302a36adfdfe04aa1e SHA512 54fbefb26bfaf891b1181abde38f350b48b19b984467e9cdbc4096451b51145953675fdda1fff0749498dddd19583cb1525f38148707d02d6daccb2af4433244 +DIST rust-1.91.0_beta20251009-aarch64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B cb68322a4c9a7a61c86c4086eec75f6835b7e35083cb9f4cac021d8a0508fd3fd00ac8c6e854f828fc138826752b9e321a368d83d22ea487cc3e266da1493198 SHA512 b56cc826a981ac07484df73fda4b9f24cff3105fd23442be488a41c933505a432ba967d6b7dd9a086eaace93039fe2fbd0b4273acb333290c4224e81f35cd413 +DIST rust-1.91.0_beta20251009-arm-unknown-linux-gnueabi.tar.xz 224676888 BLAKE2B 81a0c429b3891bb8e3729be3e4a33faefdd29cc187e9a197f2be78341085093cea56ddf8a1ff5ead12dc3786b597ccfad8629506bae36e94a4bb501a76d16b72 SHA512 6dbd3fe4b33f66933e6ccd968acacd7849ebf93076e1a05d157055ad537c329849799a8690a05e533b56e00f5a3638cf8fc40bc94db79f8fa9067e920c612be3 +DIST rust-1.91.0_beta20251009-arm-unknown-linux-gnueabi.tar.xz.asc 801 BLAKE2B cabc21e352ece556b2465364d0910950ba7fb84962d22bc4734b0218bb14a117684daa7739e77d62c1127fec6da2078a77ffc96b6307a4baac0cf40bc1814266 SHA512 5e0371b1d52118a9b43c4cee18e699d816efc857da51956bcdcfce119393a9668b75edc7368119b59060fa9cd82c114d7a221de2f4f9de57936bdac08191bad1 +DIST rust-1.91.0_beta20251009-arm-unknown-linux-gnueabihf.tar.xz 225164724 BLAKE2B 5926180bbed8d888816714922cae7fe7b51e09860f6693115b6793acff6331ef880bd5c27d0d769a894592d9553760976fbb18a464d0e1312ec8210a0759d1fb SHA512 821dccae3ecd91a4e2a1f5f7edef32fc77fe13b38ada5835773c231fd51c4d507cfce757adf0718f830775822994b337bd94e16a2b04a247fd43a215c0abccd1 +DIST rust-1.91.0_beta20251009-arm-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B b54e1b475b3281b1b663f796d026a461de1b516726c2444ae556615b9c782779ccdb90570eff3a110f50fa0313373d083fe9b6024ef7c98b71264567a45fd5a5 SHA512 7608db4a60bd693aaf868759053e409b6ca030a84c80f0da1c996cfd45583d55d5e64d2c265b129e826d4c32b9dc060a72d0353fb42ba98e92d2eca316493049 +DIST rust-1.91.0_beta20251009-armv7-unknown-linux-gnueabihf.tar.xz 229700512 BLAKE2B c1fadc832253361736864f2ad44aabf2202ae00f5c2b02053ef982358b1de278deffb95dffc747de63b78ffb417439803a75c8ff6e54cecada9d532294534dec SHA512 1a4be7d5c1efd8077edc0bab9afffb3dea9385cd8adc75d1b89ad0a6f61c4def766ed3838608b9b1e66544e88755ec9c6381650c4e2f41ae396e9b630122bb36 +DIST rust-1.91.0_beta20251009-armv7-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B 18644feb8c130537ee4396148ef8334929414b94b15a22182bbd9855b8902478f35ce7359410344af47ef7f0e6678666bc3d5e96f15f52ef38baa2e15e1d02ab SHA512 0519e3a35a2f89ebbfe90c7a3ab9ebcc3f6cc1c23508e95252559319a66e21fe35e5fb8b5189010dadfa34b1b3fc4b5718c9897b3e211b69bed0cc2d184166cc +DIST rust-1.91.0_beta20251009-i686-unknown-linux-gnu.tar.xz 266811976 BLAKE2B 9891683a80675ac52d49111268378010e83c651530091aa90d9e2d2c0c086d03bc0a203a0fc93b3619f7c0db92a4d2680ed57f639771443da2e09a529d75d946 SHA512 1b0c873f0761fb033ee0fac892340b485730375d46ccc4848ad8c15bff43833d3758385f75a8469067035926d5bcd1af31e97f16339ad8b6e80a2e6d30f2fd04 +DIST rust-1.91.0_beta20251009-i686-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B d2fecf2db909b6887980a9892ea47865f84c32fd921593f4ce7c8ba5d6224e455222561755feca8be7ef67b1d9e97dc4a9c84b4fd8f69e9ac7a0aefb180444f5 SHA512 f87472e7c849cbf9f52f4f38b78d6691fd0cad5b4c16d9fb2f017b6bee3c4a10da360c15cfaa2ecc5dc4e3132fd68cbc11913c5bf11ee77120bdbcdc0fb7f9bf +DIST rust-1.91.0_beta20251009-loongarch64-unknown-linux-gnu.tar.xz 259844264 BLAKE2B 0d4bd996fbbf1a8615e5ba42da8e3dae3009bc6a671a885abd646769ac4b549b8ea859412bf8ecc6d1b45b782259488b9f5ff4c8531258a25ef56cffc40824d5 SHA512 01966b4271734e973f8cd69f839e98dd04fe6fe9742af2b1225f6df651bcf63259d9b00263a482b8025267ba1c634c74027ed3250a5159c81be0f02b35a264e6 +DIST rust-1.91.0_beta20251009-loongarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 62c05db951367bafc8b72339f3eecad40e10a0b1620d2e5ad9eb039b7a45b176b0f2743179e2c2d3d3da893baf17d3dea46174fe0f22ae6cc97c9503c239903b SHA512 cacb5d64be85b0346c185a46cbfc253bfe25ecd85ca62fa123ad76550e7569ce2ad678fa6f36dfae17da5c3d7ada86dc03ae626ba3dcad25bd80db176a644092 +DIST rust-1.91.0_beta20251009-powerpc-unknown-linux-gnu.tar.xz 249572892 BLAKE2B b5311cf7c23c7cc85b49638b9a0b99c8c539d86c045deb251d3c9dcd8c064264421111284d0adbdf8537bdc8cf559c536ed17c6366950ddc368750022aa77dbf SHA512 4aa70b7c3a639077eb7724871d9b00bf738cb0106a96bf53b2b0ebea1c907b9e7dfc134fece05d25d6c854a97934c3399a82d50cf0d05e027af00e18fe64b977 +DIST rust-1.91.0_beta20251009-powerpc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 6ca85376fb225ec8d212de45692e2d33c70131a04339957c6f3f4d77ce5bb80b249b514ceb70e12b649c93c3f0ffa689949fb3c069f04cb250cf0641b0313578 SHA512 f66ec732583e1420dc9558cd453f246dd3b84dadc95b0d940127a37d0f383f3518418017fc116532032e2df83f75ad76c534924923418c90b9a600c75905e863 +DIST rust-1.91.0_beta20251009-powerpc64-unknown-linux-gnu.tar.xz 251085480 BLAKE2B dfb2ea024e6f27e29441f1b6bb372de194bf4099bee99f11118a12236a1812d7674ae37ca69ddb684534b0bebe98b7f33addcf723fd57f36e0f873b4dfd893df SHA512 e0706c58963ebc27054418cfb7403ed0669f0e02cd3160e5a72160339e69d793025bcc65fa71b3a141109a0e8d4ac2a69c9860e8048d23358fe12fdb188f9682 +DIST rust-1.91.0_beta20251009-powerpc64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B ad1d8921e46c18084813df0da595199d023cd1b6a28fb002d8ca185e111295f2372aea82fc808d2e02e3b9ef9005d6c832290efb2129bfa826827065cbd0997a SHA512 86f5da07d0186a0a502b5a4b3dbc9bfe3478acea3aacc42d444023d794e9350bc7160e1cee6117488a8405ac83d58185543277511757c8db76eadf43152549de +DIST rust-1.91.0_beta20251009-powerpc64le-unknown-linux-gnu.tar.xz 269690328 BLAKE2B f7bdb9e5653ffc09d82f20a3507e5eab1bee81d2b2a357d542544e138a18f4068fc3810f21816918550c5c9e74f5776c3de7fab2b1ca6116f40016edc6615ca7 SHA512 bfde7b6fded043bd60413d502ba5aedb1084be983c6f8caf5db65dde7f49ef2777840b290e0f68284b29dac6b5cd8f00ba1cbf55da84160be24828cdade2081a +DIST rust-1.91.0_beta20251009-powerpc64le-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 11c91bab0ee1309f4c17d848dc178815ce06ff7bab5bd440d97405ebe9a4594637a52333023f9511b52dde2fc69d9ab06d7cab5a0d55041544f686661a28ca66 SHA512 42e3b07bdebf574d43ccd36b3e6ecce7d53184495d77826315abf92142ab8a2082639c9cf8dfe40e4b0196cfea031c6acb19caea958790b873743ad3be16ac52 +DIST rust-1.91.0_beta20251009-riscv64gc-unknown-linux-gnu.tar.xz 248629072 BLAKE2B a01828a36090e3c45d9706d0ba60a383f4eeb013405193aee221e7b2ba6db02cd928edb0f76f6cb99b02aa5c33ad811c09ba4853cde78a41adf34f8b3b54a7a4 SHA512 c2db778110b19dae3a5a6d3d7b0775287396950934ea8326789c6a93f9a6c762e3da49ada711114a5ec1cdadefb4af1dd8e4531c9053837f4b15ae62979d7b2e +DIST rust-1.91.0_beta20251009-riscv64gc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B d9cf40c6b96f825ef55a39079451a327607471093c4156e01f798ef772bb130191a6a07edfbdf1ef387ab9fb4f9a6af89c574176ce17519e7953981bcef1dc43 SHA512 c6cf03b4d4f97cd7eed374d21395035111f0ab30f2e9a572ddec8a758fb37fbfbeb5552459259978a860524f692efcec9d02fe1098e9a049d210d48115795573 +DIST rust-1.91.0_beta20251009-s390x-unknown-linux-gnu.tar.xz 238057796 BLAKE2B 2ca1c62b69329698a7729c5ff4311f4a53557dedd35a8fb5b60e7a04e21f21a021aaa03d5f33d1c4e3ff7060f7738abc8186f77e284d9b44b1ca69bc7cff3d1e SHA512 0d52ba9318d60992e6e72c67e37990873226245d51e1a3feafc7a7e497847b4d3edf7fcc0abf6734f526086491811f81b539f156b2fc137df69d2db99e98af17 +DIST rust-1.91.0_beta20251009-s390x-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 31ab9e758e489ecfb7a7d8ed60ef5fed824c511169e608c39c0ff80889b8d91d00efb5ba19baae15e3ffad9d0ea5c9df891ce072a8ee571ac640d172b69a19e6 SHA512 adb05af13250a53fa87bbf8501d6f0260565f3f2123dbf14488986a274954e03234f9366c2a34d0adaa420d69993a9fda2b520b36ca58758405ab86c305bf544 +DIST rust-1.91.0_beta20251009-x86_64-unknown-linux-gnu.tar.xz 192137040 BLAKE2B dd613d631add1738d6b2f1801306547c3df27221660b604068e6060917ddc1834efda62db0afe105789bb0f7ac65abddbb27c29a3e7e314763331ea6b28ca00c SHA512 9a06f468793251ad2ee423649801dd34a6157d2e1eceb6a1e1d5587f0b715bcd3d4cb9414046ab7ef2eb82ea5a6fa9f5221bf75000ee0b3677e9a2423a0f7233 +DIST rust-1.91.0_beta20251009-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 6187a6d7fc47a750d6b4d975ae725c7ae8efdfb09471fe1596bce380fd29b694fc5033b1c57cfd182928e89585139583a8194c7e194cee4a68c876f6214c5b18 SHA512 56abc040f7cdc0277600bbe596ece010c3665830bf5c81632f0b753f79eb570648b9209cf1a550bebcfbe64dd2e2d9a4eaee9b6f9d2f3405ad2ba2490d97f34a +DIST rust-1.91.0_beta20251009-x86_64-unknown-linux-musl.tar.xz 295109976 BLAKE2B aca3518420e8637278bb46e6ce73bb422724f207f68acbbe549aba67329e16e6a89576a66ac23eae9127bb648d731c457351a072314e3c07fbe4c3343ddbfa5e SHA512 44384a471539cc114cfb8971011ea16d55fb3edf46ad6cb14fc060df14ba8ee98b75a8ce284c3be134743522a922fe3c08d9faef5a7161b2e76de7e6206adede +DIST rust-1.91.0_beta20251009-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B 89821eaecc25e4405c32ffda2b5a2471e18b194756f949b76a050fe49b02386aee31961efa235279954ac549fdc4d2f9d885724bb6b95004e3d62647948f8b19 SHA512 c449a2af5739d230f41d556c6a341a58d5c60bd56e654f4e125fb137da75b2ece59832b36e7c86e546d54b4edf997fa979676d85fbdb13fcdd78486ee26880de 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 @@ -712,3 +740,4 @@ DIST rust-src-1.88.0.tar.xz 3155272 BLAKE2B bca923d2264337366b8013c45f3a40cbdfc1 DIST rust-src-1.89.0.tar.xz 3461444 BLAKE2B b1e43def4cc0f47f0e776d383954b339a62b3efa77d5db71180b7b7620a67bd2d2714afe0b08ae26a06d7d8c785eed03f545d91813d074cbe6641e883a2d40dd SHA512 055c09854e47d1bdfc7f393ac6f2783d35cb8cf13100deb227598ad91020f1d91e4cec1658d8e71db3c266dc6e267ab4172dc1007428cb05105dc4aac57bf89d DIST rust-src-1.90.0.tar.xz 3473408 BLAKE2B 09e9d17af7acb38b99e33874cd4b14ad7e0e15b0580846cc32bc78657432b13091bcbf3fe95494c520bcdbabd5491b9445cb3ce3177fa149d0b89991b67b06e3 SHA512 88dd1a5f1a69ab9e4586fee4a31d7dea51a664ac32b501cab771739b8127eb4ac873d2353e819ef057734522c1bcd64d664bda3d1ff957b1448b4653be766638 DIST rust-src-1.91.0_beta20250928.tar.xz 3509016 BLAKE2B 81417db8497947d67288b1980601127cc9f737b8159e7817626fca7cb7d07fd4287fee14f0b4043c596a67d1d63b1ab9e273b6e1976f27049c86612395ee9255 SHA512 3ddd9987fac3d465b843cc05385ad482e9c18ff2c15dc2dc864fbb4988c2775766db5bec6fc35ed750ce5389d77dd9a56eafbbcb0ecdee293f5defd7e7a5ce45 +DIST rust-src-1.91.0_beta20251009.tar.xz 3508592 BLAKE2B 3f629ef1d2da676bb502172ad73313f66effc4d2173ba9591fdbb86e9bfbb2efe35a043fd5c965aa0cfa805906f53678961cb51c7f61573d53201db7caf791f3 SHA512 dacb62bbc2c6ed002ca79fe5ebd6342ae71732e94f0df20b36b77f0d361310bbefbf749c4b8fd25ecf54b4592bc5d63cea730b927278f13978553ae823cff5aa diff --git a/dev-lang/rust-bin/rust-bin-1.91.0_beta20251009.ebuild b/dev-lang/rust-bin/rust-bin-1.91.0_beta20251009.ebuild new file mode 100644 index 000000000000..2e4fb28bc1bc --- /dev/null +++ b/dev-lang/rust-bin/rust-bin-1.91.0_beta20251009.ebuild @@ -0,0 +1,320 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( 20 ) +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%/}/2025-09-18/rust-src-${PV}.tar.xz ) + ppc64? ( elibc_musl? ( !big-endian? ( + $(rust_arch_uri powerpc64le-unknown-linux-musl rust-${PV}) + ) ) ) + " + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~s390 ~x86" # ~ppc64 ~riscv ~sparc ~mips +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 #[[ ${PV} != *9999* && ${PV} != *beta* ]]; 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 ) + ) )" +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) + rust_bin_url=$(grep "xz_url.*rust-nightly-$(rust_abi)" "${WORKDIR}/channel-rust-nightly.toml" | cut -d '"' -f 2) + einfo "Using nightly Rust from: ${rust_bin_url}" + + 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 + + einfo "Fetching nightly Rust tarball ..." + curl --progress-bar -L "${rust_bin_url}" -O || die "Failed to fetch nightly tarball" + if use verify-sig; then + einfo "Fetching nightly signature ..." + curl --progress-bar -L "${rust_bin_url}.asc" -O || die "Failed to fetch nightly signature" + verify-sig_verify_detached "${WORKDIR}/rust-nightly-$(rust_abi).tar.xz" \ + "${WORKDIR}/rust-nightly-$(rust_abi).tar.xz.asc" + fi + tar -xf "${WORKDIR}/rust-nightly-$(rust_abi).tar.xz" || die "Failed to unpack nightly tarball" + 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 + 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 + rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + dodir "/opt/${P}/lib/rustlib" + cp -vr "${WORKDIR}/rust-${PV}-${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 +} diff --git a/dev-lang/rust-common/Manifest b/dev-lang/rust-common/Manifest index c92a7caa4ec6..92a01cf28566 100644 --- a/dev-lang/rust-common/Manifest +++ b/dev-lang/rust-common/Manifest @@ -20,3 +20,5 @@ DIST rustc-1.90.0-src.tar.xz 272348992 BLAKE2B 82dbbe3b5fe79f623c74fb81a4c4372b1 DIST rustc-1.90.0-src.tar.xz.asc 801 BLAKE2B 1e84c6134c4fedbbd52610c259c1bdacb45bc97e8cce7a6b5a8c92827a072c88fcf8984893a5e6aa28c2d5d82bd849bb9d38390c783cfaa503a18c99bcaabcde SHA512 fc8f6dfbb4b50777ae8e499883f95b64861db0ca37119b34b3670b4adf51dd248b0b33daafee90e0f22f66b1d8bd8ae6a6107106e95e73f5c2c5a8dc29532e2e DIST rustc-1.91.0_beta20250928-src.tar.xz 284030160 BLAKE2B f5df2137e3a08b51f034543d1bcd0793f7d29264e81926458f6071c6f2de4093170ec5d257e56a9940b10494642eab9e57bffd24d61e8682ff052bd62517543b SHA512 e2ea6676f01b35cbd632c7a36d53b8d6d1e02a74fa460243575036b99406781416629300fef58ae04dffa8ed40f5448ca167654fb14db6676d57fc6cc2b31481 DIST rustc-1.91.0_beta20250928-src.tar.xz.asc 801 BLAKE2B 70c58b0eb97b735835c37060e2e1ed13ed3531355cf36006c33ba5dbed2f252bda6900e4846693146fd8a093dd3b523a653166588ed1335fb22736e2e5a46567 SHA512 07eed611a38290582329512667d88cfb22d30119d9947169337844534bdbe9113f048080fbfa4dce95e3132319053919c6b11254c6e259cdaed788fa5ac777df +DIST rustc-1.91.0_beta20251009-src.tar.xz 270944196 BLAKE2B 5fd9843a4fb23a56e1bc6d3b815d8dca2d350006337c3626dc782b06f7eb1da0a427056f37a9b9cf06e16d55381edad37c2528f52cef31f05fb058967220d793 SHA512 7923188c85c9635700e046f0ebc1f8391ed500461537e20f6db5272fa13dcf980d67c329e2b9ef4cc4137a696784b84d4b05acbea37af6939a8844f95be2feb3 +DIST rustc-1.91.0_beta20251009-src.tar.xz.asc 801 BLAKE2B 192e516c471dbeb07bfb491beb8eb0adb70f4c1ca95cd4e90702e6e5c52e3843d1968fd9d81d6ce1bdf41177089b198ccfcc32bea5f80d4f2afdf159022649d7 SHA512 f3e3c3b81530dc08fddee190bce2c0a19df66ca5ffde32fa51d43cce9de7d6bf54598e43e8da1ef348b0f9c5a370fb248da28ecb44129c4fb99a7ece538b608f diff --git a/dev-lang/rust-common/rust-common-1.91.0_beta20251009.ebuild b/dev-lang/rust-common/rust-common-1.91.0_beta20251009.ebuild new file mode 100644 index 000000000000..26c4792d0fb5 --- /dev/null +++ b/dev-lang/rust-common/rust-common-1.91.0_beta20251009.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2025 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 +} diff --git a/dev-lang/rust/Manifest b/dev-lang/rust/Manifest index c6cd7343ff12..afd68d15d46e 100644 --- a/dev-lang/rust/Manifest +++ b/dev-lang/rust/Manifest @@ -18,6 +18,7 @@ DIST rust-patches-1.88.0.tar.bz2 4062 BLAKE2B 64168ffa608f2edf2e0b3d079152c3b5dd DIST rust-patches-1.89.0.tar.bz2 4091 BLAKE2B 0fea3488a39d2b00627084f6b192dfbd7ed49bdceabbb1141d1a849ba053f786e31115e00365679b1b6fb5b0ccdf5dc0dc0803057cbffbcf0ae3d75ae9830d94 SHA512 de6c9b693bdd719d06605b5da730ee5d9cf9a1d88d58194a0ba48bd378a951c66723f561e39181222d28abb38e974a2921e14ea1f40156caf7b903778cf65790 DIST rust-patches-1.90.0.tar.bz2 4183 BLAKE2B e6cc7516bd386c020be208e9931221edb301a94b6b5cf8140d68ddd5e13b1ddaaa53b52b4b7b039faf2a7caf44107f170afb01e15ac7487c6fe5146feff3789b SHA512 0cbf6dd9fc8b68e265dd146423c82c72bccf1ef7f81c5bab87c5d53dda1ecce80ffad361f2c276ab713616847126c277af7b1e48327d433f6202361e25cf5201 DIST rust-patches-1.91.0_beta20250928.tar.bz2 4214 BLAKE2B aad78f10a875ead5dc3570c7c276a219a8897cbc649cc593fc37d1a99cccdd6fdcba962887fca0417e40fdda6b1918ecec88795619b1df66e96926779e84b2c8 SHA512 366ad9eb680d122295e711a43049ea5fe7328d6f9f2a7d43eda92897deb35297305ef10a1f4a323d15548ce6264c1ac25d5021f5718cf73208ffec93126d02b3 +DIST rust-patches-1.91.0_beta20251009.tar.bz2 4212 BLAKE2B a07bd0f7c4c94e1d3dd2ef08f23a40ce62e6bc7f96a9a67745de7519aa9ea7431eff7857d51722690cd9beb8738ad348a10f1ccfcd7a185ad5c82d5e09381116 SHA512 6e5065ba7d42be9646b6fe786193c9aa3f82feec7884bfc79eedb1990b2b1cb7e608af98d9993bf0f5697dae4e8ede66dcfce913365fae00dddff45928138197 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 @@ -58,3 +59,5 @@ DIST rustc-1.90.0-src.tar.xz 272348992 BLAKE2B 82dbbe3b5fe79f623c74fb81a4c4372b1 DIST rustc-1.90.0-src.tar.xz.asc 801 BLAKE2B 1e84c6134c4fedbbd52610c259c1bdacb45bc97e8cce7a6b5a8c92827a072c88fcf8984893a5e6aa28c2d5d82bd849bb9d38390c783cfaa503a18c99bcaabcde SHA512 fc8f6dfbb4b50777ae8e499883f95b64861db0ca37119b34b3670b4adf51dd248b0b33daafee90e0f22f66b1d8bd8ae6a6107106e95e73f5c2c5a8dc29532e2e DIST rustc-1.91.0_beta20250928-src.tar.xz 284030160 BLAKE2B f5df2137e3a08b51f034543d1bcd0793f7d29264e81926458f6071c6f2de4093170ec5d257e56a9940b10494642eab9e57bffd24d61e8682ff052bd62517543b SHA512 e2ea6676f01b35cbd632c7a36d53b8d6d1e02a74fa460243575036b99406781416629300fef58ae04dffa8ed40f5448ca167654fb14db6676d57fc6cc2b31481 DIST rustc-1.91.0_beta20250928-src.tar.xz.asc 801 BLAKE2B 70c58b0eb97b735835c37060e2e1ed13ed3531355cf36006c33ba5dbed2f252bda6900e4846693146fd8a093dd3b523a653166588ed1335fb22736e2e5a46567 SHA512 07eed611a38290582329512667d88cfb22d30119d9947169337844534bdbe9113f048080fbfa4dce95e3132319053919c6b11254c6e259cdaed788fa5ac777df +DIST rustc-1.91.0_beta20251009-src.tar.xz 270944196 BLAKE2B 5fd9843a4fb23a56e1bc6d3b815d8dca2d350006337c3626dc782b06f7eb1da0a427056f37a9b9cf06e16d55381edad37c2528f52cef31f05fb058967220d793 SHA512 7923188c85c9635700e046f0ebc1f8391ed500461537e20f6db5272fa13dcf980d67c329e2b9ef4cc4137a696784b84d4b05acbea37af6939a8844f95be2feb3 +DIST rustc-1.91.0_beta20251009-src.tar.xz.asc 801 BLAKE2B 192e516c471dbeb07bfb491beb8eb0adb70f4c1ca95cd4e90702e6e5c52e3843d1968fd9d81d6ce1bdf41177089b198ccfcc32bea5f80d4f2afdf159022649d7 SHA512 f3e3c3b81530dc08fddee190bce2c0a19df66ca5ffde32fa51d43cce9de7d6bf54598e43e8da1ef348b0f9c5a370fb248da28ecb44129c4fb99a7ece538b608f diff --git a/dev-lang/rust/rust-1.91.0_beta20251009.ebuild b/dev-lang/rust/rust-1.91.0_beta20251009.ebuild new file mode 100644 index 000000000000..b84b675c5c36 --- /dev/null +++ b/dev-lang/rust/rust-1.91.0_beta20251009.ebuild @@ -0,0 +1,837 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( 21 ) +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 + + # 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 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" + 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 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 +} |
