From 752d6256e5204b958b0ef7905675a940b5e9172f Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 12 May 2022 16:42:50 +0300 Subject: gentoo resync : 12.05.2022 --- sys-devel/clang/Manifest | 24 +- sys-devel/clang/clang-11.1.0.ebuild | 428 ------------------------------ sys-devel/clang/clang-13.0.0.ebuild | 421 ----------------------------- sys-devel/clang/clang-13.0.1.ebuild | 2 +- sys-devel/clang/clang-14.0.0-r1.ebuild | 430 ------------------------------ sys-devel/clang/clang-14.0.1-r1.ebuild | 433 ++++++++++++++++++++++++++++++ sys-devel/clang/clang-14.0.1.ebuild | 433 ------------------------------ sys-devel/clang/clang-14.0.3.ebuild | 440 +++++++++++++++++++++++++++++++ sys-devel/clang/clang-15.0.0.9999.ebuild | 23 +- 9 files changed, 897 insertions(+), 1737 deletions(-) delete mode 100644 sys-devel/clang/clang-11.1.0.ebuild delete mode 100644 sys-devel/clang/clang-13.0.0.ebuild delete mode 100644 sys-devel/clang/clang-14.0.0-r1.ebuild create mode 100644 sys-devel/clang/clang-14.0.1-r1.ebuild delete mode 100644 sys-devel/clang/clang-14.0.1.ebuild create mode 100644 sys-devel/clang/clang-14.0.3.ebuild (limited to 'sys-devel/clang') diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest index dea4adc8b94e..6ccf77dea211 100644 --- a/sys-devel/clang/Manifest +++ b/sys-devel/clang/Manifest @@ -1,27 +1,19 @@ -DIST llvm-11.1.0-manpages.tar.bz2 191571 BLAKE2B d6f8e1390dd3e6e8bbcd66c0079ef89f2ff3479743499c36ab32f8bc8281631a96113df9a87f6284058365950f4df3c75dacfcc11920fc5ea7ef0233ba842b77 SHA512 2543e519f51cc7ecb51a732c658ec5d35c5225e30a677f24ead75e81fb1ab793a030e79f21d0b702a2cf6ab6da1a2cba839b49a98e1b0a36384e98076ed5c4b1 DIST llvm-12.0.1-manpages.tar.bz2 191582 BLAKE2B a049cd305c257875d47e92d703c51aee8225854f999eddbd530c7a978704a981b05bc0819ba31a2f2a218d3569b078f0deb01b0eeb385966253b54a0fdc090d1 SHA512 9931a57f843709aed59193524fe980af695e4e23c8f53ec3cff308677ba4fc520ca58032b50b68440c7762305855317d9a705fe5ccbb543fb104f4deb5d10ea5 -DIST llvm-13.0.0-manpages.tar.bz2 202595 BLAKE2B 1a3a389e8c544675f7ba2692f92bb82a83beabd6c595211806ef7f473e1741ea633a773edf623011d3d011ef2ee7a1611fc9620fe921eeebe1b99c3b8b3a0652 SHA512 344139f3123169776e0fd603e605bbf537d15d80ff56ad60e66ed1639a9dec53a8ac5cd088c8e14c8b7a799b563268445562293ba1d4efeb8db438cbd9cb5fb0 DIST llvm-13.0.1-manpages.tar.bz2 202187 BLAKE2B 32a761426dbe4c3c355d30660254305cd88b6d513faee04c78e370cea9d38761108a9be4c4b4ac39b6a74400af1f9d37ffd11ab05acd7340175c8d66845ae7d9 SHA512 9495e1daf588540fdb8b9ee905a9b6be4693bd70b7f42c8e8a0d667242fc24dc853c45918d3bc09d02f0761ad61541bc9749c1498e312da129abdab638a0d572 -DIST llvm-14.0.0-manpages.tar.bz2 214111 BLAKE2B b35672d5a33b02ed5935352bf7a9094655a58bdb698b09277016751f5b80248624c254d6116756436017971bb78ee6acedea9ce5d8218dafeffb901ef7ac5c62 SHA512 cd84772d7ec277d0a6c58baf82e524d64a246816df018e99d8db34ec49dcf4c79cc4ce3b99daaa23ca58b837c42848dc779039ea47b783aa0e6675f33ea7256d DIST llvm-14.0.1-manpages.tar.bz2 86273 BLAKE2B 174b412568565bdd4c3db34b1b2f2482a18ca45a0a6269ca381fe5c77da21b85dafabad29551b262d593006e9b68e6f7fdf43c2ec626204970d1280dd87a5f3d SHA512 49c58094eebecfadff97d62b4e6b0129e07c52ad7fe3ea4ce5c955e6fc9c73ac443b6a6e0f8322cf25e1d88b059c4231c4798d8da04340a46f6f84fb1b386f29 -DIST llvm-gentoo-patchset-11.1.0-1.tar.xz 4032 BLAKE2B e69138a422e315b31a3d9c11faa4ae1ddf1bf9092cee2db0de4d2adef81fd802973488293aab48b764402b51996893b17ca03249ef4620848a576d1f6cdb9698 SHA512 e1c5504dab6c5db9fdf4addfeb12316f22d0258717ba551a9b7b3ba37919491fb6011ac5cca1e793b7509d5c1c186bc6bc4213f7d6155d190612492b216f979b +DIST llvm-14.0.3-manpages.tar.bz2 217443 BLAKE2B ebea48d9015bb0b53e8b799d8d79ac7a8d03f55440e5d3a08a9ce6c8f106c3f37e597c46aaf824dfee87c222775630299a5c277b4b29d43e831116c12932675a SHA512 db762ff7bfde28147276cacb5c5753a1bb4dd08dc8840423d6fc073629cd97bc3c7f54402cb17aa00cfc06f9f775f7ac9478c2661cacf86d5517a968d290beb3 DIST llvm-gentoo-patchset-12.0.1.tar.xz 5280 BLAKE2B 963d005bc7b636570be90eb841ac5bcaeb927538cc7de27683167111a17d6496677c7517de2ecfaf14b5d8ac22bad357be490b8a2ed9aba502fd5f447ecc99e9 SHA512 fc7c38e671555751650299c3a8bee44d5c7f26e11b68d5538c507fb7fe9ff2d349bdcd43bce90a448a747f082d523b3849d6bcda5e3ae2e998edcb926d6aa249 -DIST llvm-gentoo-patchset-13.0.0.tar.xz 5012 BLAKE2B 6760c78c086aaf6629143fd920b0a2c68cad9278628fbea8164dfeb59db95984a5b5d6b3505b510c697e8c95bf8d2be782c6b73c01622d52f2da9b07ecff39e0 SHA512 7764d49343b795b6bebae64f646ba27e3e6cc2a20b8a1aee645ce0d8474633c34acfbb73c08546fee415755dd4ea5a98c1d84db5e394cf5f4fc802eb61148ab6 DIST llvm-gentoo-patchset-13.0.1.tar.xz 6288 BLAKE2B 899222b962486e924e4f8a2b574d285531a3f87af9385ff68c81db92aa224a0cde6d4ee049b5405056bedb4b232b50e1d5840024071a4a215f6311853304c92d SHA512 b2805337f1deca626768a44c5e7ac9ed16e0c31bead1647d44a493a8123c1b8e8f1c8ceee3536bcc6fa87fdd3fcec408229f701adf30eff07e7ef9889b847b01 -DIST llvm-gentoo-patchset-14.0.0-r1.tar.xz 5500 BLAKE2B b8ddbf41f70fbe9293a9fb81617e0893647233a61c4e34f8861f37526325893188cdf734b5349c7d06f5f23311536b95a3232af39eb4eb4f509386d022747842 SHA512 a0c93137ce0ae1bd111276c114f24c248cb800eb6d3c6cbc7b2c9658fbcde20d66c060b05535d9ae40d046e37cae81a27b8a4f7c27f718ccb39b3314f92577cd -DIST llvm-gentoo-patchset-14.0.1.tar.xz 4724 BLAKE2B 2689298c687fa8b5fa2545afccc248c00ff6778f1a14e3e7999e5d52a1b0b9c3b2e66e8c008e27c62c6c3c08009dc7d9d083ca53698138258ac972e4ad03c042 SHA512 a9f071ad0a792f558105a64790f9e470d8aaed05bd1baabbe86539760c881f772602a03265e0962d8599f991f7fd44d14a49e2ef9d74bb5eb283f473f4084d32 +DIST llvm-gentoo-patchset-14.0.1-r1.tar.xz 6132 BLAKE2B c99f57a09f214361f2728938ec587e3ef0b473363919058e39fb75c012cc94771b9116b1820f1bd001151eb5f49cc6beaa7572e60e4095811fffb12717a8c5a8 SHA512 af9eca93c9ba91429b0bb07290dce1c9742338dd0635423bc59ebead91a7493a49b66bd36a7ce4cf715fa660678218f64e0ba85824a0869b8e31b81be9f0bb3d +DIST llvm-gentoo-patchset-14.0.3.tar.xz 5492 BLAKE2B 48a46d50a81c5572d1573c6923bc404b198f74ee8587a928e0858553dac37f7fa39cc969d72b938ef3d2f04f6872f9e2e2478821ab90c657ecbbacb3f7d99d7a SHA512 b917b549de6d46cd7aab3e59b888b5e5ffb955435b33d6538be2f31dc30217a24740a673cb6bb661087c245121edb079052b179badaf70b86b985ca69b3652a6 DIST llvm-gentoo-patchset-9999-r3.tar.xz 4076 BLAKE2B 30bdf740606a1718ae45d850803385d425b656fbbe0250f587cad54f55272e3617d5ee0d04f534a58f87408b0a2dea322ebf1bb8cd653a2beba21d0bc5778c62 SHA512 2c7080ffd09d7dcf4c72a97044a5c63ab895250721d60270bc51c2095aef5f9039781892b4c0d14e942611686153f874a1f52a1c854bb8ca093383c08bdc005a -DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45ca1c93b64fa4c6ebcd70a1d3849dbad2b8e4e24fba02d144c6266d7fab3607ebc6999b28c229cb35256cf40f26a985 SHA512 9a8ce022a935eed42fa71a224f2a207122aadcbef58ee855fdb4825f879e7d028e4dcff22c19b9d336db1c8bf63fb84372d44981acf84615f757e54306c92b81 DIST llvmorg-12.0.1.tar.gz 134259748 BLAKE2B f41de787bc73ff2edfda1b22cc8602be6f65f37dd9e4c8888533cfa8c3ccdcf4f108aaab9de23ab0ab987966eb160f2a553a0bdff99461e71ddd5bfcd086090d SHA512 6eb0dc18e2c25935fabfdfc48b0114be0939158dfdef7b85b395fe2e71042672446af0e68750aae003c9847d10d1f63316fe95d3df738d18f249174292b1b9e1 -DIST llvmorg-13.0.0.tar.gz 147270176 BLAKE2B 628f316b580e1edf3a58d4825b724df759e6ed2a4116802470c04562caefc392fa325c91f388036365a2e45a9595cca6d3557fab12984fc8bcfef29c9116d822 SHA512 8004c05d32b9720fb3391783621690c1df9bd1e97e72cbff9192ed88a84b0acd303b61432145fa917b5b5e548c8cee29b24ef8547dcc8677adf4816e7a8a0eb2 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f -DIST llvmorg-14.0.0.tar.gz 158057350 BLAKE2B 7052684c620a5eaf52beeee4591adf58cfec9e64a5ee0b24f3d5849fd4df5b006e2906a839cb806ac69c33fab6013c58589b1d74e4fb8558758edcb7d5065064 SHA512 eb5acf96b5e2c59bd07579f7ebe73018b0dd6e2f2d9a5a3c7986320e88febd837d1084b9e5313a2264310342193044629d228337cc76dd2b8527dc0a8bdda999 DIST llvmorg-14.0.1.tar.gz 158074615 BLAKE2B bf80366461580058494eb101646efcd1a8b55a66818a710c2eb8c649bf88c02fe4552cecf4c1c8637a64e7cee8d644bca31aafc804765ed18f2b5e2975dd6c92 SHA512 0a15aa9cfc978a7b03a1659a2affad65ede66d280f5c12bf0beaaf194cd7bdd57ff438b5f40e64c1e1b88f368de99be349e9d30b544d2bbe4a50f0ebed3307f2 -EBUILD clang-11.1.0.ebuild 11573 BLAKE2B adb4fc733f04605c63c711d3b9c9ce3358108efd013bcda58fe776dd5be0f978475dc686bfa2ca1c22bece3e13f60e412e33ebcd907e1e08d27932e254f6996a SHA512 a6fe29ca8c599f022147aae1fe8c0af8aacf33de2f02c19c9850bc06147f968cb579070c2a6763615cf04740c131719e17495b07b8f2ba9d32874587a2e20784 +DIST llvmorg-14.0.3.tar.gz 158092596 BLAKE2B ef901df510ec6bc1242595ec330e9c9ee76e696b077d67a8d62b53608c3d18b2f2d7ea3150864e13d9b37a8ce899ebca946ebe72cbc4538700176e20859ddec2 SHA512 511e93fd9b1c414c38fe9e2649679ac0b16cb04f7f7838569d187b04c542a185e364d6db73e96465026e3b2533649eb75ac95507d12514af32b28bdfb66f2646 EBUILD clang-12.0.1.ebuild 11726 BLAKE2B 2dca51da0a8683bac8cf7b0d3a45cbe97e829b6699b25c477245fa7c891b899ae2cdc40a0e628f4f3830fb18bfeb2ce5b9493651c6498c841986018f5ded69b6 SHA512 c7e81f72c28ea11e698ecfab7bc3075002503105df65d938a87079b1d28ced24dbce23fdb9acfbc7c2972d9dca69205f102635f5cba62110c02c8ac8bc8b8764 -EBUILD clang-13.0.0.ebuild 11288 BLAKE2B 6a49d6681c081e713e17679ea3ae1d87ee98a3229426a0f3e6d481c1a8fb78a00d267402687373ffcab3c48b4b8888fb8509779cb118ff63d4cb2f10306439e7 SHA512 e17c03e45d1c522e837e76f3ef5ebbbf6ec91c4b248cd874e4b0fe1dbb2f3ee4264fd318ebabb4d466929bd4f087922609356d3212ce696741e98faa2fd9ee47 -EBUILD clang-13.0.1.ebuild 11303 BLAKE2B 0fc98007c76c642736919936ca62907d0e1081956f3897b352965ddeb97c238c67ac224293658654dad1032803a9c509da619f9d8fcad74db0174deb154093fe SHA512 963990f22a1a839f292c6a0d22da6d9e31278f953c8713c56f18db6870433f2e9ab4295c96d7d756ce82cb996c841ed515c056eece0ccd1c3a28ce920c490edf -EBUILD clang-14.0.0-r1.ebuild 11529 BLAKE2B 948bdbcf950375a78f238b530de8dde4c2582a89cc385ef419f855c36c253064526b3f9d86c1b36b1364497ad8450327cea774344097c787fb4887b22b53e502 SHA512 c65ccfb25f2f538c98c5a9305251b45a6dd8ab2a4bb55fc4b28186b8c97fed64f5c4075af79f20a2248de5780443163ed74a7982e762eb9cb03b0fd69095d4f4 -EBUILD clang-14.0.1.ebuild 11723 BLAKE2B 160f7a62150eb5940d9f8673dd64efbccf2b3be361fc7ba47a865b5e722a8729026fb024e68c0d5217b815a6bb81d9cae8010fee8bae99a70bf4fde1c8244e64 SHA512 fbb5673352d453f3b2f6949c66d5847d9e55338b5949dd81266f806ff666094db80c48e3ab3dd119b28e2a79044d9936d55b543fce5eda14d820546bcc213458 -EBUILD clang-15.0.0.9999.ebuild 11644 BLAKE2B 4dda8010914a82e7a9f775e535477dd7e970b684d329d5b1d62bbde49f03670916b47ba77071805cf0287f5bdb9053cff10057ad22f1b4ae03bd38f3a79e1d5c SHA512 f9a7ad6cf75cdca1cc4eccfdc1fe260f9b60f2012d77f2a29a5154484d80f06919317d8025ec1a01576bce8e7faf2a178248c1d325b440b0092222373d25ca8e +EBUILD clang-13.0.1.ebuild 11302 BLAKE2B 5781312f1b71fa90446c01434579ef43c4aa131cdf1d896d08957d5a54ca5c884ffaa49a0cbe8f868fdec95c017b704c0e951d2afe8d828d04329aea77fdb874 SHA512 c4da7cbd4c9e0e242f57584e750252e976949daf996f03da01aec578e741f4e4c7bd688aaac27fda70e82c217cfca98199b89cac68a40f1e8101be1275f31b78 +EBUILD clang-14.0.1-r1.ebuild 11726 BLAKE2B a7a7ec628cec5c8d4c4cce7eb82b8a6908889ff9e357a462abcec4303d5d2368a4c4c17ccbd45d18a63212373fb624ddd5c47b5d186404b3a39d4fcabdcd5d6b SHA512 0638728b3dd63d14c138bea1272ae0008583ee23b9fc98fe220228776462bcace91887e2304fefb0abbd867a4011dac80791b7a80fad463098b9e3276164e610 +EBUILD clang-14.0.3.ebuild 11730 BLAKE2B b40139d3712b05ab6d9723e48bf7370ded5a205a6278ada440537a4995441273855877caec6f80f3ea1735224a9ace035593c83ade1a27db992b6873393b1ae4 SHA512 bafeeefb9115341b556194e220dad1eb8c6520520b0d86a04adb25e66cb6cd345127eb2d28d48548d329cfb04d7d1d71df68712bb1ca22927428ba04541f4b7a +EBUILD clang-15.0.0.9999.ebuild 11652 BLAKE2B 9d28da0a7493476e611a53d5de964c3fb8a26ea6affc37c8cfee33e21594c7367ccdde443e4c73243c5a4b9c44f0064abd450b365ebf0fa28a40676bec30b74b SHA512 45507f89b8de6b8cf4709ced8d2484eafba3d23db2ec2fdcbfab5cf8ab3a275565a18f6506ed675f0d64fd03b469b27f693d86895b7ee30ed97bbce770df712d MISC metadata.xml 1337 BLAKE2B 5e4f7d63cd9f3b03600801cbe3b2963a1e6b2fb48e36fdb12862f467829222c182f5958d35b535d8fa8467ebaad05c9641cd645294706e3a0f4a078dc9c2f8cf SHA512 50c1a7c33414f9d6294873478f1017dfb21311b36c916e15a8b068cf2a968fe8d774b51515f61c3632d2b204f103cc7ae6853b14d582291087a0fb8e15c0b35a diff --git a/sys-devel/clang/clang-11.1.0.ebuild b/sys-devel/clang/clang-11.1.0.ebuild deleted file mode 100644 index 70f90cdc03ee..000000000000 --- a/sys-devel/clang/clang-11.1.0.ebuild +++ /dev/null @@ -1,428 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{7..9} ) -inherit cmake llvm llvm.org multilib multilib-minimal \ - prefix python-single-r1 toolchain-funcs - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="https://llvm.org/" - -# Keep in sync with sys-devel/llvm -ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC VE ) -ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 - NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore - "${ALL_LLVM_EXPERIMENTAL_TARGETS[@]}" ) -ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) - -# MSVCSetupApi.h: MIT -# sorttable.js: MIT - -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" -SLOT="$(ver_cut 1)/$(ver_cut 1-2)" -KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86 ~amd64-linux ~x64-macos" -IUSE="debug default-compiler-rt default-libcxx default-lld - doc +static-analyzer test xml ${ALL_LLVM_TARGETS[*]}" -REQUIRED_USE="${PYTHON_REQUIRED_USE} - || ( ${ALL_LLVM_TARGETS[*]} )" -RESTRICT="!test? ( test )" - -RDEPEND=" - ~sys-devel/llvm-${PV}:${SLOT%/*}=[debug=,${MULTILIB_USEDEP}] - static-analyzer? ( dev-lang/perl:* ) - xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) - ${PYTHON_DEPS}" -for x in "${ALL_LLVM_TARGETS[@]}"; do - RDEPEND+=" - ${x}? ( ~sys-devel/llvm-${PV}:${SLOT%/*}[${x}] )" -done -unset x - -DEPEND="${RDEPEND}" -BDEPEND=" - >=dev-util/cmake-3.16 - doc? ( dev-python/sphinx ) - xml? ( virtual/pkgconfig ) - ${PYTHON_DEPS}" -PDEPEND=" - sys-devel/clang-common - ~sys-devel/clang-runtime-${PV} - default-compiler-rt? ( =sys-libs/compiler-rt-${PV%_*}* ) - default-libcxx? ( >=sys-libs/libcxx-${PV} ) - default-lld? ( sys-devel/lld )" - -LLVM_COMPONENTS=( clang clang-tools-extra ) -LLVM_MANPAGES=pregenerated -LLVM_TEST_COMPONENTS=( - llvm/lib/Testing/Support - llvm/utils/{lit,llvm-lit,unittest} - llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} -) -LLVM_PATCHSET=11.1.0-1 -llvm.org_set_globals - -# Multilib notes: -# 1. ABI_* flags control ABIs libclang* is built for only. -# 2. clang is always capable of compiling code for all ABIs for enabled -# target. However, you will need appropriate crt* files (installed -# e.g. by sys-devel/gcc and sys-libs/glibc). -# 3. ${CHOST}-clang wrappers are always installed for all ABIs included -# in the current profile (i.e. alike supported by sys-devel/gcc). -# -# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need -# multilib clang* libraries (not runtime, not wrappers). - -pkg_setup() { - LLVM_MAX_SLOT=${SLOT%/*} llvm_pkg_setup - python-single-r1_pkg_setup -} - -src_prepare() { - # create extra parent dir for relative CLANG_RESOURCE_DIR access - mkdir -p x/y || die - BUILD_DIR=${WORKDIR}/x/y/clang - - llvm.org_src_prepare - - mv ../clang-tools-extra tools/extra || die - - # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) - eprefixify \ - lib/Frontend/InitHeaderSearch.cpp \ - lib/Driver/ToolChains/Darwin.cpp || die -} - -check_distribution_components() { - if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then - local all_targets=() my_targets=() l - cd "${BUILD_DIR}" || die - - while read -r l; do - if [[ ${l} == install-*-stripped:* ]]; then - l=${l#install-} - l=${l%%-stripped*} - - case ${l} in - # meta-targets - clang-libraries|distribution) - continue - ;; - # headers for clang-tidy static library - clang-tidy-headers) - continue - ;; - # tools - clang|clangd|clang-*) - ;; - # static libraries - clang*|findAllSymbols) - continue - ;; - # conditional to USE=doc - docs-clang-html|docs-clang-tools-html) - use doc || continue - ;; - esac - - all_targets+=( "${l}" ) - fi - done < <(ninja -t targets all) - - while read -r l; do - my_targets+=( "${l}" ) - done < <(get_distribution_components $"\n") - - local add=() remove=() - for l in "${all_targets[@]}"; do - if ! has "${l}" "${my_targets[@]}"; then - add+=( "${l}" ) - fi - done - for l in "${my_targets[@]}"; do - if ! has "${l}" "${all_targets[@]}"; then - remove+=( "${l}" ) - fi - done - - if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then - eqawarn "get_distribution_components() is outdated!" - eqawarn " Add: ${add[*]}" - eqawarn "Remove: ${remove[*]}" - fi - cd - >/dev/null || die - fi -} - -get_distribution_components() { - local sep=${1-;} - - local out=( - # common stuff - clang-cmake-exports - clang-headers - clang-resource-headers - libclang-headers - - # libs - clang-cpp - libclang - ) - - if multilib_is_native_abi; then - out+=( - # common stuff - bash-autocomplete - libclang-python-bindings - - # tools - c-index-test - clang - clang-format - clang-offload-bundler - clang-offload-wrapper - clang-refactor - clang-rename - clang-scan-deps - diagtool - hmaptool - - # extra tools - clang-apply-replacements - clang-change-namespace - clang-doc - clang-include-fixer - clang-move - clang-query - clang-reorder-fields - clang-tidy - clangd - find-all-symbols - modularize - pp-trace - ) - - if llvm_are_manpages_built; then - out+=( - # manpages - docs-clang-man - docs-clang-tools-man - ) - fi - - use doc && out+=( - docs-clang-html - docs-clang-tools-html - ) - - use static-analyzer && out+=( - clang-check - clang-extdef-mapping - scan-build - scan-view - ) - fi - - printf "%s${sep}" "${out[@]}" -} - -multilib_src_configure() { - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1-3 "${llvm_version}") - - local mycmakeargs=( - -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT%/*}/$(get_libdir)/cmake/llvm" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT%/*}" - -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT%/*}/share/man" - # relative to bindir - -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" - - -DBUILD_SHARED_LIBS=OFF - -DCLANG_LINK_CLANG_DYLIB=ON - -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) - - -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" - -DLLVM_BUILD_TESTS=$(usex test) - - # these are not propagated reliably, so redefine them - -DLLVM_ENABLE_EH=ON - -DLLVM_ENABLE_RTTI=ON - - -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) - # libgomp support fails to find headers without explicit -I - # furthermore, it provides only syntax checking - -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp - - # override default stdlib and rtlib - -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") - -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") - -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") - - -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) - -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) - - -DPython3_EXECUTABLE="${PYTHON}" - ) - use test && mycmakeargs+=( - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" - -DLLVM_LIT_ARGS="$(get_lit_flags)" - ) - - if multilib_is_native_abi; then - local build_docs=OFF - if llvm_are_manpages_built; then - build_docs=ON - mycmakeargs+=( - -DLLVM_BUILD_DOCS=ON - -DLLVM_ENABLE_SPHINX=ON - -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" - -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" - -DSPHINX_WARNINGS_AS_ERRORS=OFF - ) - fi - - mycmakeargs+=( - # normally copied from LLVM_INCLUDE_DOCS but the latter - # is lacking value in stand-alone builds - -DCLANG_INCLUDE_DOCS=${build_docs} - -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} - ) - else - mycmakeargs+=( - -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF - ) - fi - - if [[ -n ${EPREFIX} ]]; then - mycmakeargs+=( - -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" - ) - fi - - if tc-is-cross-compiler; then - [[ -x "/usr/bin/clang-tblgen" ]] \ - || die "/usr/bin/clang-tblgen not found or usable" - mycmakeargs+=( - -DCMAKE_CROSSCOMPILING=ON - -DCLANG_TABLEGEN=/usr/bin/clang-tblgen - ) - fi - - # LLVM can have very high memory consumption while linking, - # exhausting the limit on 32-bit linker executable - use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" - - # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 - use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" - cmake_src_configure - - multilib_is_native_abi && check_distribution_components -} - -multilib_src_compile() { - cmake_build distribution - - # provide a symlink for tests - if [[ ! -L ${WORKDIR}/lib/clang ]]; then - mkdir -p "${WORKDIR}"/lib || die - ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die - fi -} - -multilib_src_test() { - # respect TMPDIR! - local -x LIT_PRESERVES_TMP=1 - cmake_build check-clang - multilib_is_native_abi && - cmake_build check-clang-tools check-clangd -} - -src_install() { - MULTILIB_WRAPPED_HEADERS=( - /usr/include/clang/Config/config.h - ) - - multilib-minimal_src_install - - # Move runtime headers to /usr/lib/clang, where they belong - mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die - # move (remaining) wrapped headers back - mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT%/*}/include || die - - # Apply CHOST and version suffix to clang tools - # note: we use two version components here (vs 3 in runtime path) - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1 "${llvm_version}") - local clang_full_version=$(ver_cut 1-3 "${llvm_version}") - local clang_tools=( clang clang++ clang-cl clang-cpp ) - local abi i - - # cmake gives us: - # - clang-X - # - clang -> clang-X - # - clang++, clang-cl, clang-cpp -> clang - # we want to have: - # - clang-X - # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X - # - clang, clang++, clang-cl, clang-cpp -> clang*-X - # also in CHOST variant - for i in "${clang_tools[@]:1}"; do - rm "${ED}/usr/lib/llvm/${SLOT%/*}/bin/${i}" || die - dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT%/*}/bin/${i}-${clang_version}" - dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT%/*}/bin/${i}" - done - - # now create target symlinks for all supported ABIs - for abi in $(get_all_abis); do - local abi_chost=$(get_abi_CHOST "${abi}") - for i in "${clang_tools[@]}"; do - dosym "${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT%/*}/bin/${abi_chost}-${i}-${clang_version}" - dosym "${abi_chost}-${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT%/*}/bin/${abi_chost}-${i}" - done - done -} - -multilib_src_install() { - DESTDIR=${D} cmake_build install-distribution - - # move headers to /usr/include for wrapping & ABI mismatch checks - # (also drop the version suffix from runtime headers) - rm -rf "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT%/*}/include "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT%/*}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die -} - -multilib_src_install_all() { - python_fix_shebang "${ED}" - if use static-analyzer; then - python_optimize "${ED}"/usr/lib/llvm/${SLOT%/*}/share/scan-view - fi - - docompress "/usr/lib/llvm/${SLOT%/*}/share/man" - llvm_install_manpages - # match 'html' non-compression - use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" - # +x for some reason; TODO: investigate - use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT%/*}/share/man/man1/scan-build.1" -} - -pkg_postinst() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow update all - fi - - elog "You can find additional utility scripts in:" - elog " ${EROOT}/usr/lib/llvm/${SLOT%/*}/share/clang" - elog "Some of them are vim integration scripts (with instructions inside)." - elog "The run-clang-tidy.py script requires the following additional package:" - elog " dev-python/pyyaml" -} - -pkg_postrm() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow clean all - fi -} diff --git a/sys-devel/clang/clang-13.0.0.ebuild b/sys-devel/clang/clang-13.0.0.ebuild deleted file mode 100644 index 5aeac025e36c..000000000000 --- a/sys-devel/clang/clang-13.0.0.ebuild +++ /dev/null @@ -1,421 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{8..10} ) -inherit cmake llvm llvm.org multilib multilib-minimal \ - prefix python-single-r1 toolchain-funcs - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="https://llvm.org/" - -# MSVCSetupApi.h: MIT -# sorttable.js: MIT - -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" -SLOT="$(ver_cut 1)" -KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv ~sparc x86 ~amd64-linux ~x64-macos" -IUSE="debug default-compiler-rt default-libcxx default-lld - doc llvm-libunwind +static-analyzer test xml" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" -RESTRICT="!test? ( test )" - -RDEPEND=" - ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] - static-analyzer? ( dev-lang/perl:* ) - xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) - ${PYTHON_DEPS}" - -DEPEND="${RDEPEND}" -BDEPEND=" - >=dev-util/cmake-3.16 - doc? ( dev-python/sphinx ) - xml? ( virtual/pkgconfig ) - ${PYTHON_DEPS}" -PDEPEND=" - sys-devel/clang-common - ~sys-devel/clang-runtime-${PV} - default-compiler-rt? ( - =sys-libs/compiler-rt-${PV%_*}* - llvm-libunwind? ( sys-libs/llvm-libunwind ) - !llvm-libunwind? ( sys-libs/libunwind ) - ) - default-libcxx? ( >=sys-libs/libcxx-${PV} ) - default-lld? ( sys-devel/lld )" - -LLVM_COMPONENTS=( clang clang-tools-extra ) -LLVM_MANPAGES=pregenerated -LLVM_TEST_COMPONENTS=( - llvm/lib/Testing/Support - llvm/utils/{lit,llvm-lit,unittest} - llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} -) -LLVM_PATCHSET=${PV/_/-} -LLVM_USE_TARGETS=llvm -llvm.org_set_globals - -# Multilib notes: -# 1. ABI_* flags control ABIs libclang* is built for only. -# 2. clang is always capable of compiling code for all ABIs for enabled -# target. However, you will need appropriate crt* files (installed -# e.g. by sys-devel/gcc and sys-libs/glibc). -# 3. ${CHOST}-clang wrappers are always installed for all ABIs included -# in the current profile (i.e. alike supported by sys-devel/gcc). -# -# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need -# multilib clang* libraries (not runtime, not wrappers). - -pkg_setup() { - LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup - python-single-r1_pkg_setup -} - -src_prepare() { - # create extra parent dir for relative CLANG_RESOURCE_DIR access - mkdir -p x/y || die - BUILD_DIR=${WORKDIR}/x/y/clang - - llvm.org_src_prepare - - # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) - eprefixify \ - lib/Frontend/InitHeaderSearch.cpp \ - lib/Driver/ToolChains/Darwin.cpp || die -} - -check_distribution_components() { - if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then - local all_targets=() my_targets=() l - cd "${BUILD_DIR}" || die - - while read -r l; do - if [[ ${l} == install-*-stripped:* ]]; then - l=${l#install-} - l=${l%%-stripped*} - - case ${l} in - # meta-targets - clang-libraries|distribution) - continue - ;; - # headers for clang-tidy static library - clang-tidy-headers) - continue - ;; - # tools - clang|clangd|clang-*) - ;; - # static libraries - clang*|findAllSymbols) - continue - ;; - # conditional to USE=doc - docs-clang-html|docs-clang-tools-html) - use doc || continue - ;; - esac - - all_targets+=( "${l}" ) - fi - done < <(ninja -t targets all) - - while read -r l; do - my_targets+=( "${l}" ) - done < <(get_distribution_components $"\n") - - local add=() remove=() - for l in "${all_targets[@]}"; do - if ! has "${l}" "${my_targets[@]}"; then - add+=( "${l}" ) - fi - done - for l in "${my_targets[@]}"; do - if ! has "${l}" "${all_targets[@]}"; then - remove+=( "${l}" ) - fi - done - - if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then - eqawarn "get_distribution_components() is outdated!" - eqawarn " Add: ${add[*]}" - eqawarn "Remove: ${remove[*]}" - fi - cd - >/dev/null || die - fi -} - -get_distribution_components() { - local sep=${1-;} - - local out=( - # common stuff - clang-cmake-exports - clang-headers - clang-resource-headers - libclang-headers - - # libs - clang-cpp - libclang - ) - - if multilib_is_native_abi; then - out+=( - # common stuff - bash-autocomplete - libclang-python-bindings - - # tools - c-index-test - clang - clang-format - clang-offload-bundler - clang-offload-wrapper - clang-refactor - clang-rename - clang-scan-deps - diagtool - hmaptool - - # extra tools - clang-apply-replacements - clang-change-namespace - clang-doc - clang-include-fixer - clang-move - clang-query - clang-reorder-fields - clang-tidy - clangd - find-all-symbols - modularize - pp-trace - ) - - if llvm_are_manpages_built; then - out+=( - # manpages - docs-clang-man - docs-clang-tools-man - ) - fi - - use doc && out+=( - docs-clang-html - docs-clang-tools-html - ) - - use static-analyzer && out+=( - clang-check - clang-extdef-mapping - scan-build - scan-build-py - scan-view - ) - fi - - printf "%s${sep}" "${out[@]}" -} - -multilib_src_configure() { - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1-3 "${llvm_version}") - - local mycmakeargs=( - -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)/cmake/llvm" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" - -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" - # relative to bindir - -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" - - -DBUILD_SHARED_LIBS=OFF - -DCLANG_LINK_CLANG_DYLIB=ON - -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) - - -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" - -DLLVM_BUILD_TESTS=$(usex test) - - # these are not propagated reliably, so redefine them - -DLLVM_ENABLE_EH=ON - -DLLVM_ENABLE_RTTI=ON - - -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) - # libgomp support fails to find headers without explicit -I - # furthermore, it provides only syntax checking - -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp - - # disable using CUDA to autodetect GPU, just build for all - -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON - - # override default stdlib and rtlib - -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") - -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") - -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") - -DCLANG_DEFAULT_UNWINDLIB=$(usex default-compiler-rt libunwind "") - - -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) - -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) - - -DPython3_EXECUTABLE="${PYTHON}" - ) - use test && mycmakeargs+=( - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" - -DLLVM_LIT_ARGS="$(get_lit_flags)" - ) - - if multilib_is_native_abi; then - local build_docs=OFF - if llvm_are_manpages_built; then - build_docs=ON - mycmakeargs+=( - -DLLVM_BUILD_DOCS=ON - -DLLVM_ENABLE_SPHINX=ON - -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" - -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" - -DSPHINX_WARNINGS_AS_ERRORS=OFF - ) - fi - mycmakeargs+=( - -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra - -DCLANG_INCLUDE_DOCS=${build_docs} - -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} - ) - else - mycmakeargs+=( - -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF - ) - fi - - if [[ -n ${EPREFIX} ]]; then - mycmakeargs+=( - -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" - ) - fi - - if tc-is-cross-compiler; then - [[ -x "/usr/bin/clang-tblgen" ]] \ - || die "/usr/bin/clang-tblgen not found or usable" - mycmakeargs+=( - -DCMAKE_CROSSCOMPILING=ON - -DCLANG_TABLEGEN=/usr/bin/clang-tblgen - ) - fi - - # LLVM can have very high memory consumption while linking, - # exhausting the limit on 32-bit linker executable - use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" - - # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 - use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" - cmake_src_configure - - multilib_is_native_abi && check_distribution_components -} - -multilib_src_compile() { - cmake_build distribution - - # provide a symlink for tests - if [[ ! -L ${WORKDIR}/lib/clang ]]; then - mkdir -p "${WORKDIR}"/lib || die - ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die - fi -} - -multilib_src_test() { - # respect TMPDIR! - local -x LIT_PRESERVES_TMP=1 - cmake_build check-clang - multilib_is_native_abi && - cmake_build check-clang-tools check-clangd -} - -src_install() { - MULTILIB_WRAPPED_HEADERS=( - /usr/include/clang/Config/config.h - ) - - multilib-minimal_src_install - - # Move runtime headers to /usr/lib/clang, where they belong - mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die - # move (remaining) wrapped headers back - mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die - - # Apply CHOST and version suffix to clang tools - # note: we use two version components here (vs 3 in runtime path) - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1 "${llvm_version}") - local clang_full_version=$(ver_cut 1-3 "${llvm_version}") - local clang_tools=( clang clang++ clang-cl clang-cpp ) - local abi i - - # cmake gives us: - # - clang-X - # - clang -> clang-X - # - clang++, clang-cl, clang-cpp -> clang - # we want to have: - # - clang-X - # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X - # - clang, clang++, clang-cl, clang-cpp -> clang*-X - # also in CHOST variant - for i in "${clang_tools[@]:1}"; do - rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die - dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" - dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" - done - - # now create target symlinks for all supported ABIs - for abi in $(get_all_abis); do - local abi_chost=$(get_abi_CHOST "${abi}") - for i in "${clang_tools[@]}"; do - dosym "${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" - dosym "${abi_chost}-${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" - done - done -} - -multilib_src_install() { - DESTDIR=${D} cmake_build install-distribution - - # move headers to /usr/include for wrapping & ABI mismatch checks - # (also drop the version suffix from runtime headers) - rm -rf "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die -} - -multilib_src_install_all() { - python_fix_shebang "${ED}" - if use static-analyzer; then - python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view - fi - - docompress "/usr/lib/llvm/${SLOT}/share/man" - llvm_install_manpages - # match 'html' non-compression - use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" - # +x for some reason; TODO: investigate - use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" -} - -pkg_postinst() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow update all - fi - - elog "You can find additional utility scripts in:" - elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" - elog "Some of them are vim integration scripts (with instructions inside)." - elog "The run-clang-tidy.py script requires the following additional package:" - elog " dev-python/pyyaml" -} - -pkg_postrm() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow clean all - fi -} diff --git a/sys-devel/clang/clang-13.0.1.ebuild b/sys-devel/clang/clang-13.0.1.ebuild index 97b2f78365f2..6f7c66ee8f02 100644 --- a/sys-devel/clang/clang-13.0.1.ebuild +++ b/sys-devel/clang/clang-13.0.1.ebuild @@ -15,7 +15,7 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" SLOT="$(ver_cut 1)" -KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" +KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv ~sparc x86 ~amd64-linux ~x64-macos" IUSE="debug default-compiler-rt default-libcxx default-lld doc llvm-libunwind +static-analyzer test xml" REQUIRED_USE="${PYTHON_REQUIRED_USE}" diff --git a/sys-devel/clang/clang-14.0.0-r1.ebuild b/sys-devel/clang/clang-14.0.0-r1.ebuild deleted file mode 100644 index e625b4c694ba..000000000000 --- a/sys-devel/clang/clang-14.0.0-r1.ebuild +++ /dev/null @@ -1,430 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{8..10} ) -inherit cmake llvm llvm.org multilib multilib-minimal \ - prefix python-single-r1 toolchain-funcs - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="https://llvm.org/" - -# MSVCSetupApi.h: MIT -# sorttable.js: MIT - -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" -SLOT="$(ver_cut 1)" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" -IUSE="debug default-compiler-rt default-libcxx default-lld - doc llvm-libunwind +pie +static-analyzer test xml" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" -RESTRICT="!test? ( test )" - -RDEPEND=" - ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] - static-analyzer? ( dev-lang/perl:* ) - xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) - ${PYTHON_DEPS}" - -DEPEND="${RDEPEND}" -BDEPEND=" - >=dev-util/cmake-3.16 - doc? ( $(python_gen_cond_dep ' - dev-python/recommonmark[${PYTHON_USEDEP}] - dev-python/sphinx[${PYTHON_USEDEP}] - ') ) - xml? ( virtual/pkgconfig ) - ${PYTHON_DEPS}" -PDEPEND=" - sys-devel/clang-common - ~sys-devel/clang-runtime-${PV} - default-compiler-rt? ( - =sys-libs/compiler-rt-${PV%_*}* - llvm-libunwind? ( sys-libs/llvm-libunwind ) - !llvm-libunwind? ( sys-libs/libunwind ) - ) - default-libcxx? ( >=sys-libs/libcxx-${PV} ) - default-lld? ( sys-devel/lld )" - -LLVM_COMPONENTS=( - clang clang-tools-extra cmake - llvm/lib/Transforms/Hello -) -LLVM_MANPAGES=pregenerated -LLVM_TEST_COMPONENTS=( - llvm/lib/Testing/Support - llvm/utils/{lit,llvm-lit,unittest} - llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} -) -LLVM_PATCHSET=${PV/_/-}-r1 -LLVM_USE_TARGETS=llvm -llvm.org_set_globals - -# Multilib notes: -# 1. ABI_* flags control ABIs libclang* is built for only. -# 2. clang is always capable of compiling code for all ABIs for enabled -# target. However, you will need appropriate crt* files (installed -# e.g. by sys-devel/gcc and sys-libs/glibc). -# 3. ${CHOST}-clang wrappers are always installed for all ABIs included -# in the current profile (i.e. alike supported by sys-devel/gcc). -# -# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need -# multilib clang* libraries (not runtime, not wrappers). - -pkg_setup() { - LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup - python-single-r1_pkg_setup -} - -src_prepare() { - # create extra parent dir for relative CLANG_RESOURCE_DIR access - mkdir -p x/y || die - BUILD_DIR=${WORKDIR}/x/y/clang - - llvm.org_src_prepare - - # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) - eprefixify \ - lib/Lex/InitHeaderSearch.cpp \ - lib/Driver/ToolChains/Darwin.cpp || die -} - -check_distribution_components() { - if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then - local all_targets=() my_targets=() l - cd "${BUILD_DIR}" || die - - while read -r l; do - if [[ ${l} == install-*-stripped:* ]]; then - l=${l#install-} - l=${l%%-stripped*} - - case ${l} in - # meta-targets - clang-libraries|distribution) - continue - ;; - # headers for clang-tidy static library - clang-tidy-headers) - continue - ;; - # tools - clang|clangd|clang-*) - ;; - # static libraries - clang*|findAllSymbols) - continue - ;; - # conditional to USE=doc - docs-clang-html|docs-clang-tools-html) - use doc || continue - ;; - esac - - all_targets+=( "${l}" ) - fi - done < <(ninja -t targets all) - - while read -r l; do - my_targets+=( "${l}" ) - done < <(get_distribution_components $"\n") - - local add=() remove=() - for l in "${all_targets[@]}"; do - if ! has "${l}" "${my_targets[@]}"; then - add+=( "${l}" ) - fi - done - for l in "${my_targets[@]}"; do - if ! has "${l}" "${all_targets[@]}"; then - remove+=( "${l}" ) - fi - done - - if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then - eqawarn "get_distribution_components() is outdated!" - eqawarn " Add: ${add[*]}" - eqawarn "Remove: ${remove[*]}" - fi - cd - >/dev/null || die - fi -} - -get_distribution_components() { - local sep=${1-;} - - local out=( - # common stuff - clang-cmake-exports - clang-headers - clang-resource-headers - libclang-headers - - # libs - clang-cpp - libclang - ) - - if multilib_is_native_abi; then - out+=( - # common stuff - bash-autocomplete - libclang-python-bindings - - # tools - c-index-test - clang - clang-format - clang-offload-bundler - clang-offload-wrapper - clang-refactor - clang-repl - clang-rename - clang-scan-deps - diagtool - hmaptool - - # extra tools - clang-apply-replacements - clang-change-namespace - clang-doc - clang-include-fixer - clang-move - clang-query - clang-reorder-fields - clang-tidy - clangd - find-all-symbols - modularize - pp-trace - ) - - if llvm_are_manpages_built; then - out+=( - # manpages - docs-clang-man - docs-clang-tools-man - ) - fi - - use doc && out+=( - docs-clang-html - docs-clang-tools-html - ) - - use static-analyzer && out+=( - clang-check - clang-extdef-mapping - scan-build - scan-build-py - scan-view - ) - fi - - printf "%s${sep}" "${out[@]}" -} - -multilib_src_configure() { - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1-3 "${llvm_version}") - - local mycmakeargs=( - -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)/cmake/llvm" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" - -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" - # relative to bindir - -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" - - -DBUILD_SHARED_LIBS=OFF - -DCLANG_LINK_CLANG_DYLIB=ON - -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) - - -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" - -DLLVM_BUILD_TESTS=$(usex test) - - # these are not propagated reliably, so redefine them - -DLLVM_ENABLE_EH=ON - -DLLVM_ENABLE_RTTI=ON - - -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) - # libgomp support fails to find headers without explicit -I - # furthermore, it provides only syntax checking - -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp - - # disable using CUDA to autodetect GPU, just build for all - -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON - - # override default stdlib and rtlib - -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") - -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") - -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") - -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) - -DCLANG_DEFAULT_UNWINDLIB=$(usex default-compiler-rt libunwind "") - - -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) - -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) - - -DPython3_EXECUTABLE="${PYTHON}" - ) - use test && mycmakeargs+=( - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" - -DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit" - -DLLVM_LIT_ARGS="$(get_lit_flags)" - ) - - if multilib_is_native_abi; then - local build_docs=OFF - if llvm_are_manpages_built; then - build_docs=ON - mycmakeargs+=( - -DLLVM_BUILD_DOCS=ON - -DLLVM_ENABLE_SPHINX=ON - -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" - -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" - -DSPHINX_WARNINGS_AS_ERRORS=OFF - ) - fi - mycmakeargs+=( - -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra - -DCLANG_INCLUDE_DOCS=${build_docs} - -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} - ) - else - mycmakeargs+=( - -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF - ) - fi - - if [[ -n ${EPREFIX} ]]; then - mycmakeargs+=( - -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" - ) - fi - - if tc-is-cross-compiler; then - [[ -x "/usr/bin/clang-tblgen" ]] \ - || die "/usr/bin/clang-tblgen not found or usable" - mycmakeargs+=( - -DCMAKE_CROSSCOMPILING=ON - -DCLANG_TABLEGEN=/usr/bin/clang-tblgen - ) - fi - - # LLVM can have very high memory consumption while linking, - # exhausting the limit on 32-bit linker executable - use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" - - # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 - use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" - cmake_src_configure - - multilib_is_native_abi && check_distribution_components -} - -multilib_src_compile() { - cmake_build distribution - - # provide a symlink for tests - if [[ ! -L ${WORKDIR}/lib/clang ]]; then - mkdir -p "${WORKDIR}"/lib || die - ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die - fi -} - -multilib_src_test() { - # respect TMPDIR! - local -x LIT_PRESERVES_TMP=1 - cmake_build check-clang - multilib_is_native_abi && - cmake_build check-clang-tools check-clangd -} - -src_install() { - MULTILIB_WRAPPED_HEADERS=( - /usr/include/clang/Config/config.h - ) - - multilib-minimal_src_install - - # Move runtime headers to /usr/lib/clang, where they belong - mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die - # move (remaining) wrapped headers back - mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die - - # Apply CHOST and version suffix to clang tools - # note: we use two version components here (vs 3 in runtime path) - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1 "${llvm_version}") - local clang_full_version=$(ver_cut 1-3 "${llvm_version}") - local clang_tools=( clang clang++ clang-cl clang-cpp ) - local abi i - - # cmake gives us: - # - clang-X - # - clang -> clang-X - # - clang++, clang-cl, clang-cpp -> clang - # we want to have: - # - clang-X - # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X - # - clang, clang++, clang-cl, clang-cpp -> clang*-X - # also in CHOST variant - for i in "${clang_tools[@]:1}"; do - rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die - dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" - dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" - done - - # now create target symlinks for all supported ABIs - for abi in $(get_all_abis); do - local abi_chost=$(get_abi_CHOST "${abi}") - for i in "${clang_tools[@]}"; do - dosym "${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" - dosym "${abi_chost}-${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" - done - done -} - -multilib_src_install() { - DESTDIR=${D} cmake_build install-distribution - - # move headers to /usr/include for wrapping & ABI mismatch checks - # (also drop the version suffix from runtime headers) - rm -rf "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die -} - -multilib_src_install_all() { - python_fix_shebang "${ED}" - if use static-analyzer; then - python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view - fi - - docompress "/usr/lib/llvm/${SLOT}/share/man" - llvm_install_manpages - # match 'html' non-compression - use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" - # +x for some reason; TODO: investigate - use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" -} - -pkg_postinst() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow update all - fi - - elog "You can find additional utility scripts in:" - elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" - elog "Some of them are vim integration scripts (with instructions inside)." - elog "The run-clang-tidy.py script requires the following additional package:" - elog " dev-python/pyyaml" -} - -pkg_postrm() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow clean all - fi -} diff --git a/sys-devel/clang/clang-14.0.1-r1.ebuild b/sys-devel/clang/clang-14.0.1-r1.ebuild new file mode 100644 index 000000000000..01be8123474b --- /dev/null +++ b/sys-devel/clang/clang-14.0.1-r1.ebuild @@ -0,0 +1,433 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..10} ) +inherit cmake llvm llvm.org multilib multilib-minimal \ + prefix python-single-r1 toolchain-funcs + +DESCRIPTION="C language family frontend for LLVM" +HOMEPAGE="https://llvm.org/" + +# MSVCSetupApi.h: MIT +# sorttable.js: MIT + +LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" +SLOT="$(ver_cut 1)" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" +IUSE="debug default-compiler-rt default-libcxx default-lld + doc llvm-libunwind +pie +static-analyzer test xml" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +RDEPEND=" + ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] + static-analyzer? ( dev-lang/perl:* ) + xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) + ${PYTHON_DEPS}" + +DEPEND="${RDEPEND}" +BDEPEND=" + >=dev-util/cmake-3.16 + doc? ( $(python_gen_cond_dep ' + dev-python/recommonmark[${PYTHON_USEDEP}] + dev-python/sphinx[${PYTHON_USEDEP}] + ') ) + xml? ( virtual/pkgconfig ) + ${PYTHON_DEPS}" +PDEPEND=" + sys-devel/clang-common + ~sys-devel/clang-runtime-${PV} + default-compiler-rt? ( + =sys-libs/compiler-rt-${PV%_*}* + llvm-libunwind? ( sys-libs/llvm-libunwind ) + !llvm-libunwind? ( sys-libs/libunwind ) + ) + default-libcxx? ( >=sys-libs/libcxx-${PV} ) + default-lld? ( sys-devel/lld )" + +LLVM_COMPONENTS=( + clang clang-tools-extra cmake + llvm/lib/Transforms/Hello +) +LLVM_MANPAGES=pregenerated +LLVM_TEST_COMPONENTS=( + llvm/lib/Testing/Support + llvm/utils/{lit,llvm-lit,unittest} + llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} +) +LLVM_PATCHSET=14.0.1-r1 +LLVM_USE_TARGETS=llvm +llvm.org_set_globals + +# Multilib notes: +# 1. ABI_* flags control ABIs libclang* is built for only. +# 2. clang is always capable of compiling code for all ABIs for enabled +# target. However, you will need appropriate crt* files (installed +# e.g. by sys-devel/gcc and sys-libs/glibc). +# 3. ${CHOST}-clang wrappers are always installed for all ABIs included +# in the current profile (i.e. alike supported by sys-devel/gcc). +# +# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need +# multilib clang* libraries (not runtime, not wrappers). + +pkg_setup() { + LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup + python-single-r1_pkg_setup +} + +src_prepare() { + # create extra parent dir for relative CLANG_RESOURCE_DIR access + mkdir -p x/y || die + BUILD_DIR=${WORKDIR}/x/y/clang + + llvm.org_src_prepare + + # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) + eprefixify \ + lib/Lex/InitHeaderSearch.cpp \ + lib/Driver/ToolChains/Darwin.cpp || die +} + +check_distribution_components() { + if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then + local all_targets=() my_targets=() l + cd "${BUILD_DIR}" || die + + while read -r l; do + if [[ ${l} == install-*-stripped:* ]]; then + l=${l#install-} + l=${l%%-stripped*} + + case ${l} in + # meta-targets + clang-libraries|distribution) + continue + ;; + # tools + clang|clangd|clang-*) + ;; + # static libraries + clang*|findAllSymbols) + continue + ;; + # conditional to USE=doc + docs-clang-html|docs-clang-tools-html) + use doc || continue + ;; + esac + + all_targets+=( "${l}" ) + fi + done < <(ninja -t targets all) + + while read -r l; do + my_targets+=( "${l}" ) + done < <(get_distribution_components $"\n") + + local add=() remove=() + for l in "${all_targets[@]}"; do + if ! has "${l}" "${my_targets[@]}"; then + add+=( "${l}" ) + fi + done + for l in "${my_targets[@]}"; do + if ! has "${l}" "${all_targets[@]}"; then + remove+=( "${l}" ) + fi + done + + if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then + eqawarn "get_distribution_components() is outdated!" + eqawarn " Add: ${add[*]}" + eqawarn "Remove: ${remove[*]}" + fi + cd - >/dev/null || die + fi +} + +get_distribution_components() { + local sep=${1-;} + + local out=( + # common stuff + clang-cmake-exports + clang-headers + clang-resource-headers + libclang-headers + + # libs + clang-cpp + libclang + ) + + if multilib_is_native_abi; then + out+=( + # common stuff + bash-autocomplete + libclang-python-bindings + + # tools + c-index-test + clang + clang-format + clang-offload-bundler + clang-offload-wrapper + clang-refactor + clang-repl + clang-rename + clang-scan-deps + diagtool + hmaptool + + # extra tools + clang-apply-replacements + clang-change-namespace + clang-doc + clang-include-fixer + clang-move + clang-query + clang-reorder-fields + clang-tidy + clang-tidy-headers + clangd + find-all-symbols + modularize + pp-trace + ) + + if llvm_are_manpages_built; then + out+=( + # manpages + docs-clang-man + docs-clang-tools-man + ) + fi + + use doc && out+=( + docs-clang-html + docs-clang-tools-html + ) + + use static-analyzer && out+=( + clang-check + clang-extdef-mapping + scan-build + scan-build-py + scan-view + ) + fi + + printf "%s${sep}" "${out[@]}" +} + +multilib_src_configure() { + local llvm_version=$(llvm-config --version) || die + local clang_version=$(ver_cut 1-3 "${llvm_version}") + + local mycmakeargs=( + -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)/cmake/llvm" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" + -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" + # relative to bindir + -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" + + -DBUILD_SHARED_LIBS=OFF + -DCLANG_LINK_CLANG_DYLIB=ON + -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) + + -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" + -DLLVM_BUILD_TESTS=$(usex test) + + # these are not propagated reliably, so redefine them + -DLLVM_ENABLE_EH=ON + -DLLVM_ENABLE_RTTI=ON + + -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) + # libgomp support fails to find headers without explicit -I + # furthermore, it provides only syntax checking + -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp + + # disable using CUDA to autodetect GPU, just build for all + -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON + + # override default stdlib and rtlib + -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") + -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") + -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") + -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) + -DCLANG_DEFAULT_UNWINDLIB=$(usex default-compiler-rt libunwind "") + + -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) + -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) + + -DPython3_EXECUTABLE="${PYTHON}" + ) + use test && mycmakeargs+=( + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" + -DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit" + -DLLVM_LIT_ARGS="$(get_lit_flags)" + ) + + if multilib_is_native_abi; then + local build_docs=OFF + if llvm_are_manpages_built; then + build_docs=ON + mycmakeargs+=( + -DLLVM_BUILD_DOCS=ON + -DLLVM_ENABLE_SPHINX=ON + -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" + -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" + -DSPHINX_WARNINGS_AS_ERRORS=OFF + ) + fi + mycmakeargs+=( + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra + -DCLANG_INCLUDE_DOCS=${build_docs} + -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} + ) + else + mycmakeargs+=( + -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF + ) + fi + + if [[ -n ${EPREFIX} ]]; then + mycmakeargs+=( + -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" + ) + fi + + if tc-is-cross-compiler; then + [[ -x "/usr/bin/clang-tblgen" ]] \ + || die "/usr/bin/clang-tblgen not found or usable" + mycmakeargs+=( + -DCMAKE_CROSSCOMPILING=ON + -DCLANG_TABLEGEN=/usr/bin/clang-tblgen + ) + fi + + # LLVM can have very high memory consumption while linking, + # exhausting the limit on 32-bit linker executable + use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" + + # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 + use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" + cmake_src_configure + + multilib_is_native_abi && check_distribution_components +} + +multilib_src_compile() { + cmake_build distribution + + # provide a symlink for tests + if [[ ! -L ${WORKDIR}/lib/clang ]]; then + mkdir -p "${WORKDIR}"/lib || die + ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die + fi +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + cmake_build check-clang + multilib_is_native_abi && + cmake_build check-clang-tools check-clangd +} + +src_install() { + MULTILIB_WRAPPED_HEADERS=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Move runtime headers to /usr/lib/clang, where they belong + mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die + # move (remaining) wrapped headers back + mv "${T}"/clang-tidy "${ED}"/usr/include/ || die + mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die + + # Apply CHOST and version suffix to clang tools + # note: we use two version components here (vs 3 in runtime path) + local llvm_version=$(llvm-config --version) || die + local clang_version=$(ver_cut 1 "${llvm_version}") + local clang_full_version=$(ver_cut 1-3 "${llvm_version}") + local clang_tools=( clang clang++ clang-cl clang-cpp ) + local abi i + + # cmake gives us: + # - clang-X + # - clang -> clang-X + # - clang++, clang-cl, clang-cpp -> clang + # we want to have: + # - clang-X + # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X + # - clang, clang++, clang-cl, clang-cpp -> clang*-X + # also in CHOST variant + for i in "${clang_tools[@]:1}"; do + rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die + dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" + dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" + done + + # now create target symlinks for all supported ABIs + for abi in $(get_all_abis); do + local abi_chost=$(get_abi_CHOST "${abi}") + for i in "${clang_tools[@]}"; do + dosym "${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" + dosym "${abi_chost}-${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" + done + done +} + +multilib_src_install() { + DESTDIR=${D} cmake_build install-distribution + + # move headers to /usr/include for wrapping & ABI mismatch checks + # (also drop the version suffix from runtime headers) + rm -rf "${ED}"/usr/include || die + mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die + mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die + if multilib_is_native_abi; then + # don't wrap clang-tidy headers, the list is too long + # (they're fine for non-native ABI but enabling the targets is problematic) + mv "${ED}"/usr/include/clang-tidy "${T}/" || die + fi +} + +multilib_src_install_all() { + python_fix_shebang "${ED}" + if use static-analyzer; then + python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view + fi + + docompress "/usr/lib/llvm/${SLOT}/share/man" + llvm_install_manpages + # match 'html' non-compression + use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" + # +x for some reason; TODO: investigate + use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" +} + +pkg_postinst() { + if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow update all + fi + + elog "You can find additional utility scripts in:" + elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" + elog "Some of them are vim integration scripts (with instructions inside)." + elog "The run-clang-tidy.py script requires the following additional package:" + elog " dev-python/pyyaml" +} + +pkg_postrm() { + if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow clean all + fi +} diff --git a/sys-devel/clang/clang-14.0.1.ebuild b/sys-devel/clang/clang-14.0.1.ebuild deleted file mode 100644 index 286f3410ba13..000000000000 --- a/sys-devel/clang/clang-14.0.1.ebuild +++ /dev/null @@ -1,433 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{8..10} ) -inherit cmake llvm llvm.org multilib multilib-minimal \ - prefix python-single-r1 toolchain-funcs - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="https://llvm.org/" - -# MSVCSetupApi.h: MIT -# sorttable.js: MIT - -LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" -SLOT="$(ver_cut 1)" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" -IUSE="debug default-compiler-rt default-libcxx default-lld - doc llvm-libunwind +pie +static-analyzer test xml" -REQUIRED_USE="${PYTHON_REQUIRED_USE}" -RESTRICT="!test? ( test )" - -RDEPEND=" - ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] - static-analyzer? ( dev-lang/perl:* ) - xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) - ${PYTHON_DEPS}" - -DEPEND="${RDEPEND}" -BDEPEND=" - >=dev-util/cmake-3.16 - doc? ( $(python_gen_cond_dep ' - dev-python/recommonmark[${PYTHON_USEDEP}] - dev-python/sphinx[${PYTHON_USEDEP}] - ') ) - xml? ( virtual/pkgconfig ) - ${PYTHON_DEPS}" -PDEPEND=" - sys-devel/clang-common - ~sys-devel/clang-runtime-${PV} - default-compiler-rt? ( - =sys-libs/compiler-rt-${PV%_*}* - llvm-libunwind? ( sys-libs/llvm-libunwind ) - !llvm-libunwind? ( sys-libs/libunwind ) - ) - default-libcxx? ( >=sys-libs/libcxx-${PV} ) - default-lld? ( sys-devel/lld )" - -LLVM_COMPONENTS=( - clang clang-tools-extra cmake - llvm/lib/Transforms/Hello -) -LLVM_MANPAGES=pregenerated -LLVM_TEST_COMPONENTS=( - llvm/lib/Testing/Support - llvm/utils/{lit,llvm-lit,unittest} - llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} -) -LLVM_PATCHSET=14.0.1 -LLVM_USE_TARGETS=llvm -llvm.org_set_globals - -# Multilib notes: -# 1. ABI_* flags control ABIs libclang* is built for only. -# 2. clang is always capable of compiling code for all ABIs for enabled -# target. However, you will need appropriate crt* files (installed -# e.g. by sys-devel/gcc and sys-libs/glibc). -# 3. ${CHOST}-clang wrappers are always installed for all ABIs included -# in the current profile (i.e. alike supported by sys-devel/gcc). -# -# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need -# multilib clang* libraries (not runtime, not wrappers). - -pkg_setup() { - LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup - python-single-r1_pkg_setup -} - -src_prepare() { - # create extra parent dir for relative CLANG_RESOURCE_DIR access - mkdir -p x/y || die - BUILD_DIR=${WORKDIR}/x/y/clang - - llvm.org_src_prepare - - # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) - eprefixify \ - lib/Lex/InitHeaderSearch.cpp \ - lib/Driver/ToolChains/Darwin.cpp || die -} - -check_distribution_components() { - if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then - local all_targets=() my_targets=() l - cd "${BUILD_DIR}" || die - - while read -r l; do - if [[ ${l} == install-*-stripped:* ]]; then - l=${l#install-} - l=${l%%-stripped*} - - case ${l} in - # meta-targets - clang-libraries|distribution) - continue - ;; - # tools - clang|clangd|clang-*) - ;; - # static libraries - clang*|findAllSymbols) - continue - ;; - # conditional to USE=doc - docs-clang-html|docs-clang-tools-html) - use doc || continue - ;; - esac - - all_targets+=( "${l}" ) - fi - done < <(ninja -t targets all) - - while read -r l; do - my_targets+=( "${l}" ) - done < <(get_distribution_components $"\n") - - local add=() remove=() - for l in "${all_targets[@]}"; do - if ! has "${l}" "${my_targets[@]}"; then - add+=( "${l}" ) - fi - done - for l in "${my_targets[@]}"; do - if ! has "${l}" "${all_targets[@]}"; then - remove+=( "${l}" ) - fi - done - - if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then - eqawarn "get_distribution_components() is outdated!" - eqawarn " Add: ${add[*]}" - eqawarn "Remove: ${remove[*]}" - fi - cd - >/dev/null || die - fi -} - -get_distribution_components() { - local sep=${1-;} - - local out=( - # common stuff - clang-cmake-exports - clang-headers - clang-resource-headers - libclang-headers - - # libs - clang-cpp - libclang - ) - - if multilib_is_native_abi; then - out+=( - # common stuff - bash-autocomplete - libclang-python-bindings - - # tools - c-index-test - clang - clang-format - clang-offload-bundler - clang-offload-wrapper - clang-refactor - clang-repl - clang-rename - clang-scan-deps - diagtool - hmaptool - - # extra tools - clang-apply-replacements - clang-change-namespace - clang-doc - clang-include-fixer - clang-move - clang-query - clang-reorder-fields - clang-tidy - clang-tidy-headers - clangd - find-all-symbols - modularize - pp-trace - ) - - if llvm_are_manpages_built; then - out+=( - # manpages - docs-clang-man - docs-clang-tools-man - ) - fi - - use doc && out+=( - docs-clang-html - docs-clang-tools-html - ) - - use static-analyzer && out+=( - clang-check - clang-extdef-mapping - scan-build - scan-build-py - scan-view - ) - fi - - printf "%s${sep}" "${out[@]}" -} - -multilib_src_configure() { - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1-3 "${llvm_version}") - - local mycmakeargs=( - -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)/cmake/llvm" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" - -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" - # relative to bindir - -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" - - -DBUILD_SHARED_LIBS=OFF - -DCLANG_LINK_CLANG_DYLIB=ON - -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) - - -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" - -DLLVM_BUILD_TESTS=$(usex test) - - # these are not propagated reliably, so redefine them - -DLLVM_ENABLE_EH=ON - -DLLVM_ENABLE_RTTI=ON - - -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) - # libgomp support fails to find headers without explicit -I - # furthermore, it provides only syntax checking - -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp - - # disable using CUDA to autodetect GPU, just build for all - -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON - - # override default stdlib and rtlib - -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") - -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") - -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") - -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) - -DCLANG_DEFAULT_UNWINDLIB=$(usex default-compiler-rt libunwind "") - - -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) - -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) - - -DPython3_EXECUTABLE="${PYTHON}" - ) - use test && mycmakeargs+=( - -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" - -DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit" - -DLLVM_LIT_ARGS="$(get_lit_flags)" - ) - - if multilib_is_native_abi; then - local build_docs=OFF - if llvm_are_manpages_built; then - build_docs=ON - mycmakeargs+=( - -DLLVM_BUILD_DOCS=ON - -DLLVM_ENABLE_SPHINX=ON - -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" - -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" - -DSPHINX_WARNINGS_AS_ERRORS=OFF - ) - fi - mycmakeargs+=( - -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra - -DCLANG_INCLUDE_DOCS=${build_docs} - -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} - ) - else - mycmakeargs+=( - -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF - ) - fi - - if [[ -n ${EPREFIX} ]]; then - mycmakeargs+=( - -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" - ) - fi - - if tc-is-cross-compiler; then - [[ -x "/usr/bin/clang-tblgen" ]] \ - || die "/usr/bin/clang-tblgen not found or usable" - mycmakeargs+=( - -DCMAKE_CROSSCOMPILING=ON - -DCLANG_TABLEGEN=/usr/bin/clang-tblgen - ) - fi - - # LLVM can have very high memory consumption while linking, - # exhausting the limit on 32-bit linker executable - use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" - - # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 - use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" - cmake_src_configure - - multilib_is_native_abi && check_distribution_components -} - -multilib_src_compile() { - cmake_build distribution - - # provide a symlink for tests - if [[ ! -L ${WORKDIR}/lib/clang ]]; then - mkdir -p "${WORKDIR}"/lib || die - ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die - fi -} - -multilib_src_test() { - # respect TMPDIR! - local -x LIT_PRESERVES_TMP=1 - cmake_build check-clang - multilib_is_native_abi && - cmake_build check-clang-tools check-clangd -} - -src_install() { - MULTILIB_WRAPPED_HEADERS=( - /usr/include/clang/Config/config.h - ) - - multilib-minimal_src_install - - # Move runtime headers to /usr/lib/clang, where they belong - mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die - # move (remaining) wrapped headers back - mv "${T}"/clang-tidy "${ED}"/usr/include/ || die - mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die - - # Apply CHOST and version suffix to clang tools - # note: we use two version components here (vs 3 in runtime path) - local llvm_version=$(llvm-config --version) || die - local clang_version=$(ver_cut 1 "${llvm_version}") - local clang_full_version=$(ver_cut 1-3 "${llvm_version}") - local clang_tools=( clang clang++ clang-cl clang-cpp ) - local abi i - - # cmake gives us: - # - clang-X - # - clang -> clang-X - # - clang++, clang-cl, clang-cpp -> clang - # we want to have: - # - clang-X - # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X - # - clang, clang++, clang-cl, clang-cpp -> clang*-X - # also in CHOST variant - for i in "${clang_tools[@]:1}"; do - rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die - dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" - dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" - done - - # now create target symlinks for all supported ABIs - for abi in $(get_all_abis); do - local abi_chost=$(get_abi_CHOST "${abi}") - for i in "${clang_tools[@]}"; do - dosym "${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" - dosym "${abi_chost}-${i}-${clang_version}" \ - "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" - done - done -} - -multilib_src_install() { - DESTDIR=${D} cmake_build install-distribution - - # move headers to /usr/include for wrapping & ABI mismatch checks - # (also drop the version suffix from runtime headers) - rm -rf "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die - mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die - if multilib_is_native_abi; then - # don't wrap clang-tidy headers, the list is too long - # (they're fine for non-native ABI but enabling the targets is problematic) - mv "${ED}"/usr/include/clang-tidy "${T}/" || die - fi -} - -multilib_src_install_all() { - python_fix_shebang "${ED}" - if use static-analyzer; then - python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view - fi - - docompress "/usr/lib/llvm/${SLOT}/share/man" - llvm_install_manpages - # match 'html' non-compression - use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" - # +x for some reason; TODO: investigate - use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" -} - -pkg_postinst() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow update all - fi - - elog "You can find additional utility scripts in:" - elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" - elog "Some of them are vim integration scripts (with instructions inside)." - elog "The run-clang-tidy.py script requires the following additional package:" - elog " dev-python/pyyaml" -} - -pkg_postrm() { - if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then - eselect compiler-shadow clean all - fi -} diff --git a/sys-devel/clang/clang-14.0.3.ebuild b/sys-devel/clang/clang-14.0.3.ebuild new file mode 100644 index 000000000000..19d50597423e --- /dev/null +++ b/sys-devel/clang/clang-14.0.3.ebuild @@ -0,0 +1,440 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..10} ) +inherit cmake llvm llvm.org multilib multilib-minimal \ + prefix python-single-r1 toolchain-funcs + +DESCRIPTION="C language family frontend for LLVM" +HOMEPAGE="https://llvm.org/" + +# MSVCSetupApi.h: MIT +# sorttable.js: MIT + +LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" +SLOT="$(ver_cut 1)" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x64-macos" +IUSE=" + debug default-compiler-rt default-libcxx default-lld doc + llvm-libunwind +pie +static-analyzer test xml +" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" +RESTRICT="!test? ( test )" + +DEPEND=" + ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] + static-analyzer? ( dev-lang/perl:* ) + xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) +" + +RDEPEND=" + ${PYTHON_DEPS} + ${DEPEND} +" +BDEPEND=" + ${PYTHON_DEPS} + >=dev-util/cmake-3.16 + doc? ( $(python_gen_cond_dep ' + dev-python/recommonmark[${PYTHON_USEDEP}] + dev-python/sphinx[${PYTHON_USEDEP}] + ') ) + xml? ( virtual/pkgconfig ) +" +PDEPEND=" + sys-devel/clang-common + ~sys-devel/clang-runtime-${PV} + default-compiler-rt? ( + =sys-libs/compiler-rt-${PV%_*}* + llvm-libunwind? ( sys-libs/llvm-libunwind ) + !llvm-libunwind? ( sys-libs/libunwind ) + ) + default-libcxx? ( >=sys-libs/libcxx-${PV} ) + default-lld? ( sys-devel/lld ) +" + +LLVM_COMPONENTS=( + clang clang-tools-extra cmake + llvm/lib/Transforms/Hello +) +LLVM_MANPAGES=pregenerated +LLVM_TEST_COMPONENTS=( + llvm/lib/Testing/Support + llvm/utils/{lit,llvm-lit,unittest} + llvm/utils/{UpdateTestChecks,update_cc_test_checks.py} +) +LLVM_PATCHSET=${PV} +LLVM_USE_TARGETS=llvm +llvm.org_set_globals + +# Multilib notes: +# 1. ABI_* flags control ABIs libclang* is built for only. +# 2. clang is always capable of compiling code for all ABIs for enabled +# target. However, you will need appropriate crt* files (installed +# e.g. by sys-devel/gcc and sys-libs/glibc). +# 3. ${CHOST}-clang wrappers are always installed for all ABIs included +# in the current profile (i.e. alike supported by sys-devel/gcc). +# +# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need +# multilib clang* libraries (not runtime, not wrappers). + +pkg_setup() { + LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup + python-single-r1_pkg_setup +} + +src_prepare() { + # create extra parent dir for relative CLANG_RESOURCE_DIR access + mkdir -p x/y || die + BUILD_DIR=${WORKDIR}/x/y/clang + + llvm.org_src_prepare + + # add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch) + eprefixify \ + lib/Lex/InitHeaderSearch.cpp \ + lib/Driver/ToolChains/Darwin.cpp || die +} + +check_distribution_components() { + if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then + local all_targets=() my_targets=() l + cd "${BUILD_DIR}" || die + + while read -r l; do + if [[ ${l} == install-*-stripped:* ]]; then + l=${l#install-} + l=${l%%-stripped*} + + case ${l} in + # meta-targets + clang-libraries|distribution) + continue + ;; + # tools + clang|clangd|clang-*) + ;; + # static libraries + clang*|findAllSymbols) + continue + ;; + # conditional to USE=doc + docs-clang-html|docs-clang-tools-html) + use doc || continue + ;; + esac + + all_targets+=( "${l}" ) + fi + done < <(ninja -t targets all) + + while read -r l; do + my_targets+=( "${l}" ) + done < <(get_distribution_components $"\n") + + local add=() remove=() + for l in "${all_targets[@]}"; do + if ! has "${l}" "${my_targets[@]}"; then + add+=( "${l}" ) + fi + done + for l in "${my_targets[@]}"; do + if ! has "${l}" "${all_targets[@]}"; then + remove+=( "${l}" ) + fi + done + + if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then + eqawarn "get_distribution_components() is outdated!" + eqawarn " Add: ${add[*]}" + eqawarn "Remove: ${remove[*]}" + fi + cd - >/dev/null || die + fi +} + +get_distribution_components() { + local sep=${1-;} + + local out=( + # common stuff + clang-cmake-exports + clang-headers + clang-resource-headers + libclang-headers + + # libs + clang-cpp + libclang + ) + + if multilib_is_native_abi; then + out+=( + # common stuff + bash-autocomplete + libclang-python-bindings + + # tools + c-index-test + clang + clang-format + clang-offload-bundler + clang-offload-wrapper + clang-refactor + clang-repl + clang-rename + clang-scan-deps + diagtool + hmaptool + + # extra tools + clang-apply-replacements + clang-change-namespace + clang-doc + clang-include-fixer + clang-move + clang-query + clang-reorder-fields + clang-tidy + clang-tidy-headers + clangd + find-all-symbols + modularize + pp-trace + ) + + if llvm_are_manpages_built; then + out+=( + # manpages + docs-clang-man + docs-clang-tools-man + ) + fi + + use doc && out+=( + docs-clang-html + docs-clang-tools-html + ) + + use static-analyzer && out+=( + clang-check + clang-extdef-mapping + scan-build + scan-build-py + scan-view + ) + fi + + printf "%s${sep}" "${out[@]}" +} + +multilib_src_configure() { + local llvm_version=$(llvm-config --version) || die + local clang_version=$(ver_cut 1-3 "${llvm_version}") + + local mycmakeargs=( + -DLLVM_CMAKE_PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)/cmake/llvm" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" + -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" + # relative to bindir + -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}" + + -DBUILD_SHARED_LIBS=OFF + -DCLANG_LINK_CLANG_DYLIB=ON + -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) + + -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" + -DLLVM_BUILD_TESTS=$(usex test) + + # these are not propagated reliably, so redefine them + -DLLVM_ENABLE_EH=ON + -DLLVM_ENABLE_RTTI=ON + + -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml) + # libgomp support fails to find headers without explicit -I + # furthermore, it provides only syntax checking + -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp + + # disable using CUDA to autodetect GPU, just build for all + -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON + + # override default stdlib and rtlib + -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "") + -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "") + -DCLANG_DEFAULT_LINKER=$(usex default-lld lld "") + -DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie) + -DCLANG_DEFAULT_UNWINDLIB=$(usex default-compiler-rt libunwind "") + + -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) + -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) + + -DPython3_EXECUTABLE="${PYTHON}" + ) + use test && mycmakeargs+=( + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" + -DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit" + -DLLVM_LIT_ARGS="$(get_lit_flags)" + ) + + if multilib_is_native_abi; then + local build_docs=OFF + if llvm_are_manpages_built; then + build_docs=ON + mycmakeargs+=( + -DLLVM_BUILD_DOCS=ON + -DLLVM_ENABLE_SPHINX=ON + -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" + -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra" + -DSPHINX_WARNINGS_AS_ERRORS=OFF + ) + fi + mycmakeargs+=( + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra + -DCLANG_INCLUDE_DOCS=${build_docs} + -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs} + ) + else + mycmakeargs+=( + -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF + ) + fi + + if [[ -n ${EPREFIX} ]]; then + mycmakeargs+=( + -DGCC_INSTALL_PREFIX="${EPREFIX}/usr" + ) + fi + + if tc-is-cross-compiler; then + [[ -x "/usr/bin/clang-tblgen" ]] \ + || die "/usr/bin/clang-tblgen not found or usable" + mycmakeargs+=( + -DCMAKE_CROSSCOMPILING=ON + -DCLANG_TABLEGEN=/usr/bin/clang-tblgen + ) + fi + + # LLVM can have very high memory consumption while linking, + # exhausting the limit on 32-bit linker executable + use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory" + + # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 + use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" + cmake_src_configure + + multilib_is_native_abi && check_distribution_components +} + +multilib_src_compile() { + cmake_build distribution + + # provide a symlink for tests + if [[ ! -L ${WORKDIR}/lib/clang ]]; then + mkdir -p "${WORKDIR}"/lib || die + ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die + fi +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + cmake_build check-clang + multilib_is_native_abi && + cmake_build check-clang-tools check-clangd +} + +src_install() { + MULTILIB_WRAPPED_HEADERS=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Move runtime headers to /usr/lib/clang, where they belong + mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die + # move (remaining) wrapped headers back + mv "${T}"/clang-tidy "${ED}"/usr/include/ || die + mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die + + # Apply CHOST and version suffix to clang tools + # note: we use two version components here (vs 3 in runtime path) + local llvm_version=$(llvm-config --version) || die + local clang_version=$(ver_cut 1 "${llvm_version}") + local clang_full_version=$(ver_cut 1-3 "${llvm_version}") + local clang_tools=( clang clang++ clang-cl clang-cpp ) + local abi i + + # cmake gives us: + # - clang-X + # - clang -> clang-X + # - clang++, clang-cl, clang-cpp -> clang + # we want to have: + # - clang-X + # - clang++-X, clang-cl-X, clang-cpp-X -> clang-X + # - clang, clang++, clang-cl, clang-cpp -> clang*-X + # also in CHOST variant + for i in "${clang_tools[@]:1}"; do + rm "${ED}/usr/lib/llvm/${SLOT}/bin/${i}" || die + dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" + dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" + done + + # now create target symlinks for all supported ABIs + for abi in $(get_all_abis); do + local abi_chost=$(get_abi_CHOST "${abi}") + for i in "${clang_tools[@]}"; do + dosym "${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" + dosym "${abi_chost}-${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" + done + done +} + +multilib_src_install() { + DESTDIR=${D} cmake_build install-distribution + + # move headers to /usr/include for wrapping & ABI mismatch checks + # (also drop the version suffix from runtime headers) + rm -rf "${ED}"/usr/include || die + mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die + mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die + if multilib_is_native_abi; then + # don't wrap clang-tidy headers, the list is too long + # (they're fine for non-native ABI but enabling the targets is problematic) + mv "${ED}"/usr/include/clang-tidy "${T}/" || die + fi +} + +multilib_src_install_all() { + python_fix_shebang "${ED}" + if use static-analyzer; then + python_optimize "${ED}"/usr/lib/llvm/${SLOT}/share/scan-view + fi + + docompress "/usr/lib/llvm/${SLOT}/share/man" + llvm_install_manpages + # match 'html' non-compression + use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" + # +x for some reason; TODO: investigate + use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" +} + +pkg_postinst() { + if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow update all + fi + + elog "You can find additional utility scripts in:" + elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang" + elog "Some of them are vim integration scripts (with instructions inside)." + elog "The run-clang-tidy.py script requires the following additional package:" + elog " dev-python/pyyaml" +} + +pkg_postrm() { + if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow clean all + fi +} diff --git a/sys-devel/clang/clang-15.0.0.9999.ebuild b/sys-devel/clang/clang-15.0.0.9999.ebuild index 4cb70129b171..eed1670c87ea 100644 --- a/sys-devel/clang/clang-15.0.0.9999.ebuild +++ b/sys-devel/clang/clang-15.0.0.9999.ebuild @@ -1,7 +1,7 @@ # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 PYTHON_COMPAT=( python3_{8..10} ) inherit cmake llvm llvm.org multilib multilib-minimal \ @@ -16,26 +16,32 @@ HOMEPAGE="https://llvm.org/" LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT" SLOT="$(ver_cut 1)" KEYWORDS="" -IUSE="debug default-compiler-rt default-libcxx default-lld - doc llvm-libunwind +pie +static-analyzer test xml" +IUSE=" + debug default-compiler-rt default-libcxx default-lld doc + llvm-libunwind +pie +static-analyzer test xml +" REQUIRED_USE="${PYTHON_REQUIRED_USE}" RESTRICT="!test? ( test )" -RDEPEND=" +DEPEND=" ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${MULTILIB_USEDEP}] static-analyzer? ( dev-lang/perl:* ) xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) - ${PYTHON_DEPS}" +" -DEPEND="${RDEPEND}" +RDEPEND=" + ${PYTHON_DEPS} + ${DEPEND} +" BDEPEND=" + ${PYTHON_DEPS} >=dev-util/cmake-3.16 doc? ( $(python_gen_cond_dep ' dev-python/recommonmark[${PYTHON_USEDEP}] dev-python/sphinx[${PYTHON_USEDEP}] ') ) xml? ( virtual/pkgconfig ) - ${PYTHON_DEPS}" +" PDEPEND=" sys-devel/clang-common ~sys-devel/clang-runtime-${PV} @@ -45,7 +51,8 @@ PDEPEND=" !llvm-libunwind? ( sys-libs/libunwind ) ) default-libcxx? ( >=sys-libs/libcxx-${PV} ) - default-lld? ( sys-devel/lld )" + default-lld? ( sys-devel/lld ) +" LLVM_COMPONENTS=( clang clang-tools-extra cmake -- cgit v1.2.3