{dev-lang,sys-devel}/rust*: add 1.88.0_beta20250526

This is our first beta for 1.88.0, corresponding to beta.4 upstream.
It is also the first release where `beta` and `live` ebuilds get their
patches from gitweb rather than ${FILESDIR}.

Changes:

  - in line with upstream changes, `config.toml` has been renamed to
    `bootstrap.toml`.
  - `*bootstrap.toml` has `change-id = "ignore"` added to suppress
    warnings that are not useful to downstream.
  - after discussion with upstream `x.py` verbosity reduced to `-v`.
  - restrictions on building beta with only the last stable have been
    dropped, these can be restored if required.

Signed-off-by: Matt Jolly <kangie@gentoo.org>
This commit is contained in:
Matt Jolly 2025-05-31 00:29:54 +10:00
parent eba3efd309
commit 388cbca2dd
No known key found for this signature in database
GPG Key ID: 1B55CE38F469B300
11 changed files with 1494 additions and 43 deletions

View File

@ -551,6 +551,34 @@ DIST rust-1.87.0-x86_64-unknown-linux-gnu.tar.xz 198639092 BLAKE2B 908c974cc044e
DIST rust-1.87.0-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B edac3e21d9414e774c507a352664f6d73beb78ca3b4f19c95097e073b461d10aeef8d0b2bcf0457b8944c40327f04907c05edcc92070cc10958a9deb1d843bc7 SHA512 1946680287698a07a922c18b74d27c1de374eed86624aeb76167aafcd0acc8ad4bca57fea5a8f8420deadcaf819be6ea0c47b8ca97033cd94578037fbbc86168
DIST rust-1.87.0-x86_64-unknown-linux-musl.tar.xz 292508024 BLAKE2B 2fdf8a2be388bbfeb52211c372b95f42563ef762883d4634f857545a3bdcf9fa6c41c9099df1a26b936f3a3e9e8679d891d3ed80e593e405663f02421fadad6c SHA512 9629d62407eb517e09b21cca83ae1528b60b589df29ee12d99e7f334c234cdd9e24c497c175b4e83b8a993f6117e17a8004b350a28868d7e5247c26dd165d253
DIST rust-1.87.0-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B 9ee89dcd5bca680c4b6c13b85166d4d7d6bf1c685931a6466e8701868840136376ae8980931e5cf91f82da1cec7f9bfc0ec74576d5e57eb14991d7d398524cd7 SHA512 5985a66b9c898f71864c5f18104a92930bfd20acd827efd0d7222c28da25fc96ca72f72c880be0b75ed25ea381f9d7e07e2e1243c4b465eb4903073bb74691bf
DIST rust-1.88.0_beta20250526-aarch64-unknown-linux-gnu.tar.xz 165315676 BLAKE2B 5011d0b4507462cc230696942496342fbc576dc398198b7897aed08985c60d009a96c741ad33bd0ff41eff78b45b05eac737f037f707dc008b4f08930294db6d SHA512 a7edd10983f7de4b6cabafccacb215999391d3c33fa2eee2a425ae0116372e207514254cdba1c798dbdc4faa1b0b4cfa6fe158c4b924d1d95dd49034dd593b22
DIST rust-1.88.0_beta20250526-aarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 99e83ee876ecc402d26e0c86f22289038841e4a7cb3554536e1d805fadc6a81a59fb403ab63ccaf885ad815871ab9c6aecbe41afd2059a6cb952c323d60d5bd3 SHA512 38eaa3c4afc5426e1a3a9c6a2cae45f1bb8d20806e66b9fbf678d046cd6636fff8d544db2a5d2aa852deac6fc1ce5bf0a06eacb829748a9c42f491da83751389
DIST rust-1.88.0_beta20250526-aarch64-unknown-linux-musl.tar.xz 243946068 BLAKE2B a37ff77ffa2964e412dd2eaa2426b65d6e51c610cad38378c1e95fb9c51ace8dc9028cfe96e84eeddd7b450ac30c1684f3febd2d438cb3b92be86a92d6262a0b SHA512 377b2d6c44ea7aeb16a56698105423868d6d81df1fa7412a94b26b3edb1a39af9280e0fcf8baee2e680806f0f0b4d81a2debc8f3ce6e6864ae2602e01391a737
DIST rust-1.88.0_beta20250526-aarch64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B ba903c4d3d2ab4304bfc95632ebec42b76e5f38a176ec1928910751c0b8f05544849d191c8ef660696a4d76ae65d0b5dcb8ed1059b11615227d74fb0f0ddadb8 SHA512 0d72b6d4c4dcee6a0ef6e705b731e90e03f60bed72c7d92ac281e70dc0f87a58344a5c97057117c80a7656f378a6c9a1f3961357fd49128192f0ceaf9827f2ca
DIST rust-1.88.0_beta20250526-arm-unknown-linux-gnueabi.tar.xz 229389328 BLAKE2B 9aa0753d731abcdc493a817247adbad1421c5d61246209805ab5025409b2287c573d1cf8a0c1a91fcc68280524991a578dec6502234ea4a545c8f1176c22dbc0 SHA512 c6189f9939389f3bb3e7fbbcfe56beb3abce395ac42323fa97fce479a3f20431b03d702978f005c9a0df234bdd0654048d5254e9f484f33ac74cc60adad9bea8
DIST rust-1.88.0_beta20250526-arm-unknown-linux-gnueabi.tar.xz.asc 801 BLAKE2B 07eee2c415503600b5d4299e5f05e884e47e3c353c11dd060100c3108f880a1250506aeaca296675cd33ba2c9741fb2a24000f151ba18e104cd71e1c55316cd4 SHA512 394ec48a653a8b93d0532f2f6df27dc273bbd948d2690f193004b4dbc416717d710cd2c5f3b6da970bba09367176b93a45d6466b552276935572e7f88de9827d
DIST rust-1.88.0_beta20250526-arm-unknown-linux-gnueabihf.tar.xz 229713968 BLAKE2B 6e2b361247abec64200820bf36fa74d5ef43e616ac3eabc5b948f7483f683526683b0c89b5c452f446a958aee989ed8d5fa1f64951389439230910ed13d1f488 SHA512 036ebff25321f4f62189b744857b445a79a34962032c92d35755c0cdac4095c0cdb2ed73d1b136a6f344458a6bd0a51857c122539d5fb5106a7972aa7338ce2a
DIST rust-1.88.0_beta20250526-arm-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B 8113dafc49ee2d04975bc510123486ab4b5d3d809ac843557c8404584ffc44b8467d0c915e1c207f2ab1a0e1a02e754f707577b87c4ef241d5f235f60747c732 SHA512 0425892113097b457a06cb260511a67b0107468fc685ff4034d11449f97ac0e2ed9b5ca0dae36f6ce0cbea872c592988c865b1991f22c4c4d68411c7dba8768a
DIST rust-1.88.0_beta20250526-armv7-unknown-linux-gnueabihf.tar.xz 235456424 BLAKE2B 54bec2fe1a8967d541f162fda8530b1a2d847a223b2edc9a37f285ee32bd99fa40cfd36df38055be76e4a1c894cdf54314b28d822228191e533a6550f6590217 SHA512 670975a615c81e0c45d40824aa2bd3a15c745d6e4e896d94882c8036bf98fc392d59f877061fbf8b0885e2ebee0187e98f5533ffaca8d070602800b9026d4076
DIST rust-1.88.0_beta20250526-armv7-unknown-linux-gnueabihf.tar.xz.asc 801 BLAKE2B 06e50a4e5c3006c1f85eca5ea35638affee6a6f854ecc40b6ba36a913f634ee9d3649da1fe4bfb64e3d093983eb14568fdbb5b458059837d9fde0103e2fd1222 SHA512 5ee5ecdce8b30354e6094c7cbabfdf942288e53b5aef6e8d36944d30ffef526d4b7c2d7d17c05caf48d6f5a597799fa167f54e216122dcd741fd4af3c7de8172
DIST rust-1.88.0_beta20250526-i686-unknown-linux-gnu.tar.xz 261911348 BLAKE2B c1d48ad71cb2b8b12cc6c2d3a1a0d620cc74a260416e037d804d3142e055ae8e8a1e7fb40ce89f8935037d5d97357d1255c9f22377028b1a4e4bba3b1a819e80 SHA512 a16188f8459d658301e6d3a85f5ef7f811cc2ceb7181e83d5394c3c26c75fadf2198ec6fa63fe496e94ad0734bd888021eb1a554f612bed01d1aebb87f820eda
DIST rust-1.88.0_beta20250526-i686-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B fe93010560fc2e5b888246c1410d8375d1c9eb488caba10ceac4a4f9c12a7e169fd6213e7949392036705e4b8a654dc394e7d3f8252735da9c80892a969d3d20 SHA512 93c5e9f2790a6b4b7d324ab7f4b5385225e049cee423092cf1997a41dffd84327ec32be4decd9a8b790e1c3efdcda4bd0952214ee31ad7ce5e91206ecf9097bf
DIST rust-1.88.0_beta20250526-loongarch64-unknown-linux-gnu.tar.xz 261384104 BLAKE2B 661882ea84aec6dde3cf938ba61229bb38d8a745832dae4025965241f61d8a4879a8e727ba35d0a000694bd4ca560f6b2491a3a4213569004f5bdb310be4de10 SHA512 a5b78599ba01a822b1f59f2ce98f5294d968522ac2263cd6a71b08b6dd74fcfe443ac530332b9d67a9555ba7bb0ffef5375c98b1f8f7e6ba0a95e41145aad899
DIST rust-1.88.0_beta20250526-loongarch64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B d4807f009edf0b41134ba6a7a1fb78c0b0a4b38c7281c8808fd2bd0c3856820353414ea70eabdbe25064c4f0800b291e89247b64d83477702ace2feac0e8a9ec SHA512 b04d928325c3c70912db1a434c6df49101b8bcc379f60e2f8d85de032f1caba10abe2f073d513c4bdd4878bf6ee46022599f65a3c2a134a8cba2f84cf29fd0e8
DIST rust-1.88.0_beta20250526-powerpc-unknown-linux-gnu.tar.xz 255492828 BLAKE2B 47c1acdf66909a547e3db24ce75ece26745cf40237c6695276683bddc33192508cba12f9dce100f762979e92648c58531de5293c0f73ff43b4141d5ad0e7ce49 SHA512 7901e970db1780bb10b92610738a22ddb6e0dd89403391ecaa395038971d3b290dcd3b77f1c727eb0ac9f011b4f153ceacc24bb8a5afb78ecd73ab1686c0ee14
DIST rust-1.88.0_beta20250526-powerpc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 00680f8b37b644078d4d4e97ce4075648fef1e1758418623d489032d6f41a194a453328e46d8ca3fa1e451a17bb8687e347b5ae73595c71487adc97c3d1618f3 SHA512 813ca054248bebc85b1f1daa637e1623604f7facf86ed493f12f97dee6f979d738245ddb58b6feb6ac10f24ae06810f3fa460439202f6551ccd303bc94e1f554
DIST rust-1.88.0_beta20250526-powerpc64-unknown-linux-gnu.tar.xz 255634308 BLAKE2B 8344bc5d3879d8ea1332ae8e3a6740dad295d8f7e5ed37c38f7bf4cc980ce79ca71e9f0ac980594b0664b4d15feaf79f9193b81fba1fc9baa71cab36c6eaa650 SHA512 e41070dab0420c4a86db50df549e8d09417fd224db0f8873ea39d3ced970f4312ca074cf4d5adb6ebd70eae76ac70f8103621da86fc22bb4e64d8fb70bc2f56b
DIST rust-1.88.0_beta20250526-powerpc64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B fff2551661e8ff90a0fdc394c59bd6cd1c56eeb0062b5059b1555febc8ff82c964802a9273ca1f50b189bfd9aecb356fb6d6978421a75cb32de0ee070ad63000 SHA512 282420dd4e850a5bc2659ab1f34e7cbf50e0f3c16967019bba8d679af83d4b66d920ead46223d1f2cd2f0ed31c7db8beeb10d75d1e33bce844aec7d0f35d7e8a
DIST rust-1.88.0_beta20250526-powerpc64le-unknown-linux-gnu.tar.xz 270308004 BLAKE2B 521d954e0a8ddec0be99d17a1dee9918dd093ec87c9b4069f84d56d810916464296e8dc03df8604628c82afe418b26d61b8907c36cad89eff88262fa6156fa0b SHA512 df8926047e649e4a3d7f98fcb609facfec3ed4aad820b401dd028eca84ddaa3cf968b79185dadc37cb16e0a88e4caff09123fd5be7200cd0a019d4cbe95813b9
DIST rust-1.88.0_beta20250526-powerpc64le-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B 1ec1fa77a2ea0a0917c4ae45d32f656b56d0f287d7aeb8d433987b940f55516707d9b473a7d95f4ef2bb19afe5bbd836ab96594a48500554198877d55ea5c762 SHA512 f3021119ce42f1edde18bcd7be8b177a6f0b288b3bbe6fa497863f29e62ca0407cace6f58760bb1e2ada49e5846404f12a7351da54724f9d86924999ef7e7cf7
DIST rust-1.88.0_beta20250526-riscv64gc-unknown-linux-gnu.tar.xz 250149844 BLAKE2B 5a560e6c36cdaaf4598d1333e5c24f356df29d412edc3a0158184fef11dc0862f1c86aa3bb13eaea12db701092d2d5c49e598ced045679228a0e9df8ec0000e5 SHA512 c1ee83f099fdb3e548e1bf6237571509930f43e0dc02d889ae79f938a8c577eff939a2952f9c37ac10e14e3aa8067c23f229290c09c87c7af572c670fcbbcc53
DIST rust-1.88.0_beta20250526-riscv64gc-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B f68833da766ea88adf9f8a10ccbf7e0fdbe8c5c7e1b8d5e8fe5c43b01b261d92e6dabe086764564c6171b24d54ea7e0259412f9975ba5abb732d525af0ee6071 SHA512 a76cbe0d25f7b1bc7aeb7f4f853399cf3f6fc974aa5aaa8f4d8a2168314ba289df26f045a143d7ff8c8021d69924e6983e174cb142ec5a9ade4c551b0320aee3
DIST rust-1.88.0_beta20250526-s390x-unknown-linux-gnu.tar.xz 239803292 BLAKE2B fb85011c9d2229c12d684b0efe4427fd88a10adc41558091d1a5d78354f07af22b4e4fffba2ba9213fafe2229a08251e68c8439704c6e5705edead7d158f14c9 SHA512 39f8ee027b5fbf786597f160ff82f8c67ac0fa1992d81fb8176c4c1a3ab38d707b877b679d2ed03bfd577d4f8c60c40c737ff4856f75bf7fb2b8dcda2f78d765
DIST rust-1.88.0_beta20250526-s390x-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B ef2d5870840cf3f68b0ff774ecd53e52155ee7d716fa92482b7c1bcddfc986fdc8056ce49f5af03f51a24ce239ba6812d5e87e5b0712f28f8adb18d70d54282d SHA512 8c0c7470170ef0b5111b1acd5044b9ea13f8828f0aaaa3483d808f6853d38d3d9e101dd22740c1ebf658727b409bf0f6c6db967456833a5f2365e4bbf21f971c
DIST rust-1.88.0_beta20250526-x86_64-unknown-linux-gnu.tar.xz 197118828 BLAKE2B 7d7ded5b1db239cffe9b9c2f12e81ad33a9b577782512f4141c4444095f47bfd87e86a971aa3daeb0fe69b28cfb5d9f664e16a87b3c797fcc90700dbe9af533b SHA512 700329288c0295fa3b37c12c1160e46aeb042a5bb9764660f52dcee7012c14ab0454e4941ca9891873e8b918a9b47c969226b1bba058d24f599dcd4f0e397b45
DIST rust-1.88.0_beta20250526-x86_64-unknown-linux-gnu.tar.xz.asc 801 BLAKE2B dc34f5079fbcc11b615c8f054b634930145648ce4c0659f1d51bcb8565dfc23dc887ddb5ed40c156f05bbcf32b78c11a212813541eb61b20c20e9aeee0dfebda SHA512 037173417bf760225c6397108f3d139badd8e00145c9b5a7e65177457abe2552001b9cf8bab79fd58a8b40aedf2d224de66c9dfaa9a119bb913713c06ffbea55
DIST rust-1.88.0_beta20250526-x86_64-unknown-linux-musl.tar.xz 290943744 BLAKE2B 03068177cc6f5252360cbef4616966cbf2042e4e342175c7a8342524729c3f6c5da650b7ba9ea5544a5fe6433bc8ce87e45a814b838eefa8e1149e4306a82f7d SHA512 d579488256b24aec5a487296f1929ca24e1e6f0da6dc5fc8298c0372b9f25dc988525bb9e3f66d79297e80ba792825d4d39f163f310b3f94540dd299c680be3d
DIST rust-1.88.0_beta20250526-x86_64-unknown-linux-musl.tar.xz.asc 801 BLAKE2B 9b54bb5932d09b34abedf1448cf90cac011d2e7efa73f9f17df7815bd503ec3f992946dffc9309edc53e1b5b17d8a1c10759cc60ca41334734ae17c75e6a5f50 SHA512 22f38ac6bbf6fda213928c09f89ec2683743ad73b89b24cfc903bdc7243ac954a45fa735c125a1915c5d8f19c0761ca9dc41221791688ac343282034af0cdd90
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
@ -567,3 +595,4 @@ DIST rust-src-1.85.0.tar.xz 3036988 BLAKE2B b7281b23eef60cf052e1641a29915c02c590
DIST rust-src-1.85.1.tar.xz 3036412 BLAKE2B f137ffcebd2d231d8b3dc5c9072f6afe39a071bc9608ac468bca364fafaa9c277b91e40da870a083c802cc13b9b876a548d7fa8ae67ad9552321a7412b7d8cd8 SHA512 d230cbb1daae3e2f5168abef94c5b99fb118c34a980f018d5df3e43f6ead4e0a17d6ea29bcfbcd0fb745e215f7a4d0282a99a714dba77b98a16254bb27c2d2ad
DIST rust-src-1.86.0.tar.xz 3053544 BLAKE2B 2d1d8a4be4f9dc9355ce9a2d1599e0a57c5d1cb32f7b2eb413f6009dbce7d63db2533dc038cf50f5277a2d7bf4434f2076632c12a6fd33335ccf3a9f2ab685d1 SHA512 2818d94412bb0766ce53383932cd8ce96275a8e923f916c4bf7116fbcb7c2053cfb9714667add1a9d50b18366c973ba3ab4fe55d49c8abc8cc57656635c59f63
DIST rust-src-1.87.0.tar.xz 3119800 BLAKE2B 6429eb419f17109537a2a5463b0c68f504b3cb0f55766e18f73cf053883b06eedc934ab4598756790cec147ff41c4eb30a807d2ce0b7e6af33310710fdc5a8c1 SHA512 9747c60268d772b7c6e7694260c0808d2b8a42028f5606499c81595d76f5bc32c9acf6b4b9aad168235f8fd77d980c56bc4afc3d40f5d0374b23d3e66e3de390
DIST rust-src-1.88.0_beta20250526.tar.xz 3154796 BLAKE2B 9c4cfd252edce814ce8621d189f3a4aa16ba7a350ae9d28644bf56daba8422e7e9bde63394d89870b94a021e55eeb1986d16d1b57afb8a8990e67ea7e175502e SHA512 c0e7185791433bf79db118d01476e28201970505adfebb425c86d1fac766c61ef57ae69aed34d538aee235e62cd5b00de882f04b36f1f227d64beb276915d053

View File

@ -0,0 +1,314 @@
# 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 "${PV}")
rust-src? ( ${RUST_TOOLCHAIN_BASEURL%/}/2025-01-30/rust-src-${PV}.tar.xz )
"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~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 [[ ${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 )
!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"
RDEPEND="
>=app-eselect/eselect-rust-20190311
dev-libs/openssl
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 analysis="$(grep 'analysis' ./components || die "analysis not found in components")"
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" )
use rust-analyzer && components+=( "rust-analyzer-preview" "${analysis}" )
# 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/${SLOT}/bin"
find "${ED}/opt/${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
}

View File

@ -92,7 +92,7 @@ QA_PREBUILT="
# 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/${P}/lib/rustlib/*/lib*.rlib:lib.rmeta"
QA_EXECSTACK="opt/${PN}-${SLOT}/lib/rustlib/*/lib*.rlib:lib.rmeta"
VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/rust.asc"

View File

@ -12,3 +12,5 @@ DIST rustc-1.86.0-src.tar.xz 275696736 BLAKE2B 9f33a710a3e567d92f56091920643f5ef
DIST rustc-1.86.0-src.tar.xz.asc 801 BLAKE2B 3e10a3894c7eee68d37bc5707d797548119f830667e27e652a199d13633199713bd01bd0f41a5f2af3c682561903e36abe27b36ef78d9a1d65bdf485527d2c15 SHA512 0b74dab9ee56d0a08e26e9cd40f722e4d99de63ac678f969f0c54d50737074fb28e170db5a36ce2627ec332e5ce3bb8a92167aefbccff7c70e4cb057bc0a94ac
DIST rustc-1.87.0-src.tar.xz 283604208 BLAKE2B 7ede723121ff8df3908674631ceaec75797d91ccd6f1df4afd7187878adbb8d99c9e8a3b11c6027703b2e8d06785299d93d8649f3eda7f356dd2a6734d99d05b SHA512 2ef08c9be45434401f916d54b3739f52d255f8a3a4ce05a717499250c2333eeaf601f1d18085b878c027c609f44da74d0151f5bfc2c9ae1e01166919a91a1d2b
DIST rustc-1.87.0-src.tar.xz.asc 801 BLAKE2B c9740c03baedcd70defba3fd37831692adaf0e984ef6b11d259244330d044fcacf935e6dd76caf126848da0c40f38e5368c60e8aabed5d3c2655a61fdbdc7564 SHA512 ebc13374381839a997c63455b733fd2a7960b4fd497f19c29be948cce8bb59a31ddda5da54ca154c16f7de43dd1bacd6c6bd76f3b6b36c5b43f4cfaf1746b952
DIST rustc-1.88.0_beta20250526-src.tar.xz 283223628 BLAKE2B 1c21853c0b7edcafd87713823888e04d336fb9c6cd373aa05218ae5d1ddc9c68b18c06dc27d059542ddfe91c0eb04cf523e4b3621b9bbbfad5d2f82e8d1cad1e SHA512 28f64ae8b1e907f7c4044d8a0148286f6e202677417ac3b4f2ce24ee9dba34369ba18d39e443cb982ee5f3b8afd94530580a62b8f5d5473954e976708f002357
DIST rustc-1.88.0_beta20250526-src.tar.xz.asc 801 BLAKE2B a412d72e4e0f273f03f3fee41abe1aeda03f77339891469e994f3a6bde0cd3836a1da087d908e732e90cd3285743a4a3c728c718ad1dda5daf7cca9de3be2c52 SHA512 45f208555f8b2fd3b21ac4cdc8fd7a110dc53fedbbe8d11542f105c5c8657a628309c8ff4520eb2c740cf3e784bfea0f21832b71b19a356b1b99fc7d0f04f607

View File

@ -0,0 +1,72 @@
# 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
}

View File

@ -1,3 +1,4 @@
DIST rust-patches-1.88.0_beta20250526.tar.bz2 4073 BLAKE2B 4ae2fd9d87116ee6f779e60ffcbed16ef778fd4e87d4f6f8e2588348b7d0aa28de3627f8c2d43cef540b2422278d4018618c6f0da6936be03de68aba3420f5a4 SHA512 8f775901aff2c0da66c01e20c983ca965eddf38cd106d055b6e480e9ca73418abc416fe28215d4f700eb8cce52a90808c0513d23d495977ac19a3b5d82e109ff
DIST rustc-1.74.1-src.tar.xz 155968724 BLAKE2B e05f2379ac94b286f85791a138e1928e5b5b5a7749f0981d82c40c2a12860f55bf96bb2f0e924e35a0f8b2447b13052d38adea909aaa3199105787bb5a4861b3 SHA512 14c7e7ed2f38ab60299d8c7d41d78f042b6b57ef822d577b5138e60bdde31cf141eccd4332a25bc5da3d58eb5313d63c1448b5dfe9e11b8055bb8ea133a9038d
DIST rustc-1.74.1-src.tar.xz.asc 801 BLAKE2B ddf73175b164233babf31ca3a381b03e20c0f36d017c1d5f85d6ab11f0986d861ab23b11c061e6b2444ced70c3d6a494cc3de4ec86f0deb221a805491bd75420 SHA512 9a96ff9ba9a4e2af4e267b2ec126fc0675c78d0eb767703daa2f28491c3d85c2ab00fbd8584390bf658812ec6c4ab6c57e43b386db59fd505bd3134a8873a09e
DIST rustc-1.75.0-src.tar.xz 159624388 BLAKE2B 8937b80585eddaa3e1f1ef948899d14a170308518c6fef9fe569560cdd870053776956743f796055f2119399b9ca6c0df12fedd789ae46324d071e5126c4e495 SHA512 7b0f25d91b1b5c317980fc88e059200bd43b56a70b445fbc72fb9b96e09775bfd3a98e9bd9d662af80f0ce3aef527c777ee82777e96ca876f47a972d63da8606
@ -30,3 +31,5 @@ DIST rustc-1.86.0-src.tar.xz 275696736 BLAKE2B 9f33a710a3e567d92f56091920643f5ef
DIST rustc-1.86.0-src.tar.xz.asc 801 BLAKE2B 3e10a3894c7eee68d37bc5707d797548119f830667e27e652a199d13633199713bd01bd0f41a5f2af3c682561903e36abe27b36ef78d9a1d65bdf485527d2c15 SHA512 0b74dab9ee56d0a08e26e9cd40f722e4d99de63ac678f969f0c54d50737074fb28e170db5a36ce2627ec332e5ce3bb8a92167aefbccff7c70e4cb057bc0a94ac
DIST rustc-1.87.0-src.tar.xz 283604208 BLAKE2B 7ede723121ff8df3908674631ceaec75797d91ccd6f1df4afd7187878adbb8d99c9e8a3b11c6027703b2e8d06785299d93d8649f3eda7f356dd2a6734d99d05b SHA512 2ef08c9be45434401f916d54b3739f52d255f8a3a4ce05a717499250c2333eeaf601f1d18085b878c027c609f44da74d0151f5bfc2c9ae1e01166919a91a1d2b
DIST rustc-1.87.0-src.tar.xz.asc 801 BLAKE2B c9740c03baedcd70defba3fd37831692adaf0e984ef6b11d259244330d044fcacf935e6dd76caf126848da0c40f38e5368c60e8aabed5d3c2655a61fdbdc7564 SHA512 ebc13374381839a997c63455b733fd2a7960b4fd497f19c29be948cce8bb59a31ddda5da54ca154c16f7de43dd1bacd6c6bd76f3b6b36c5b43f4cfaf1746b952
DIST rustc-1.88.0_beta20250526-src.tar.xz 283223628 BLAKE2B 1c21853c0b7edcafd87713823888e04d336fb9c6cd373aa05218ae5d1ddc9c68b18c06dc27d059542ddfe91c0eb04cf523e4b3621b9bbbfad5d2f82e8d1cad1e SHA512 28f64ae8b1e907f7c4044d8a0148286f6e202677417ac3b4f2ce24ee9dba34369ba18d39e443cb982ee5f3b8afd94530580a62b8f5d5473954e976708f002357
DIST rustc-1.88.0_beta20250526-src.tar.xz.asc 801 BLAKE2B a412d72e4e0f273f03f3fee41abe1aeda03f77339891469e994f3a6bde0cd3836a1da087d908e732e90cd3285743a4a3c728c718ad1dda5daf7cca9de3be2c52 SHA512 45f208555f8b2fd3b21ac4cdc8fd7a110dc53fedbbe8d11542f105c5c8657a628309c8ff4520eb2c740cf3e784bfea0f21832b71b19a356b1b99fc7d0f04f607

View File

@ -0,0 +1,831 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{10..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
}
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_
else
verify-sig_src_unpack
fi
}
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
}
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
PATCHES=(
"${WORKDIR}/rust-patches-${RUST_PATCH_VER}/"
)
if use lto && tc-is-clang && ! tc-ld-is-lld && ! tc-ld-is-mold; then
export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
fi
default
}
src_configure() {
if tc-is-cross-compiler; then
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH="${ESYSROOT}/usr/$(get_libdir)/pkgconfig"
export OPENSSL_INCLUDE_DIR="${ESYSROOT}/usr/include"
export OPENSSL_LIB_DIR="${ESYSROOT}/usr/$(get_libdir)"
fi
# Avoid bundled copies of libraries
export RUSTONIG_SYSTEM_LIBONIG=1
# Need to check if these can be optional
#export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
#export LIBSSH2_SYS_USE_PKG_CONFIG=1
filter-lto # https://bugs.gentoo.org/862109 https://bugs.gentoo.org/866231
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets+=",\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
if use wasm; then
rust_targets+=",\"wasm32-unknown-unknown\""
if use system-llvm; then
# un-hardcode rust-lld linker for this target
# https://bugs.gentoo.org/715348
sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/base/wasm.rs || die
fi
fi
rust_targets="${rust_targets#,}"
# cargo and rustdoc are mandatory and should always be included
local tools='"cargo","rustdoc"'
use clippy && tools+=',"clippy"'
use rustfmt && tools+=',"rustfmt"'
use rust-analyzer && tools+=',"rust-analyzer","rust-analyzer-proc-macro-srv"'
use rust-src && tools+=',"src"'
if [[ ${PV} == *9999* ]]; then
use miri && tools+=',"miri"'
fi
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
# in case of prefix it will be already prefixed, as --print sysroot returns full path
[[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory"
rust_target="$(rust_abi)"
rust_build="$(rust_abi "${CBUILD}")"
rust_host="$(rust_abi "${CHOST}")"
RUST_EXPERIMENTAL_TARGETS=()
for _x in "${!ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do
if [[ ${ALL_RUST_EXPERIMENTAL_TARGETS[${_x}]} == 1 ]] && use ${_x} ; then
RUST_EXPERIMENTAL_TARGETS+=( ${_x#llvm_targets_} )
fi
done
RUST_EXPERIMENTAL_TARGETS=${RUST_EXPERIMENTAL_TARGETS[@]}
local cm_btype="$(usex debug DEBUG RELEASE)"
local build_channel
local build_miri="false"
case "${PV}" in
*9999*)
build_channel="nightly"
;;
*beta*)
build_channel="beta"
;;
*)
build_channel="stable"
;;
esac
cat <<- _EOF_ > "${S}"/bootstrap.toml
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[llvm]
download-ci-llvm = false
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
ninja = true
targets = "${LLVM_TARGETS// /;}"
experimental-targets = "${RUST_EXPERIMENTAL_TARGETS// /;}"
link-shared = $(toml_usex system-llvm)
$(if is_libcxx_linked; then
# https://bugs.gentoo.org/732632
echo "use-libcxx = true"
echo "static-libstdcpp = false"
fi)
$(case "${rust_target}" in
i586-*-linux-*)
# https://github.com/rust-lang/rust/issues/93059
echo 'cflags = "-fcf-protection=none"'
echo 'cxxflags = "-fcf-protection=none"'
echo 'ldflags = "-fcf-protection=none"'
;;
*)
;;
esac)
enable-warnings = false
[llvm.build-config]
CMAKE_VERBOSE_MAKEFILE = "ON"
$(if ! tc-is-cross-compiler; then
# When cross-compiling, LLVM is compiled twice, once for host and
# once for target. Unfortunately, this build configuration applies
# to both, which means any flags applicable to one target but not
# the other will break. Conditionally disable respecting user
# flags when cross-compiling.
echo "CMAKE_C_FLAGS_${cm_btype} = \"${CFLAGS}\""
echo "CMAKE_CXX_FLAGS_${cm_btype} = \"${CXXFLAGS}\""
echo "CMAKE_EXE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_MODULE_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_SHARED_LINKER_FLAGS_${cm_btype} = \"${LDFLAGS}\""
echo "CMAKE_STATIC_LINKER_FLAGS_${cm_btype} = \"${ARFLAGS}\""
fi)
[build]
build-stage = 2
test-stage = 2
build = "${rust_build}"
host = ["${rust_host}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
rustfmt = "${rust_stage0_root}/bin/rustfmt"
docs = $(toml_usex doc)
compiler-docs = false
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = true
tools = [${tools}]
verbose = 2
sanitizers = false
profiler = true
cargo-native-static = false
[install]
prefix = "${EPREFIX}/usr/lib/${PN}/${SLOT}"
sysconfdir = "etc"
docdir = "share/doc/rust"
bindir = "bin"
libdir = "lib"
mandir = "share/man"
[rust]
# https://github.com/rust-lang/rust/issues/54872
codegen-units-std = 1
optimize = true
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
debug-assertions-std = $(toml_usex debug)
debuginfo-level = $(usex debug 2 0)
debuginfo-level-rustc = $(usex debug 2 0)
debuginfo-level-std = $(usex debug 2 0)
debuginfo-level-tools = $(usex debug 2 0)
debuginfo-level-tests = 0
backtrace = true
incremental = false
$(if ! tc-is-cross-compiler; then
echo "default-linker = \"${CHOST}-cc\""
fi)
channel = "${build_channel}"
description = "gentoo"
rpath = true
verbose-tests = true
optimize-tests = $(toml_usex !debug)
codegen-tests = true
omit-git-hash = false
dist-src = false
remap-debuginfo = true
lld = $(usex system-llvm false $(toml_usex wasm))
$(if use lto && tc-is-clang && ! tc-ld-is-mold; then
echo "use-lld = true"
fi)
# only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it
# https://github.com/rust-lang/rust/issues/74976
# https://github.com/rust-lang/rust/issues/76526
deny-warnings = $(usex wasm $(usex doc false true) true)
backtrace-on-ice = true
jemalloc = false
# See https://github.com/rust-lang/rust/issues/121124
lto = "$(usex lto thin off)"
[dist]
src-tarball = false
compression-formats = ["xz"]
compression-profile = "balanced"
_EOF_
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
cxx = "$(tc-getCXX)"
linker = "$(tc-getCC)"
ranlib = "$(tc-getRANLIB)"
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
crt-static = false
musl-root = "$($(tc-getCC) -print-sysroot)/usr"
_EOF_
fi
done
if use wasm; then
wasm_target="wasm32-unknown-unknown"
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
profiler = false
_EOF_
fi
if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below
# experimental cross support
# discussion: https://bugs.gentoo.org/679878
# TODO: c*flags, clang, system-llvm, cargo.eclass target support
# it would be much better if we could split out stdlib
# complilation to separate ebuild and abuse CATEGORY to
# just install to /usr/lib/rustlib/<target>
# extra targets defined as a bash array
# spec format: <LLVM target>:<rust-target>:<CTARGET>
# best place would be /etc/portage/env/dev-lang/rust
# Example:
# RUST_CROSS_TARGETS=(
# "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu"
# )
# no extra hand holding is done, no target transformations, all
# values are passed as-is with just basic checks, so it's up to user to supply correct values
# valid rust targets can be obtained with
# rustc --print target-list
# matching cross toolchain has to be installed
# matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one)
# only gcc toolchains installed with crossdev are checked for now.
# BUG: we can't pass host flags to cross compiler, so just filter for now
# BUG: this should be more fine-grained.
filter-flags '-mcpu=*' '-march=*' '-mtune=*'
local cross_target_spec
for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do
# extracts first element form <LLVM target>:<rust-target>:<CTARGET>
local cross_llvm_target="${cross_target_spec%%:*}"
# extracts toolchain triples, <rust-target>:<CTARGET>
local cross_triples="${cross_target_spec#*:}"
# extracts first element after before : separator
local cross_rust_target="${cross_triples%%:*}"
# extracts last element after : separator
local cross_toolchain="${cross_triples##*:}"
use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled"
command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain"
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${cross_rust_target}]
ar = "${cross_toolchain}-ar"
cc = "${cross_toolchain}-gcc"
cxx = "${cross_toolchain}-g++"
linker = "${cross_toolchain}-gcc"
ranlib = "${cross_toolchain}-ranlib"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
if [[ "${cross_toolchain}" == *-musl* ]]; then
cat <<- _EOF_ >> "${S}"/bootstrap.toml
musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr"
_EOF_
fi
# append cross target to "normal" target list
# example 'target = ["powerpc64le-unknown-linux-gnu"]'
# becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]'
rust_targets="${rust_targets},\"${cross_rust_target}\""
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" bootstrap.toml || die
ewarn
ewarn "Enabled ${cross_rust_target} rust target"
ewarn "Using ${cross_toolchain} cross toolchain"
ewarn
if ! has_version -b 'sys-devel/binutils[multitarget]' ; then
ewarn "'sys-devel/binutils[multitarget]' is not installed"
ewarn "'strip' will be unable to strip cross libraries"
ewarn "cross targets will be installed with full debug information"
ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files"
ewarn
ewarn "Alternatively llvm-strip can be used, it supports stripping any target"
ewarn "define STRIP=\"llvm-strip\" to use it (experimental)"
ewarn
fi
done
fi # I_KNOW_WHAT_I_AM_DOING_CROSS
einfo "Rust configured with the following flags:"
echo
echo RUSTFLAGS="\"${RUSTFLAGS}\""
echo RUSTFLAGS_BOOTSTRAP="\"${RUSTFLAGS_BOOTSTRAP}\""
echo RUSTFLAGS_NOT_BOOTSTRAP="\"${RUSTFLAGS_NOT_BOOTSTRAP}\""
echo MAGIC_EXTRA_RUSTFLAGS="\"${MAGIC_EXTRA_RUSTFLAGS}\""
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "bootstrap.toml contents:"
cat "${S}"/bootstrap.toml || die
echo
}
src_compile() {
# -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
}
src_test() {
# https://rustc-dev-guide.rust-lang.org/tests/intro.html
# those are basic and codegen tests.
local tests=(
codegen
codegen-units
compile-fail
incremental
mir-opt
pretty
run-make
)
# fails if llvm is not built with ALL targets.
# and known to fail with system llvm sometimes.
use system-llvm || tests+=( assembly )
# fragile/expensive/less important tests
# or tests that require extra builds
# TODO: instead of skipping, just make some nonfatal.
if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then
tests+=(
rustdoc
rustdoc-js
rustdoc-js-std
rustdoc-ui
run-make-fulldeps
ui
ui-fulldeps
)
fi
local i failed=()
einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}"
for i in "${tests[@]}"; do
local t="src/test/${i}"
einfo "rust_src_test: running ${t}"
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.toml \
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
then
failed+=( "${t}" )
eerror "rust_src_test: ${t} failed"
fi
done
if [[ ${#failed[@]} -ne 0 ]]; then
eerror "rust_src_test: failure summary: ${failed[@]}"
die "aborting due to test failures"
fi
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
# bug #689562, #689160
rm -v "${ED}/usr/lib/${PN}/${SLOT}/etc/bash_completion.d/cargo" || die
rmdir -v "${ED}/usr/lib/${PN}/${SLOT}"/etc{/bash_completion.d,} || die
local symlinks=(
cargo
rustc
rustdoc
rust-gdb
rust-gdbgui
rust-lldb
)
use clippy && symlinks+=( clippy-driver cargo-clippy )
if [[ ${PV} = *9999* ]]; then
use miri && symlinks+=( miri cargo-miri )
fi
use rustfmt && symlinks+=( rustfmt cargo-fmt )
use rust-analyzer && symlinks+=( rust-analyzer )
einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}"
local i
for i in "${symlinks[@]}"; do
# we need realpath on /usr/bin/* symlink return version-appended binary path.
# so /usr/bin/rustc should point to /usr/lib/rust/<ver>/bin/rustc-<ver>
# need to fix eselect-rust to remove this hack.
local ver_i="${i}-${PV%%_*}"
if [[ -f "${ED}/usr/lib/${PN}/${SLOT}/bin/${i}" ]]; then
einfo "Installing ${i} symlink"
ln -v "${ED}/usr/lib/${PN}/${SLOT}/bin/${i}" "${ED}/usr/lib/${PN}/${SLOT}/bin/${ver_i}" || die
else
ewarn "${i} symlink requested, but source file not found"
ewarn "please report this"
fi
dosym "../lib/${PN}/${SLOT}/bin/${ver_i}" "/usr/bin/${ver_i}"
done
# symlinks to switch components to active rust in eselect
dosym "${SLOT}/lib" "/usr/lib/${PN}/lib-${SLOT}"
use rust-analyzer && dosym "${SLOT}/libexec" "/usr/lib/${PN}/libexec-${SLOT}"
dosym "${SLOT}/share/man" "/usr/lib/${PN}/man-${SLOT}"
dosym "rust/${SLOT}/lib/rustlib" "/usr/lib/rustlib-${SLOT}"
dosym "../../lib/${PN}/${SLOT}/share/doc/rust" "/usr/share/doc/${P}"
newenvd - "50${P}" <<-_EOF_
MANPATH="${EPREFIX}/usr/lib/rust/man-${SLOT}"
_EOF_
rm -rf "${ED}/usr/lib/${PN}/${SLOT}"/*.old || die
rm -rf "${ED}/usr/lib/${PN}/${SLOT}/bin"/*.old || die
rm -rf "${ED}/usr/lib/${PN}/${SLOT}/doc"/*.old || die
# note: eselect-rust adds EROOT to all paths below
cat <<-_EOF_ > "${T}/provider-${PN}-${SLOT}"
/usr/bin/cargo
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
/usr/lib/rustlib
/usr/lib/rust/lib
/usr/lib/rust/man
/usr/share/doc/rust
_EOF_
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if [[ ${SLOT} == *9999* ]] && use miri; then
echo /usr/bin/miri >> "${T}/provider-${P}"
echo /usr/bin/cargo-miri >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
if use rust-analyzer; then
echo /usr/lib/rust/libexec >> "${T}/provider-${P}"
echo /usr/bin/rust-analyzer >> "${T}/provider-${P}"
fi
insinto /etc/env.d/rust
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi
}
pkg_postinst() {
eselect rust update
if has_version dev-debug/gdb || has_version llvm-core/lldb; then
elog "Rust installs helper scripts for calling GDB and LLDB,"
elog "for convenience they are installed under /usr/bin/rust-{gdb,lldb}-${PV}."
fi
if has_version app-editors/emacs; then
optfeature "emacs support for rust" app-emacs/rust-mode
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
optfeature "vim support for rust" app-vim/rust-vim
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -4,17 +4,15 @@
EAPI=8
LLVM_COMPAT=( 20 )
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{10..14} )
RUST_PATCH_VER=${PVR}
RUST_MAX_VER=${PV%%_*}
if [[ ${PV} == *9999* ]]; then
RUST_MIN_VER="1.86.0" # Update this as new `beta` releases come out.
RUST_MIN_VER="1.88.0" # Update this as new `beta` releases come out.
elif [[ ${PV} == *beta* ]]; then
# Enforce that `beta` is built from `stable`.
# While uncommon it is possible for feature changes within `beta` to result
# in an older snapshot being unable to build a newer one without modifying the sources.
# 'stable' releases should always be able to build a beta snapshot so just use those.
RUST_MAX_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).1"
RUST_MAX_VER="$(ver_cut 1).$(ver_cut 2).0"
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
else
RUST_MIN_VER="$(ver_cut 1).$(($(ver_cut 2) - 1)).0"
@ -25,11 +23,6 @@ inherit check-reqs estack flag-o-matic llvm-r1 multiprocessing optfeature \
if [[ ${PV} = *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rust-lang/rust.git"
EGIT_SUBMODULES=(
"*"
"-src/gcc"
)
elif [[ ${PV} == *beta* ]]; then
# Identify the snapshot date of the beta release:
# curl -Ls static.rust-lang.org/dist/channel-rust-beta.toml | grep beta-src.tar.xz
@ -37,6 +30,7 @@ elif [[ ${PV} == *beta* ]]; then
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SRC_URI="https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${BETA_SNAPSHOT}/rustc-beta-src.tar.xz.asc
-> rustc-${PV}-src.tar.xz.asc )
"
@ -44,6 +38,7 @@ elif [[ ${PV} == *beta* ]]; then
else
MY_P="rustc-${PV}"
SRC_URI="https://static.rust-lang.org/dist/${MY_P}-src.tar.xz
https://gitweb.gentoo.org/proj/rust-patches.git/snapshot/rust-patches-${RUST_PATCH_VER}.tar.bz2
verify-sig? ( https://static.rust-lang.org/dist/${MY_P}-src.tar.xz.asc )
"
S="${WORKDIR}/${MY_P}-src"
@ -70,7 +65,7 @@ done
LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4"
SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}"
if [[ ${PV} = *9999* ]]; then
# These USE flags require nightly rust
@ -172,12 +167,6 @@ RESTRICT="test"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/rust.asc
PATCHES=(
"${FILESDIR}"/1.85.0-cross-compile-libz.patch
"${FILESDIR}"/1.85.0-musl-dynamic-linking.patch
"${FILESDIR}"/1.67.0-doc-wasm.patch
)
clear_vendor_checksums() {
sed -i 's/\("files":{\)[^}]*/\1/' "vendor/${1}/.cargo-checksum.json" || die
}
@ -186,17 +175,38 @@ toml_usex() {
usex "${1}" true false
}
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
git-r3_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/config.toml" || die
touch "${S}/.cargo/bootstrap.toml" || die
local rust_stage0_root="$(${RUSTC} --print sysroot || die "Can't determine rust's sysroot")"
local rust_build=""
local rust_host=""
# Configure vendor to use the portage-provided toolchain. This prevents it from
# attempting to fetch a `beta` toolchain from the internet.
cat <<- _EOF_ > "${T}/vendor-config.toml"
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}")"]
@ -209,7 +219,7 @@ src_unpack() {
# to ensure that all dependencies are present and up-to-date
mkdir "${S}/vendor" || die
# This also compiles the 'build helper', there's no way to avoid this.
${EPYTHON} "${S}"/x.py vendor -vvv --config="${T}"/vendor-config.toml -j$(makeopts_jobs) ||
${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"
@ -303,9 +313,13 @@ pkg_setup() {
src_prepare() {
if [[ ${PV} = *9999* ]]; then
# We need to update / generate lockfiles for the workspace
${CARGO} generate-lockfile --offline
${CARGO} generate-lockfile --offline || die "Failed to generate lockfiles"
fi
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
@ -386,7 +400,9 @@ src_configure() {
build_channel="stable"
;;
esac
cat <<- _EOF_ > "${S}"/config.toml
cat <<- _EOF_ > "${S}"/bootstrap.toml
# Suppresses a warning about tracking changes which we don't care about.
change-id = "ignore"
# https://github.com/rust-lang/rust/issues/135358 (bug #947897)
profile = "dist"
[llvm]
@ -507,7 +523,7 @@ src_configure() {
export CFLAGS_${rust_target//-/_}="${arch_cflags}"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${rust_target}]
ar = "$(tc-getAR)"
cc = "$(tc-getCC)"
@ -517,14 +533,14 @@ src_configure() {
llvm-libunwind = "$(usex llvm-libunwind $(usex system-llvm system in-tree) no)"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
# by default librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true;
# but we patch it and set to false here as well
if use elibc_musl; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
crt-static = false
musl-root = "$($(tc-getCC) -print-sysroot)/usr"
_EOF_
@ -533,7 +549,7 @@ src_configure() {
if use wasm; then
wasm_target="wasm32-unknown-unknown"
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.wasm32-unknown-unknown]
linker = "$(usex system-llvm lld rust-lld)"
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
@ -581,7 +597,7 @@ src_configure() {
use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled"
command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain"
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
[target.${cross_rust_target}]
ar = "${cross_toolchain}-ar"
cc = "${cross_toolchain}-gcc"
@ -590,12 +606,12 @@ src_configure() {
ranlib = "${cross_toolchain}-ranlib"
_EOF_
if use system-llvm; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
llvm-config = "$(get_llvm_prefix)/bin/llvm-config"
_EOF_
fi
if [[ "${cross_toolchain}" == *-musl* ]]; then
cat <<- _EOF_ >> "${S}"/config.toml
cat <<- _EOF_ >> "${S}"/bootstrap.toml
musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr"
_EOF_
fi
@ -605,7 +621,7 @@ src_configure() {
# becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]'
rust_targets="${rust_targets},\"${cross_rust_target}\""
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die
sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" bootstrap.toml || die
ewarn
ewarn "Enabled ${cross_rust_target} rust target"
@ -633,13 +649,14 @@ src_configure() {
env | grep "CARGO_TARGET_.*_RUSTFLAGS="
env | grep "CFLAGS_.*"
echo
einfo "config.toml contents:"
cat "${S}"/config.toml || die
einfo "bootstrap.toml contents:"
cat "${S}"/bootstrap.toml || die
echo
}
src_compile() {
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -vvv --config="${S}"/config.toml -j$(makeopts_jobs) || die
# -v will show invocations, -vv "very verbose" is overkill, -vvv "very very verbose" is insane
RUST_BACKTRACE=1 "${EPYTHON}" ./x.py build -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
}
src_test() {
@ -680,7 +697,7 @@ src_test() {
for i in "${tests[@]}"; do
local t="src/test/${i}"
einfo "rust_src_test: running ${t}"
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \
if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv --config="${S}"/bootstrap.toml \
-j$(makeopts_jobs) --no-doc --no-fail-fast "${t}"
then
failed+=( "${t}" )
@ -695,7 +712,7 @@ src_test() {
}
src_install() {
DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
DESTDIR="${D}" "${EPYTHON}" ./x.py install -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
docompress /usr/lib/${PN}/${SLOT}/share/man/
@ -785,7 +802,7 @@ src_install() {
doins "${T}/provider-${PN}-${SLOT}"
if use dist; then
"${EPYTHON}" ./x.py dist -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die
"${EPYTHON}" ./x.py dist -v --config="${S}"/bootstrap.toml -j$(makeopts_jobs) || die
insinto "/usr/lib/${PN}/${SLOT}/dist"
doins -r "${S}/build/dist/."
fi

View File

@ -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"]=20
["1.88.0"]=20
["1.87.0"]=20
["1.86.0"]=19
["1.85.1"]=19
@ -94,6 +95,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.88.0"
"1.87.0"
"1.86.0"
"1.85.1"

View File

@ -12,3 +12,5 @@ DIST rustc-1.85.1-src.tar.xz 274028992 BLAKE2B 1dddbbc0d14fe9551fd2eb59a47521ac7
DIST rustc-1.86.0-src.tar.xz 275696736 BLAKE2B 9f33a710a3e567d92f56091920643f5ef2ddf2ad52acb5d9ee78496a7b5dbc10da5a51c72cf2a6f66d543a531d3138a49767c98501ae4e885e03988d2ccfbb59 SHA512 9ce195e24a03765f7163de16271e3d19d731d4b80fcc2bfd919106c9d42543eade018f712f6947ea3c6e57c6cb2e6841596aa668d608b8da15101a7da14f3097
DIST rustc-1.87.0-src.tar.xz 283604208 BLAKE2B 7ede723121ff8df3908674631ceaec75797d91ccd6f1df4afd7187878adbb8d99c9e8a3b11c6027703b2e8d06785299d93d8649f3eda7f356dd2a6734d99d05b SHA512 2ef08c9be45434401f916d54b3739f52d255f8a3a4ce05a717499250c2333eeaf601f1d18085b878c027c609f44da74d0151f5bfc2c9ae1e01166919a91a1d2b
DIST rustc-1.87.0-src.tar.xz.asc 801 BLAKE2B c9740c03baedcd70defba3fd37831692adaf0e984ef6b11d259244330d044fcacf935e6dd76caf126848da0c40f38e5368c60e8aabed5d3c2655a61fdbdc7564 SHA512 ebc13374381839a997c63455b733fd2a7960b4fd497f19c29be948cce8bb59a31ddda5da54ca154c16f7de43dd1bacd6c6bd76f3b6b36c5b43f4cfaf1746b952
DIST rustc-1.88.0_beta20250526-src.tar.xz 283223628 BLAKE2B 1c21853c0b7edcafd87713823888e04d336fb9c6cd373aa05218ae5d1ddc9c68b18c06dc27d059542ddfe91c0eb04cf523e4b3621b9bbbfad5d2f82e8d1cad1e SHA512 28f64ae8b1e907f7c4044d8a0148286f6e202677417ac3b4f2ce24ee9dba34369ba18d39e443cb982ee5f3b8afd94530580a62b8f5d5473954e976708f002357
DIST rustc-1.88.0_beta20250526-src.tar.xz.asc 801 BLAKE2B a412d72e4e0f273f03f3fee41abe1aeda03f77339891469e994f3a6bde0cd3836a1da087d908e732e90cd3285743a4a3c728c718ad1dda5daf7cca9de3be2c52 SHA512 45f208555f8b2fd3b21ac4cdc8fd7a110dc53fedbbe8d11542f105c5c8657a628309c8ff4520eb2c740cf3e784bfea0f21832b71b19a356b1b99fc7d0f04f607

View File

@ -0,0 +1,179 @@
# Copyright 2020-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..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
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
}