Switch mrustc to building rustc-1.54.

This commit is contained in:
Andrius Štikonas 2023-02-04 18:38:46 +00:00
parent fb042d582e
commit d8800ececd
18 changed files with 59 additions and 4415 deletions

View File

@ -36,3 +36,10 @@ Finally, we compile git snapshot of GNU Classpath which has a much better suppor
Then we compile a slightly patched ecj-4.2. Together with JamVM 2.0.0 this will serve as
Java environment that can bootstrap Icedtea 2 (Java 7). Then we use it to build Icedtea 3
and subsequent OpenJDK versions.
## Bootstrapping rust
We use `mrustc` to build rustc-1.54 and then we build each subsequent rustc version until
we reach up to date rustc.
mrustc is ocasionally broken on some versions of GCC. Last tested with GCC 12.2.1.

View File

@ -6,21 +6,6 @@ AUX 1.63.0-CVE-2022-36113.patch 2087 BLAKE2B 10afb960bf0624915f0047a364719cb7e59
AUX 1.63.0-CVE-2022-36114.patch 3877 BLAKE2B 3542b04ab488961a2928f1a2103845e786acbe46342265f5469ba32e4f0419d9ebf545a01d25b71f0ebc4ce82aadd038d28e270b8db1214d3e5134433239fa7e SHA512 bee9794c6caa5057a07109e5b37ff004893e8e5eae2cd8e01985d968e384599333ece619f48f24237d75dbb6a03363154319d72e08261baab398b32146f1efae
AUX 1.64.0-vendor-rustix-sparc-has-no-SIGSTKFLT.patch 2744 BLAKE2B 4eb03df7c21087a5833f031b85c999f95e8055492c61184bbe137407b4cdddb76d25f95d6beb5a1c6f82f42800f914f0fde60192c807a9548ee27ba226b10f65 SHA512 d489d0841ad297f8835b7adb1e5777865080f3f83a991da55a266da38396993c7b50f8ec98285ed7b174c879053670acedf9116b586c493338daac8f67741fb6
AUX llvm-gcc10.patch 1275 BLAKE2B 72b455bded7ab2d7e7bc3e75dcc2c5d3c2d23efb5ccc5f9fb229ceb8e08b61610cb6744ce617466f262b16d4b4c53cf1c27b85f4271b7cf9018b6c108c4bfc19 SHA512 62c35554453a75e558c8b4751f43bd9e06037318a89f7c8afd22a16f396a2777550d4ec3ab1347d63f2ecff483ec8aab65b2baa2c4838900b9e63cfeab780883
DIST rustc-1.39.0-src.tar.xz 96495140 BLAKE2B 6df6bf0c3b38c28753713acdc477ea6929740c32893171dd9b8620992439e45730ef6f9489a6fc411ff5884c661ac4c07b7b93f5a4174207ed53351d2dea09bf SHA512 8610b2ec77722087c572bd84ac562a5b7c5f1a644aea58c5d5daa07a9aed242703b7816e73e2eaa049f773d5907859e259744a0de700622df005584fd798dab0
DIST rustc-1.40.0-src.tar.xz 92306352 BLAKE2B 762b9592414e5c816540f6fd37d07b3b0ffe97a151968cc8ae77be2fda03a6d66905192985edc65055cc7811dbd90faa2b2c056481f72161c6f7ccbcce13671a SHA512 b5ac3079acefb62d3c985b77f624d7fb68de23a59396fed9ccb292db61641c064f3146ee54d3cf59067b17ebfaadd14a6b2b466def60316bb5b13ba3aef01e1f
DIST rustc-1.41.1-src.tar.xz 93754192 BLAKE2B 235ece650d0c75e1c8700ce73d3811997cd0d827b850a6dd435a269f3f86d85849d54755ea346c5ddcbe0d1224836fd78213f6abeab4a9a8c4c3e2d8a05ff7b4 SHA512 ef33565c9cf4e27ca279072bfed3301e0276c09407d49727640746ba78d289de285278d64b1cce8708461fd6c97c7ab2ea8d56e7a4c4a23b2e66e2d164c35fc9
DIST rustc-1.42.0-src.tar.xz 94186592 BLAKE2B 82298ef3da44188546bb945bcbfc1af630e6a4466b643667da08a04a33c6417afd68fc86302bdd22ab36c208fdb13cbc479e762d1217c05507bbfeb13bfbef7e SHA512 589bfdc92deedd33b8ea0df7f7c64c2a9a085fbea64936eff92f81e812309c060ed7a7adc96f6010d7adf62a68434a230da0f6c5b3540df4e0a5c6de05a31b16
DIST rustc-1.43.1-src.tar.xz 94405276 BLAKE2B 8679fe937abc4f758f3e35c2542d57cc1ad0bb72111597881873b30779b6e7b6711baa52493cb5ff954bf9cd31367b36db4e4fc8676635026059197a33659048 SHA512 24bb01237b1f3f5412109290bb4406b9742cf8956162f4090a98ed3a59a6e2e8dda399452bec1c93c8afdcf5effd98e4825e7f218238e0e88735c1ff4a5b385f
DIST rustc-1.44.1-src.tar.xz 94756856 BLAKE2B 60f536c3ba0fa1fec4b6333ee57809ee5226090ad5041c14a136b4356ff3b898062e06c3fe54effe873e27931ac8fcb902cd48a38615a8de7eebc6ecb3bdc2bd SHA512 1c17002edae844a710db9b144c17171416330dc565343c65af8a6e112fb61555e2025bb4cf33cac1229d7df689e6ff8858b91ae00552400ccacafaf1de11849b
DIST rustc-1.45.2-src.tar.xz 98683036 BLAKE2B a4102a5d4744b7ccc9b076aba00c39d69532f777e7d39e0e4ce2033b663b43e27b55034fdb3a1e13379fae9a16bff9e7748865a84507f7388ef0ebf9d421eac7 SHA512 cc6250c0bc844e77ca6dd7ae013e434ed3009b001914114866ed31f28edf3960221454d131e298b15050e3b8153fb8298d509559c2f7307c64611aa8e36b4d25
DIST rustc-1.46.0-src.tar.xz 101868452 BLAKE2B da9798596b124a10d79c236a871228f05e5f571d22c2259328e7026c91e088c85f5de9c0536a16531e0cb10477bfcd16d3ac11467979f5561cb6199442b877ef SHA512 099857f1d295043587a4e2a65ef3e6a90e12c8b6958e98535a1656c113c553f9a9b621aba8a19cf21bd8d2c79d27cbfa4b8e6fabbcb3cbfee23b545be7b450b4
DIST rustc-1.47.0-src.tar.xz 104143736 BLAKE2B 0454094dde35275488046826da87655e51bf0795481d6d08fd70d644bfc12481bca8641166106ef32f20494906025244715b16ff21a1c023f4bd2818aab42521 SHA512 6ba83c0158f8130ddeae7e070417a2121d8a548c8fe97e28bce116d84048636c75aaee78e0c92cd43a50f5679a1223fc226cc8c5ba9bbd1465e84c5c6034d5c9
DIST rustc-1.48.0-src.tar.xz 105951736 BLAKE2B 42468fc5ac5e80c4793cfe0913cbb8e43a8def28cc8cf5ed25ab989561e2bf33e155c83e180183362535cbc9008f341eb1273087a2364672b1a4032ac2d6ca45 SHA512 4e12baa6893238a8d336ec9ebe891477d18676f271b32763474fa7a6a8b58fb3187dd4e2aa95bce482989b692cc2e1360221669d6811eec71b326f22a1756c23
DIST rustc-1.49.0-src.tar.xz 108330280 BLAKE2B 65e36253482ded2df225cbbf15253b6c9a8ae935053b071d9fb9e7b1d47d5d3ac47a138876e4a5cfeda455c655ac06ceff2658c8668cef7d2206116906740653 SHA512 fd8bc67ec0a73d3b6bf9c1fabb7ea981ef817644b4e6ced982fa90b12eae9b55de074634a670bdfb38bfee6588603e818ddcbcc2f2a05f83057c061b4194b4b7
DIST rustc-1.50.0-src.tar.xz 108666272 BLAKE2B abb1b6f57093334bae5892dd99c964ffaf5e2b906cc92f0b92d5786cf80484cff923643169f24f4f92a5724c21b8bd671c72531c2cd1f6fbe0ea7107b5bd923b SHA512 df3c83c0fdc9ebce6fdccddda781dea0cdbd88d2b2a8220cac40cc3a8fa957923ae834d1fa45283d4ad227b334bd9e220e37a4a1ad7a1c7aeb806ed9ed387245
DIST rustc-1.51.0-src.tar.xz 109596164 BLAKE2B c1ac89655adfe7db8005476d42c748cf1896f52888141229fd6dda43855dbb08c21c8e1f11398d2f1f9dd5f8d508d9158a3bda4f1b282d1b184ea4c701100837 SHA512 ded91468ddf3e6627f00e7ec3d44452aa24eb727a183c0de9d90264f593119a54300d56b09251a88260db480b48554181ae195c538996a32d68d48b6587ac0df
DIST rustc-1.52.1-src.tar.xz 115109508 BLAKE2B c5d73f5884037d287d88ba9fdaf63a36678b692e1b510920045797ab29f1660f05cda901e19411ff83ec3084c4130034c269976b1056220f3e629cff116d07f0 SHA512 55f5053ce40d4eba4663052817aef6a6275139ca229c89cd1ec44711458b412720203301d8c7975aac5720a91fcaf21847f8184f641cbb0004f722520283c73c
DIST rustc-1.53.0-src.tar.xz 115686332 BLAKE2B fa068f89d42f927fdc79ee31aad1386eaf2aa596a060e059c5a1a73fe48c48d008fc952cd6c7912b743e41d77a94b205639eed0f728b2539b62f18a772cabfe3 SHA512 70485cf7a0f7fc36ee31644e546374079dc387a85b44e5e793707fd0a4d7ca05d311291e78b86db955485d8f21c47ff9e1908acc4da68ba04929287213a40c24
DIST rustc-1.54.0-src.tar.xz 116286856 BLAKE2B 5ac47822646a0b6205f09282168b4d4ddcace9f6bc8f242c890327ca4074626f129514f8bcae5c5556015745f718990cce490658076f5cd3526623439540416b SHA512 5162f85b43ca2c5af93fdbfb2597d75df8a838f7fcc025a5298499ce1043db50f1ea2fbba753e47ce5daad3d80d4b612acf6527ef902c34117763e687fdbbcfa
DIST rustc-1.55.0-src.tar.xz 117197580 BLAKE2B 8d9739ce7571146aee0e07c6287de9a8c4f1a914606cd47819eb1ef118b15772ecf22d0d43d7732f03c234a013fa54a4a7f0578a3f136af518f71bf64a03305d SHA512 7522f2fa95d5af92472404ecc97d7d9e745e88c933196a83fa373ce1efff6db3c295e0e2afdbfa1ff00644554efa0c3c7f6c11f9119ecf9010cb440b3f27c2da
DIST rustc-1.56.1-src.tar.xz 121798264 BLAKE2B 09677b0332022f28a0d80949a6735929dbf64276f7eb57195d8c33e6c80f13c903432ff77d8834093ab551677618fb1d385f2300e2b1b4c064f9c245c696be32 SHA512 193468e211cde9ebc5f6e30b8e3733b79bd8710fe6dd45c7ed8d4392f91010d30466787afd4d0b2041cd7dd994924fee8ad111048824e248bd994959e55bf15f
@ -37,22 +22,7 @@ DIST rustc-1.62.1-src.tar.xz 135644156 BLAKE2B ff8428362153770c57d53cb7eef07b759
DIST rustc-1.62.1-src.tar.xz.asc 801 BLAKE2B dd0e917f8b587eb8318a9c820df5ee9a052f14e7dea05d8afcb3cf687fa2e362e6d2f4d20fa94a19bdf97227c9ef29548a6e267ffd9113bfdc36cc42f341d8b8 SHA512 698bfd419c218a6cccce04869279708cf6084adc464a64d7dd1c981c0577249cd06b4de132634085c792c838aa1e1beaa11a5a06ea0e5f4c1a6f4e28afe65a3c
DIST rustc-1.63.0-src.tar.xz 136597192 BLAKE2B 52eb64ee11e7d9724a4c2654f7eea13521959ac5e04a4925eed5c89ec3661a7827146d6f9a9d05c98466bd4b74393af7bb18d9f418c785924f559833434dfe38 SHA512 0dd3cd1546bd9c1438afe0c4694e1ed80507f6b437674682c0474e13f83457e9ced4560ddeee58602e01837140f9e34a9e24c6828643dd6f613e07755af6997c
DIST rustc-1.63.0-src.tar.xz.asc 801 BLAKE2B b6c133768e368a7aeb0a4612a4c824d13f91ccdca6660feb5774ed6d79537084020780532c882ae3c9e4b6be3d36ceb0652eb134a580293ba8d8be74c4ba3c6e SHA512 f8807d46b9a3ca2a15a60f8062d63b3ee6e3210657cc752c948b3c7aa1626ec63cbd57529d010ad33f07ac47cf70dbf2cb50f200587338f77c631fc9e6786b17
EBUILD rust-1.39.0.ebuild 2847 BLAKE2B a3ff9f99bf5b5eac3729c42205273017dbb21bf7357de356e27faa68ac19ec07979a81b0f516b84cdba811d350c880784d06dcebc168b1c0e604f7a47ec87a9d SHA512 335aebac62829222a7a7194613be3357d9248f6e765eda8e63f5c2ebd1ec12eb35c03207f8a2ef26b35e73cd32df62f6cb89acd04ffe098b8d5d53916f126c3a
EBUILD rust-1.40.0.ebuild 7700 BLAKE2B 15068eb63f34d38b7c9017ef68d5b51c975526d6910ca90b74e92baf35591e84d798ba94e50d06a91a2127f74a907a6016b61f8e1500ba09a6929cfe25eed9a1 SHA512 f48e2ae7cef724ffa3fb15ad279105c71ca257ad8e76f323b6c21cb2f7eb20b838c4e544a32c0a546d66506522a55a833d5496a4e40ed24187a8f33822d83362
EBUILD rust-1.41.1.ebuild 7700 BLAKE2B 15068eb63f34d38b7c9017ef68d5b51c975526d6910ca90b74e92baf35591e84d798ba94e50d06a91a2127f74a907a6016b61f8e1500ba09a6929cfe25eed9a1 SHA512 f48e2ae7cef724ffa3fb15ad279105c71ca257ad8e76f323b6c21cb2f7eb20b838c4e544a32c0a546d66506522a55a833d5496a4e40ed24187a8f33822d83362
EBUILD rust-1.42.0.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.43.1.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.44.1.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.45.2.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.46.0.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.47.0.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.48.0.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.49.0.ebuild 7661 BLAKE2B 9221039f6aba7efede53466068887656638cc1e4ffdd990d92c58454a1b31c7e9ca2b5cc4639009482e657ba45d60a86724ab9263a56d28f298cccf53d4d95e9 SHA512 71185b984625ecdb7e80182039079ef46ad58b581bbd9571eab8f119dbb7f8de2ea9ad89f13d93df064421db547ab988d73ef540bbdb13a4051c18613d68dcb3
EBUILD rust-1.50.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.51.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.52.1.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.53.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.54.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.54.0.ebuild 3213 BLAKE2B 962d93d4f9dfea0a7860e8212e834b7021f27f8b42de5df8deee57a3af5b8b29ac2ce96732b06b2fe49531dddc1591d818f8723ba96d6fb57dc2808461ed6ffc SHA512 df1168b2a54a8b09dad7d8625e3bb5d9016ef3deb3fa483d2e53323efcfbefc87da91d573e7256b4625c6254dd294b10c1bbacd897e985a369cb3d4c6ad97ccf
EBUILD rust-1.55.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.56.1.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad
EBUILD rust-1.57.0.ebuild 7655 BLAKE2B cfc5e269dcf0df798d76b82896f172e92217f997977d01c3c162e7d24155c0b649aeb0aaf7f05202715b91d0d801f93a32eeeb654ec026a5eeacfeb273b9f844 SHA512 90f1684da68891f689896f1317dddb1971b9893a0ca07d3f1fbffd88270e5dc17210948516d17d8e204bf4b34cbf03d690731a1d5d0ebccf5a25963f42335dad

View File

@ -1,77 +0,0 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic git-r3 llvm rust-toolchain
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
# MRUSTC_VERSION="0.9"
EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
EGIT_COMMIT="8f7baf68165571d381ddb47bef19eb4cd672924c"
SRC_URI="
https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz"
# https://github.com/thepowersgang/mrustc/archive/v${MRUSTC_VERSION}.tar.gz
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
SLOT="stable/1.39"
KEYWORDS="amd64"
DEPEND="
dev-util/cmake
sys-process/time
"
RDEPEND=""
LLVM_TARGETS="AArch64;ARM;X86"
S=${WORKDIR}/mrustc-${MRUSTC_VERSION}
RUSTC_VERSION=1.39.0
MRUSTC_TARGET_VER=1.39
OUTDIR_SUF=-1.39.0
src_unpack() {
git-r3_fetch "${EGIT_REPO_URI}" "${EGIT_COMMIT}"
git-r3_checkout "${EGIT_REPO_URI}" "${S}"
unpack ${A}
mv rustc-${PV}-src ${S}
}
src_prepare() {
cd ${S}
cd ${S}/rustc-${PV}-src
eapply -p0 ${S}/rustc-${PV}-src.patch
eapply_user
}
src_configure() {
default
}
src_compile() {
emake RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) -f minicargo.mk LIBS || die "compile problem"
emake RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) -f minicargo.mk || die "compile problem"
emake RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) -f minicargo.mk "output${OUTDIR_SUF}/rustc" || die "compile problem"
emake RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) LIBGIT2_SYS_USE_PKG_CONFIG=1 -f minicargo.mk "output${OUTDIR_SUF}/cargo" || die "compile problem"
cd run_rustc
# -j1 workaround for broken jobserver
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) || die "compile problem"
}
src_install() {
mkdir -p "${D}/usr/bin/"
rustc_wrapper="${S}/run_rustc/output${OUTDIR_SUF}/prefix/bin/rustc"
sed -i '/LD_LIBRARY_PATH/c\LD_LIBRARY_PATH="$d\/..\/lib\/rustlib\/'$(rust_abi)'\/lib" $d\/rustc_binary $@' ${rustc_wrapper}
cp -R "${rustc_wrapper}" "${D}/usr/bin/rustc-${PV}" || die "Install failed!"
cp -R "${S}/run_rustc/output${OUTDIR_SUF}/prefix/bin/rustc_binary" "${D}/usr/bin/rustc_binary" || die "Install failed!"
cp -R "${S}/run_rustc/output${OUTDIR_SUF}/prefix/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die "Install failed!"
cp -R "${S}/run_rustc/output${OUTDIR_SUF}/prefix/lib" "${D}/usr" || die "Install failed!"
mkdir -p "${D}/etc/env.d/rust/"
echo /usr/bin/cargo >> "${D}/etc/env.d/rust/provider-rust-${PV}"
}

View File

@ -1,290 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
eapply "${FILESDIR}/llvm-gcc10.patch"
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,290 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
eapply "${FILESDIR}/llvm-gcc10.patch"
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
dobashcomp build/tmp/dist/cargo-image/etc/bash_completion.d/cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
}
src_prepare() {
default
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
}

View File

@ -1,289 +1,81 @@
# Copyright 1999-2021 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{7..9} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
if [[ ${PV} = *beta* ]]; then
betaver=${PV//*beta}
BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}"
MY_P="rustc-beta"
SLOT="beta/${PV}"
SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz"
else
ABI_VER="$(ver_cut 1-2)"
SLOT="stable/${ABI_VER}"
MY_P="rustc-${PV}"
SRC="${MY_P}-src.tar.xz"
KEYWORDS="amd64 ~arm ~arm64 ~ppc64 ~x86"
fi
inherit flag-o-matic git-r3 llvm rust-toolchain
DESCRIPTION="Systems programming language from Mozilla"
HOMEPAGE="https://www.rust-lang.org/"
SRC_URI="https://static.rust-lang.org/dist/${SRC} -> rustc-${PV}-src.tar.xz"
MRUSTC_VERSION="0.10"
EGIT_REPO_URI="https://github.com/thepowersgang/mrustc.git"
EGIT_COMMIT="1b1416bb2b44e2c331c7201833305cac29d571e8"
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore )
ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
SRC_URI="
https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz"
#https://github.com/thepowersgang/mrustc/archive/v${MRUSTC_VERSION}.tar.gz"
LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
IUSE="clippy cpu_flags_x86_sse2 debug doc libressl rls rustfmt ${ALL_LLVM_TARGETS[*]}"
# Please keep the LLVM dependency block separate. Since LLVM is slotted,
# we need to *really* make sure we're not pulling more than one slot
# simultaneously.
# How to use it:
# 1. List all the working slots (with min versions) in ||, newest first.
# 2. Update the := to specify *max* version, e.g. < 10.
# 3. Specify LLVM_MAX_SLOT, e.g. 9.
LLVM_DEPEND="
|| (
sys-devel/llvm:9[llvm_targets_WebAssembly?]
)
<sys-devel/llvm-10:=
"
LLVM_MAX_SLOT=9
BOOTSTRAP_DEPEND=">=dev-lang/rust-1.$(($(ver_cut 2) - 1))"
COMMON_DEPEND="
sys-libs/zlib
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
net-libs/libssh2
net-libs/http-parser:=
net-misc/curl[ssl]
SLOT="stable/1.54"
KEYWORDS="amd64"
DEPEND="
dev-util/cmake
sys-process/time
"
DEPEND="${COMMON_DEPEND}
${PYTHON_DEPS}
|| (
>=sys-devel/gcc-4.7
>=sys-devel/clang-3.5
)
${BOOTSTRAP_DEPEND}
"
RDEPEND=""
RDEPEND="${COMMON_DEPEND}
>=app-eselect/eselect-rust-20190311
"
LLVM_TARGETS="AArch64;ARM;X86"
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
x86? ( cpu_flags_x86_sse2 )
"
S=${WORKDIR}/mrustc-${MRUSTC_VERSION}
QA_FLAGS_IGNORED="
usr/bin/*-${PV}
usr/lib*/lib*.so
usr/lib/rustlib/*/codegen-backends/librustc_codegen_llvm-llvm.so
usr/lib/rustlib/*/lib/lib*.so
"
RUSTC_VERSION=1.54.0
MRUSTC_TARGET_VER=1.54
OUTDIR_SUF=
QA_SONAME="usr/lib.*/librustc_macros.*.so"
S="${WORKDIR}/${MY_P}-src"
toml_usex() {
usex "$1" true false
}
pre_build_checks() {
CHECKREQS_DISK_BUILD="9G"
eshopts_push -s extglob
if is-flagq '-g?(gdb)?([1-9])'; then
CHECKREQS_DISK_BUILD="14G"
fi
eshopts_pop
check-reqs_pkg_setup
}
pkg_pretend() {
pre_build_checks
}
pkg_setup() {
pre_build_checks
python-any-r1_pkg_setup
src_unpack() {
git-r3_fetch "${EGIT_REPO_URI}" "${EGIT_COMMIT}"
git-r3_checkout "${EGIT_REPO_URI}" "${S}"
unpack ${A}
mv rustc-${PV}-src ${S}
}
src_prepare() {
default
cd ${S}
cd ${S}/rustc-${PV}-src
eapply -p0 ${S}/rustc-${PV}-src.patch
sed -i 's/ $(RUSTC_SRC_DL)//' "${S}/minicargo.mk"
eapply_user
}
src_configure() {
local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\""
done
rust_targets="${rust_targets#,}"
local extended="true" tools="\"cargo\","
if use clippy; then
tools="\"clippy\",$tools"
fi
if use rls; then
tools="\"rls\",\"analysis\",\"src\",$tools"
fi
if use rustfmt; then
tools="\"rustfmt\",$tools"
fi
local rust_stage0_root
rust_stage0_root="$(rustc --print sysroot)"
rust_target="$(rust_abi)"
cat <<- EOF > "${S}"/config.toml
[llvm]
optimize = $(toml_usex !debug)
release-debuginfo = $(toml_usex debug)
assertions = $(toml_usex debug)
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
[build]
build = "${rust_target}"
host = ["${rust_target}"]
target = [${rust_targets}]
cargo = "${rust_stage0_root}/bin/cargo"
rustc = "${rust_stage0_root}/bin/rustc"
docs = $(toml_usex doc)
compiler-docs = $(toml_usex doc)
submodules = false
python = "${EPYTHON}"
locked-deps = true
vendor = true
extended = ${extended}
tools = [${tools}]
verbose = 2
[install]
prefix = "${EPREFIX}/usr"
libdir = "lib"
docdir = "share/doc/${PF}"
mandir = "share/man"
[rust]
optimize = $(toml_usex !debug)
debug = $(toml_usex debug)
debug-assertions = $(toml_usex debug)
default-linker = "$(tc-getCC)"
channel = "stable"
rpath = false
lld = false
[dist]
src-tarball = false
EOF
for v in $(multilib_get_enabled_abi_pairs); do
rust_target=$(rust_abi $(get_abi_CHOST ${v##*.}))
arch_cflags="$(get_abi_CFLAGS ${v##*.})"
cat <<- EOF >> "${S}"/config.env
CFLAGS_${rust_target}=${arch_cflags}
EOF
cat <<- EOF >> "${S}"/config.toml
[target.${rust_target}]
cc = "$(tc-getBUILD_CC)"
cxx = "$(tc-getBUILD_CXX)"
linker = "$(tc-getCC)"
ar = "$(tc-getAR)"
EOF
done
default
}
src_compile() {
env $(cat "${S}"/config.env)\
"${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) \
--exclude src/tools/miri || die # https://github.com/rust-lang/rust/issues/52305
emake RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) || die "compile problem"
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) -f minicargo.mk LIBS || die "compile problem"
RUSTC_TARGET=$(rust_abi) || die "compile problem"
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) test || die "compile problem"
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) local_tests || die "compile problem"
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) RUSTC_INSTALL_BINDIR=bin -f minicargo.mk "output/rustc" || die "compile problem"
emake -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) LIBGIT2_SYS_USE_PKG_CONFIG=1 -f minicargo.mk "output${OUTDIR_SUF}/cargo" || die "compile problem"
emake -C run_rustc -j1 RUSTC_VERSION=${RUSTC_VERSION} MRUSTC_TARGET_VER=${MRUSTC_TARGET_VER} OUTDIR_SUF=${OUTDIR_SUF} RUSTC_TARGET=$(rust_abi) || die "compile problem"
}
src_install() {
env DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml \
--exclude src/tools/miri || die
# bug #689562, #689160
rm "${D}/etc/bash_completion.d/cargo" || die
rmdir "${D}"/etc{/bash_completion.d,} || die
newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo
mv "${ED}/usr/bin/rustc" "${ED}/usr/bin/rustc-${PV}" || die
mv "${ED}/usr/bin/rustdoc" "${ED}/usr/bin/rustdoc-${PV}" || die
mv "${ED}/usr/bin/rust-gdb" "${ED}/usr/bin/rust-gdb-${PV}" || die
mv "${ED}/usr/bin/rust-gdbgui" "${ED}/usr/bin/rust-gdbgui-${PV}" || die
mv "${ED}/usr/bin/rust-lldb" "${ED}/usr/bin/rust-lldb-${PV}" || die
mv "${ED}/usr/bin/cargo" "${ED}/usr/bin/cargo-${PV}" || die
if use clippy; then
mv "${ED}/usr/bin/clippy-driver" "${ED}/usr/bin/clippy-driver-${PV}" || die
mv "${ED}/usr/bin/cargo-clippy" "${ED}/usr/bin/cargo-clippy-${PV}" || die
fi
if use rls; then
mv "${ED}/usr/bin/rls" "${ED}/usr/bin/rls-${PV}" || die
fi
if use rustfmt; then
mv "${ED}/usr/bin/rustfmt" "${ED}/usr/bin/rustfmt-${PV}" || die
mv "${ED}/usr/bin/cargo-fmt" "${ED}/usr/bin/cargo-fmt-${PV}" || die
fi
# Move public shared libs to abi specific libdir
# Private and target specific libs MUST stay in /usr/lib/rustlib/${rust_target}/lib
if [[ $(get_libdir) != lib ]]; then
dodir /usr/$(get_libdir)
mv "${ED}/usr/lib"/*.so "${ED}/usr/$(get_libdir)/" || die
fi
dodoc COPYRIGHT
# note: eselect-rust adds EROOT to all paths below
cat <<-EOF > "${T}/provider-${P}"
/usr/bin/rustdoc
/usr/bin/rust-gdb
/usr/bin/rust-gdbgui
/usr/bin/rust-lldb
EOF
echo /usr/bin/cargo >> "${T}/provider-${P}"
if use clippy; then
echo /usr/bin/clippy-driver >> "${T}/provider-${P}"
echo /usr/bin/cargo-clippy >> "${T}/provider-${P}"
fi
if use rls; then
echo /usr/bin/rls >> "${T}/provider-${P}"
fi
if use rustfmt; then
echo /usr/bin/rustfmt >> "${T}/provider-${P}"
echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
fi
dodir /etc/env.d/rust
insinto /etc/env.d/rust
doins "${T}/provider-${P}"
}
pkg_postinst() {
eselect rust update --if-unset
elog "Rust installs a helper script for calling GDB and LLDB,"
elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}."
ewarn "cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo."
ewarn "This might have resulted in a dangling symlink for /usr/bin/cargo on some"
ewarn "systems. This can be resolved by calling 'sudo eselect rust set ${P}'."
if has_version app-editors/emacs; then
elog "install app-emacs/rust-mode to get emacs support for rust."
fi
if has_version app-editors/gvim || has_version app-editors/vim; then
elog "install app-vim/rust-vim to get vim support for rust."
fi
}
pkg_postrm() {
eselect rust cleanup
mkdir -p "${D}/usr/"{bin,lib}/
rustc_wrapper="${S}/run_rustc/output/prefix/bin/rustc"
sed -i '/LD_LIBRARY_PATH/c\LD_LIBRARY_PATH="$d\/..\/lib\/rustlib\/'$(rust_abi)'\/lib" $d\/rustc_binary $@' ${rustc_wrapper}
cp -R "${rustc_wrapper}" "${D}/usr/bin/rustc-${PV}" || die "Install failed!"
cp -R "${S}/run_rustc/output/prefix/bin/rustc_binary" "${D}/usr/bin/rustc_binary" || die "Install failed!"
cp -R "${S}/run_rustc/output/prefix/bin/cargo" "${D}/usr/bin/cargo-${PV}" || die "Install failed!"
cp -R "${S}/run_rustc/output/prefix/lib/rustlib" "${D}/usr/lib/rustlib" || die "Install failed!"
mkdir -p "${D}/etc/env.d/rust/"
echo /usr/bin/cargo >> "${D}/etc/env.d/rust/provider-rust-${PV}"
}