From 179be85ade6b2b47bf362865b5c375969ab5ddc8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 11 Oct 2022 01:37:01 +0100 Subject: gentoo auto-resync : 11:10:2022 - 01:37:00 --- sys-devel/llvm/Manifest | 14 +- sys-devel/llvm/llvm-13.0.1.ebuild | 14 +- sys-devel/llvm/llvm-14.0.6-r2.ebuild | 14 +- sys-devel/llvm/llvm-15.0.2.ebuild | 14 +- sys-devel/llvm/llvm-15.0.3.9999.ebuild | 14 +- sys-devel/llvm/llvm-16.0.0.9999.ebuild | 14 +- sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild | 14 +- sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild | 523 ++++++++++++++++++++++++++ 8 files changed, 537 insertions(+), 84 deletions(-) create mode 100644 sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild (limited to 'sys-devel/llvm') diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest index 68abed8c10d3..cb6d223d38ee 100644 --- a/sys-devel/llvm/Manifest +++ b/sys-devel/llvm/Manifest @@ -10,11 +10,13 @@ DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B cb658ad43d8ab6c43a5773aedadf DIST llvm-project-15.0.2.src.tar.xz 112071864 BLAKE2B 96f2884d6c1007260d71e5dd41951eed029e8f50ff78f3c90f7194df13e1d4fb80ab7705c51c45a3e6b2a7714a98d9c5919fc7064d1d5f7c675e65b9b4229b65 SHA512 a0e815369c15bb4f8e8aa0fede29c3d557fcc5c8f2b39d457c03f1ef1d860082a41027238571b2aee9a158a87eb118deb08dc2ba94ce750320837a84e9908b8c DIST llvm-project-15.0.2.src.tar.xz.sig 438 BLAKE2B 37a3a7fbc2d74db9060e85f04e159b475cf818c95a6fe2e9f5f038eb990f414d94833ecac2f9c826825a69b752876399e37e70e6934def06363f7ccb18be033a SHA512 cfe3bc400a64536ad9181c2ede7227a0953a8632fdc777d1ea1d9225c1fc4e699d90ce0b99e057ee5b87c1272d5810c4b52fb0cac167ddd2aad88f1f3ef46ee8 DIST llvm-project-5a0722e0469894564dd9b0ee1d4f8c291d09c776.tar.gz 169164627 BLAKE2B c9a8672cac0faa747baa366545d21f91b50e7611e062eb95042cbccc2dc00b74f44c5c2fcccda49b44975320dfadca5916585766235a406dfbd7321afba03025 SHA512 bad4043fab0e4f9c633bc0aa74df1f1ea886f1d20c1c7a2704bd8317371cf6325e70a770623307d7a455e815cce8c5f00be1ed4ec3f06a7b69038a2784f73243 +DIST llvm-project-ebb258d3b0785f6dcc65e1f277d0690891ddc94d.tar.gz 168823463 BLAKE2B 111afe0f6ba6cef28c3d0162c9c650d15239f981949030768780ebe308418346d0ad367e0e58417832ae43e57b27bccaf56415f81e8221c6c5e78d1113f5617b SHA512 80351d7eeac77a15bf5613b289c71d718ecaccd8a6a4ea6736ed8bfc15c8154099c771564f99ea6c8b491f99bf1ca3a45fac977d638f6a03d7f7b42ba522fa20 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f -EBUILD llvm-13.0.1.ebuild 12256 BLAKE2B 83ef68f6be3b12fa62709fb23820300e6f464f687e326fa82dca6b04c08f6f0271e4f03ff11f16e9e3c4fc43c0ee98180961ef0f6c0f856e1bb4029c7edf2481 SHA512 42fe5df50c6abd3dafefea09a46533a225ba5aa713f791438a546503b62af89f5fc10da9fa470ee7527aed3f6c2d22295ad4c33baec39dd56516ab9327e60ee7 -EBUILD llvm-14.0.6-r2.ebuild 12630 BLAKE2B c02086c457a56c1fed1919284cd241325cdcf842f09767f1679e20fe9ffb61e20bb119e90dd3fb1b182720d6db972e0a7a3025b26fc67728af99b8981eb4d3db SHA512 244d61c979ef1187e3036fe066e16d42776375bbf9a0d6e0c08b0dbb0a71d6c44245a1ee5439f60cf5bab573f57d38980d115561a24a3e5f01373a90df2f2429 -EBUILD llvm-15.0.2.ebuild 12598 BLAKE2B 2335885f1495582eda8b6568613a2eb29b04be9ffac5a5d48f2708761c31c8c3a5634686dbf01975686e7cf00543265dc822ba57a5eb52afe1920512e58a376d SHA512 486929435d52f45cf4deead80ef7c17cadbc40ba0ac8714db0e58d6249a95f783f905246226380e2ba17617c68c831cd8a66422a6bba6fe63a2cebdc706b04cd -EBUILD llvm-15.0.3.9999.ebuild 12616 BLAKE2B 0407ccf4279ea208508d1671fe06cc07cc0209e884f8a440d358e04ab681fec337485a0f4180e6b08bb5cd6a75ce31ffd6c48101b30f76c426bf2bb1e7e1a12a SHA512 922580e53bc68e63cbb053cfd14bfed196fd20c2b8d82c26365cf39d4fab01bbab7d1a7a3372865945d353b3c2ca5428e570d717e6061493ba223896e3fd84ae -EBUILD llvm-16.0.0.9999.ebuild 12781 BLAKE2B 21cc3a952421c08174f0d2c18a3b73484c052e0cea849a02994cded90970074736b5120229136966127582ab655a8380d384e047e10ba88fb35da9fbfc1f03b4 SHA512 4afdfc14e8a72ca974068547ecce822138e0b1a74aae3c8487477032e2f6409b44550f3f4cc8c057651326b9f680d4fe7b85198b178976704bf40adeac615192 -EBUILD llvm-16.0.0_pre20221006.ebuild 13007 BLAKE2B e653c26c152524a9589d5dcc8ff9859c4fa3a8751d7162ad0d66e1fed5364704dbbbb7ec0fb1a53ec6630847aa36c881252579f86b12904abc566b908bf8052a SHA512 e3f124969ef67456a2e3593e95c91f2592d2370556faa8208cbfefbd5b5669558b453adac0a3d7c389d0994310276805fb12daaed99017008b7691396c3ec242 +EBUILD llvm-13.0.1.ebuild 12007 BLAKE2B f235f91c07fe75bfa0afffc6d750c10f77b7817353ee84d99a0fa706f6fb7fb30dd74bf2966ca4aaff162faad8c3c9ed9ee6446bdcd0878195de61a15ab23355 SHA512 b1cf7e90b038de6c1d9165e849e7bd422d4665fb23c477aa514bdde3c0cb92e9eb9dd76968e37d4e885bfd792f441ba7e95c1a41baea2f8f7993aadb38439717 +EBUILD llvm-14.0.6-r2.ebuild 12381 BLAKE2B 736afa7fbf7321ce4370e892075e716e6efb23981b4e9d235d60784c7548c6b62590527753e2752f80b4a4eafc04096fbd6ec5b8efbba88de08f322262361eda SHA512 1c800cea06768c48fe7c0944e4b4c9227f11ffbf9605ca52e487646385eeeaab5acca8aaba0e66b21b2939505533f562fe40ac5b23533adf0e42898e163a9620 +EBUILD llvm-15.0.2.ebuild 12349 BLAKE2B 5f3cdbbd9fd72ee7c75ef3cb75ca3e2ba75f964c64164c99a2837c4cae27476b660f1873a2421a412386df6fd331e0d14701f38bdd092eca78434541b57d9a4d SHA512 90c2f68c88901550044e3f2b50981fdf0555fa35add374279bb49e2a5dff45f0d3ad9b41590c33e6958691d137824bdfeb2380312b5b2e83d18924dfeb64b293 +EBUILD llvm-15.0.3.9999.ebuild 12367 BLAKE2B dc2d43140eb3639d5a6d029cda6a71cd1680ec962a7154788aa3d7913e00ba0a1d846a8eadf43afbe1ee4366667a93f864e2e4f007fdc94e21873d542145bd30 SHA512 8946e3abc832beb2f67b6fd55faa7c5a1670fe0d8dfc8d6cca33632daab72bbe70de2194cf0302b751e96ceb6563ca7f82a2d90ea3f318b5644b18c563210294 +EBUILD llvm-16.0.0.9999.ebuild 12532 BLAKE2B fcc2fbe2f7b96e579d99ca52eb6c59ce2bc6fa652e2bf3fecfd88aaaafef9290ced05b5134aac327ceef0af9fb07b643a28405bc1aabf302fdb65c71544f40b8 SHA512 ec2991754334a2c33a08160d35ea099d2bc38f2ee9b2498f06d4864402cead296646aea33ed1240a32f452f360016dfcc066d12f3056753ff7e894cdf083d930 +EBUILD llvm-16.0.0_pre20221006.ebuild 12758 BLAKE2B 2dd1dbb8e9a6a157d0084f5214e1f066425d238d272f9a12a904a44090ffd0df23de9440df59ad4860763170cd103977b7125a1e30b1e074b94234754d784448 SHA512 8a4ca4f21b9401c74984e29a0d8d6cfbdec2b6a89bb65f736527ce1ce60cd37ade3aa5e3509d4aaff5222d3f4faf26fb6aa48d72f7d7e09333ce864c7cc66119 +EBUILD llvm-16.0.0_pre20221010.ebuild 12532 BLAKE2B fcc2fbe2f7b96e579d99ca52eb6c59ce2bc6fa652e2bf3fecfd88aaaafef9290ced05b5134aac327ceef0af9fb07b643a28405bc1aabf302fdb65c71544f40b8 SHA512 ec2991754334a2c33a08160d35ea099d2bc38f2ee9b2498f06d4864402cead296646aea33ed1240a32f452f360016dfcc066d12f3056753ff7e894cdf083d930 MISC metadata.xml 2654 BLAKE2B c27983265b6c9b33200ee42565648f30a6cc9c51be53a1cb82a3353d7c1f7aa9c9501c58254280c2880ff2d4992b4834e4b5e2f1c9b1c60e9b21945f234b9973 SHA512 b331d9186908762907f5713b00e357785b62afbee83afefac8701beb1a20f7ebd68df4a030bb82c6f9164719d4ccfcaf16c189833ad40e9f5900c36247d9cff2 diff --git a/sys-devel/llvm/llvm-13.0.1.ebuild b/sys-devel/llvm/llvm-13.0.1.ebuild index 2d52bf8cfe60..598476d25566 100644 --- a/sys-devel/llvm/llvm-13.0.1.ebuild +++ b/sys-devel/llvm/llvm-13.0.1.ebuild @@ -174,18 +174,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -367,7 +355,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-14.0.6-r2.ebuild b/sys-devel/llvm/llvm-14.0.6-r2.ebuild index 01b9bbfd4b9d..0f53397cf7ae 100644 --- a/sys-devel/llvm/llvm-14.0.6-r2.ebuild +++ b/sys-devel/llvm/llvm-14.0.6-r2.ebuild @@ -186,18 +186,6 @@ src_prepare() { rm test/Other/ChangePrinters/DotCfg/print-changed-dot-cfg.ll || die } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -381,7 +369,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-15.0.2.ebuild b/sys-devel/llvm/llvm-15.0.2.ebuild index 5f8f61bdd695..79d2ff39fb45 100644 --- a/sys-devel/llvm/llvm-15.0.2.ebuild +++ b/sys-devel/llvm/llvm-15.0.2.ebuild @@ -180,18 +180,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -379,7 +367,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-15.0.3.9999.ebuild b/sys-devel/llvm/llvm-15.0.3.9999.ebuild index 010e27a1349e..1f47134cba77 100644 --- a/sys-devel/llvm/llvm-15.0.3.9999.ebuild +++ b/sys-devel/llvm/llvm-15.0.3.9999.ebuild @@ -180,18 +180,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -379,7 +367,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0.9999.ebuild b/sys-devel/llvm/llvm-16.0.0.9999.ebuild index 946713e022db..4eebbc15117c 100644 --- a/sys-devel/llvm/llvm-16.0.0.9999.ebuild +++ b/sys-devel/llvm/llvm-16.0.0.9999.ebuild @@ -184,18 +184,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -391,7 +379,7 @@ multilib_src_configure() { # the commit id in the SOVERSION to contain the breakage suffix+="git${EGIT_VERSION::8}" fi - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild b/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild index fef201259b9f..91463ab2ffbd 100644 --- a/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild +++ b/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild @@ -184,18 +184,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -391,7 +379,7 @@ multilib_src_configure() { # the commit id in the SOVERSION to contain the breakage suffix+="git${EGIT_VERSION::8}" fi - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild b/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild new file mode 100644 index 000000000000..4eebbc15117c --- /dev/null +++ b/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild @@ -0,0 +1,523 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..11} ) +inherit cmake llvm.org multilib-minimal pax-utils python-any-r1 \ + toolchain-funcs + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="https://llvm.org/" + +# Additional licenses: +# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD. +# 2. xxhash: BSD. +# 3. MD5 code: public-domain. +# 4. ConvertUTF.h: TODO. + +LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD public-domain rc" +SLOT="${LLVM_MAJOR}/${LLVM_SOABI}" +KEYWORDS="" +IUSE=" + +binutils-plugin debug doc exegesis libedit +libffi ncurses test xar + xml z3 zstd +" +RESTRICT="!test? ( test )" + +RDEPEND=" + sys-libs/zlib:0=[${MULTILIB_USEDEP}] + binutils-plugin? ( >=sys-devel/binutils-2.31.1-r4:*[plugins] ) + exegesis? ( dev-libs/libpfm:= ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=dev-libs/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] ) + xar? ( app-arch/xar ) + xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] ) + z3? ( >=sci-mathematics/z3-4.7.1:0=[${MULTILIB_USEDEP}] ) + zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] ) +" +DEPEND=" + ${RDEPEND} + binutils-plugin? ( sys-libs/binutils-libs ) +" +BDEPEND=" + ${PYTHON_DEPS} + dev-lang/perl + >=dev-util/cmake-3.16 + sys-devel/gnuconfig + kernel_Darwin? ( + =sys-devel/binutils-apple-5.1 + ) + doc? ( $(python_gen_any_dep ' + dev-python/recommonmark[${PYTHON_USEDEP}] + dev-python/sphinx[${PYTHON_USEDEP}] + ') ) + libffi? ( virtual/pkgconfig ) +" +# There are no file collisions between these versions but having :0 +# installed means llvm-config there will take precedence. +RDEPEND=" + ${RDEPEND} + !sys-devel/llvm:0 +" +PDEPEND=" + sys-devel/llvm-common + sys-devel/llvm-toolchain-symlinks:${LLVM_MAJOR} + binutils-plugin? ( >=sys-devel/llvmgold-${LLVM_MAJOR} ) +" + +LLVM_COMPONENTS=( llvm cmake third-party ) +LLVM_MANPAGES=1 +LLVM_PATCHSET=9999-r3 +LLVM_USE_TARGETS=provide +llvm.org_set_globals + +python_check_deps() { + use doc || return 0 + + python_has_version -b "dev-python/recommonmark[${PYTHON_USEDEP}]" && + python_has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" +} + +check_uptodate() { + local prod_targets=( + $(sed -n -e '/set(LLVM_ALL_TARGETS/,/)/p' CMakeLists.txt \ + | tail -n +2 | head -n -1) + ) + local all_targets=( + lib/Target/*/ + ) + all_targets=( "${all_targets[@]#lib/Target/}" ) + all_targets=( "${all_targets[@]%/}" ) + + local exp_targets=() i + for i in "${all_targets[@]}"; do + has "${i}" "${prod_targets[@]}" || exp_targets+=( "${i}" ) + done + + if [[ ${exp_targets[*]} != ${ALL_LLVM_EXPERIMENTAL_TARGETS[*]} ]]; then + eqawarn "ALL_LLVM_EXPERIMENTAL_TARGETS is outdated!" + eqawarn " Have: ${ALL_LLVM_EXPERIMENTAL_TARGETS[*]}" + eqawarn "Expected: ${exp_targets[*]}" + eqawarn + fi + + if [[ ${prod_targets[*]} != ${ALL_LLVM_PRODUCTION_TARGETS[*]} ]]; then + eqawarn "ALL_LLVM_PRODUCTION_TARGETS is outdated!" + eqawarn " Have: ${ALL_LLVM_PRODUCTION_TARGETS[*]}" + eqawarn "Expected: ${prod_targets[*]}" + fi +} + +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 + # shared libs + LLVM|LLVMgold) + ;; + # TableGen lib + deps + LLVMDemangle|LLVMSupport|LLVMTableGen) + ;; + # static libs + LLVM*) + continue + ;; + # meta-targets + distribution|llvm-libraries) + continue + ;; + # used only w/ USE=doc + docs-llvm-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 +} + +src_prepare() { + # disable use of SDK on OSX, bug #568758 + sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die + + # Update config.guess to support more systems + cp "${BROOT}/usr/share/gnuconfig/config.guess" cmake/ || die + + # Verify that the ebuild is up-to-date + check_uptodate + + llvm.org_src_prepare +} + +get_distribution_components() { + local sep=${1-;} + + local out=( + # shared libs + LLVM + LTO + Remarks + + # tools + llvm-config + + # common stuff + cmake-exports + llvm-headers + + # libraries needed for clang-tblgen + LLVMDemangle + LLVMSupport + LLVMTableGen + ) + + if multilib_is_native_abi; then + out+=( + # utilities + llvm-tblgen + FileCheck + llvm-PerfectShuffle + count + not + yaml-bench + UnicodeNameMappingGenerator + + # tools + bugpoint + dsymutil + llc + lli + lli-child-target + llvm-addr2line + llvm-ar + llvm-as + llvm-bcanalyzer + llvm-bitcode-strip + llvm-c-test + llvm-cat + llvm-cfi-verify + llvm-config + llvm-cov + llvm-cvtres + llvm-cxxdump + llvm-cxxfilt + llvm-cxxmap + llvm-debuginfod + llvm-debuginfod-find + llvm-diff + llvm-dis + llvm-dlltool + llvm-dwarfdump + llvm-dwarfutil + llvm-dwp + llvm-exegesis + llvm-extract + llvm-gsymutil + llvm-ifs + llvm-install-name-tool + llvm-jitlink + llvm-jitlink-executor + llvm-lib + llvm-libtool-darwin + llvm-link + llvm-lipo + llvm-lto + llvm-lto2 + llvm-mc + llvm-mca + llvm-ml + llvm-modextract + llvm-mt + llvm-nm + llvm-objcopy + llvm-objdump + llvm-opt-report + llvm-otool + llvm-pdbutil + llvm-profdata + llvm-profgen + llvm-ranlib + llvm-rc + llvm-readelf + llvm-readobj + llvm-reduce + llvm-remark-size-diff + llvm-remarkutil + llvm-rtdyld + llvm-sim + llvm-size + llvm-split + llvm-stress + llvm-strings + llvm-strip + llvm-symbolizer + llvm-tapi-diff + llvm-tli-checker + llvm-undname + llvm-windres + llvm-xray + obj2yaml + opt + sancov + sanstats + split-file + verify-uselistorder + yaml2obj + + # python modules + opt-viewer + ) + + if llvm_are_manpages_built; then + out+=( + # manpages + docs-dsymutil-man + docs-llvm-dwarfdump-man + docs-llvm-man + ) + fi + use doc && out+=( + docs-llvm-html + ) + + use binutils-plugin && out+=( + LLVMgold + ) + fi + + printf "%s${sep}" "${out[@]}" +} + +multilib_src_configure() { + local ffi_cflags ffi_ldflags + if use libffi; then + ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi) + ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi) + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + # disable appending VCS revision to the version to improve + # direct cache hit ratio + -DLLVM_APPEND_VC_REV=OFF + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}" + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + + -DBUILD_SHARED_LIBS=OFF + -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components) + + # cheap hack: LLVM combines both anyway, and the only difference + # is that the former list is explicitly verified at cmake time + -DLLVM_TARGETS_TO_BUILD="" + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" + -DLLVM_BUILD_TESTS=$(usex test) + + -DLLVM_ENABLE_FFI=$(usex libffi) + -DLLVM_ENABLE_LIBEDIT=$(usex libedit) + -DLLVM_ENABLE_TERMINFO=$(usex ncurses) + -DLLVM_ENABLE_LIBXML2=$(usex xml) + -DLLVM_ENABLE_ASSERTIONS=$(usex debug) + -DLLVM_ENABLE_LIBPFM=$(usex exegesis) + -DLLVM_ENABLE_EH=ON + -DLLVM_ENABLE_RTTI=ON + -DLLVM_ENABLE_Z3_SOLVER=$(usex z3) + -DLLVM_ENABLE_ZSTD=$(usex zstd) + + -DLLVM_HOST_TRIPLE="${CHOST}" + + -DFFI_INCLUDE_DIR="${ffi_cflags#-I}" + -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}" + # used only for llvm-objdump tool + -DLLVM_HAVE_LIBXAR=$(multilib_native_usex xar 1 0) + + -DPython3_EXECUTABLE="${PYTHON}" + + # disable OCaml bindings (now in dev-ml/llvm-ocaml) + -DOCAMLFIND=NO + ) + + local suffix= + if [[ -n ${EGIT_VERSION} && ${EGIT_BRANCH} != release/* ]]; then + # the ABI of the main branch is not stable, so let's include + # the commit id in the SOVERSION to contain the breakage + suffix+="git${EGIT_VERSION::8}" + fi + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then + # Smart hack: alter version suffix -> SOVERSION when linking + # against libc++. This way we won't end up mixing LLVM libc++ + # libraries with libstdc++ clang, and the other way around. + suffix+="+libcxx" + mycmakeargs+=( + -DLLVM_ENABLE_LIBCXX=ON + ) + fi + mycmakeargs+=( + -DLLVM_VERSION_SUFFIX="${suffix}" + ) + + use test && mycmakeargs+=( + -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+=( + -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man" + -DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" + -DSPHINX_WARNINGS_AS_ERRORS=OFF + ) + fi + + mycmakeargs+=( + -DLLVM_BUILD_DOCS=${build_docs} + -DLLVM_ENABLE_OCAMLDOC=OFF + -DLLVM_ENABLE_SPHINX=${build_docs} + -DLLVM_ENABLE_DOXYGEN=OFF + -DLLVM_INSTALL_UTILS=ON + ) + use binutils-plugin && mycmakeargs+=( + -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include + ) + fi + + if tc-is-cross-compiler; then + local tblgen="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/llvm-tblgen" + [[ -x "${tblgen}" ]] \ + || die "${tblgen} not found or usable" + mycmakeargs+=( + -DCMAKE_CROSSCOMPILING=ON + -DLLVM_TABLEGEN="${tblgen}" + ) + fi + + # workaround BMI bug in gcc-7 (fixed in 7.4) + # https://bugs.gentoo.org/649880 + # apply only to x86, https://bugs.gentoo.org/650506 + if tc-is-gcc && [[ ${MULTILIB_ABI_FLAG} == abi_x86* ]] && + [[ $(gcc-major-version) -eq 7 && $(gcc-minor-version) -lt 4 ]] + then + local CFLAGS="${CFLAGS} -mno-bmi" + local CXXFLAGS="${CXXFLAGS} -mno-bmi" + 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 + + grep -q -E "^CMAKE_PROJECT_VERSION_MAJOR(:.*)?=${LLVM_MAJOR}$" \ + CMakeCache.txt || + die "Incorrect version, did you update _LLVM_MASTER_MAJOR?" + multilib_is_native_abi && check_distribution_components +} + +multilib_src_compile() { + cmake_build distribution + + pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld + pax-mark m "${BUILD_DIR}"/bin/lli + pax-mark m "${BUILD_DIR}"/bin/lli-child-target + + if use test; then + pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests + pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests + pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests + fi +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + cmake_build check +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/lib/llvm/${LLVM_MAJOR}/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/llvm-config.h + ) + + local LLVM_LDPATHS=() + multilib-minimal_src_install + + # move wrapped headers back + mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include || die +} + +multilib_src_install() { + DESTDIR=${D} cmake_build install-distribution + + # move headers to /usr/include for wrapping + rm -rf "${ED}"/usr/include || die + mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include "${ED}"/usr/include || die + + LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)" ) +} + +multilib_src_install_all() { + local revord=$(( 9999 - ${LLVM_MAJOR} )) + newenvd - "60llvm-${revord}" <<-_EOF_ + PATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin" + # we need to duplicate it in ROOTPATH for Portage to respect... + ROOTPATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin" + MANPATH="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man" + LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )" + _EOF_ + + docompress "/usr/lib/llvm/${LLVM_MAJOR}/share/man" + llvm_install_manpages +} + +pkg_postinst() { + elog "You can find additional opt-viewer utility scripts in:" + elog " ${EROOT}/usr/lib/llvm/${LLVM_MAJOR}/share/opt-viewer" + elog "To use these scripts, you will need Python along with the following" + elog "packages:" + elog " dev-python/pygments (for opt-viewer)" + elog " dev-python/pyyaml (for all of them)" +} -- cgit v1.2.3