commit:     2aae4ce718676a894a7f6d607558a5faf14b3dcf
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  4 11:38:38 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Oct  4 17:14:38 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2aae4ce7

sys-devel/llvm: Bump to 15.0.2

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-devel/llvm/Manifest           |   3 +
 sys-devel/llvm/llvm-15.0.2.ebuild | 528 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 531 insertions(+)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index 265bacec8071..2404d1051bcb 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -4,10 +4,13 @@ DIST llvm-15.0.1-manpages.tar.bz2 228787 BLAKE2B 
7a43d98cf8546457b6c8557d47c5439
 DIST llvm-gentoo-patchset-13.0.1.tar.xz 6288 BLAKE2B 
899222b962486e924e4f8a2b574d285531a3f87af9385ff68c81db92aa224a0cde6d4ee049b5405056bedb4b232b50e1d5840024071a4a215f6311853304c92d
 SHA512 
b2805337f1deca626768a44c5e7ac9ed16e0c31bead1647d44a493a8123c1b8e8f1c8ceee3536bcc6fa87fdd3fcec408229f701adf30eff07e7ef9889b847b01
 DIST llvm-gentoo-patchset-14.0.6-r2.tar.xz 16120 BLAKE2B 
e12e522fdb7ba505693c679cb09cc8e00e6a954df195c86c2af4dbf1b68334a405b8dcc45f2e28b5e5e0b7e9d5eb7ba907337027927371b7a3b7784ff8aae7e0
 SHA512 
8a5ea71c30fc0727cc855dd812bbcb6d5f51c80c98eb3d5b80258d5c5eaab1310edc9d53ae63c2ca827abec68e2912c4b69ef0da351ff883fb30545a61e1d09c
 DIST llvm-gentoo-patchset-15.0.1.tar.xz 3516 BLAKE2B 
1bc54df5272eb743b5f736cca2bd5a90cf371ee759ba3aa787910ce6cc58c5c61c3eae226a0619aa9c4e9b8639149d53582cf52fad4014e65a83f52eaeaf5b61
 SHA512 
380ed5ffdeacf97bf76d49bec90f8f46c53f50fdd46983ab77afda4aaa6bdc671c0e179fe9dca1d8e50e377080675575f72ca2b05582349f8710e1b3c2dc76a6
+DIST llvm-gentoo-patchset-15.0.2-r2.tar.xz 16356 BLAKE2B 
a2a4e61b4e44db2673429c66e456b74ce6e2c875662ef4ba9b0c4f49c6e453e7171238517269f8724fe33e3258e34d1f4cd37b57a7108c5ea35156a2b3a333aa
 SHA512 
e654c543b1b169b4e0fe33b8ff7da163a1e7b43d9c82218968189221aac25efc8a1ef309edf5024af8ea69aea18148dde484443951cb8072ebf68d2e590d2569
 DIST llvm-gentoo-patchset-9999-r3.tar.xz 4076 BLAKE2B 
30bdf740606a1718ae45d850803385d425b656fbbe0250f587cad54f55272e3617d5ee0d04f534a58f87408b0a2dea322ebf1bb8cd653a2beba21d0bc5778c62
 SHA512 
2c7080ffd09d7dcf4c72a97044a5c63ab895250721d60270bc51c2095aef5f9039781892b4c0d14e942611686153f874a1f52a1c854bb8ca093383c08bdc005a
 DIST llvm-project-14.0.6.src.tar.xz 105618228 BLAKE2B 
ee67c5407df8cef493b9c0004f15e428f22a536a17e5f4e3eb29a003b8a8ec0abe0fa3e072591161d5f30ef7d8867c1ce34d1b341ad858e93c00263499941a99
 SHA512 
6fc6eeb60fac698702d1aac495fc0161eb7216a1f8db2020af8fccec5837831f7cc20dc2a169bf4f0b5f520748280b4a86621f3697d622aa58faaa45dbfaad13
 DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B 
cb658ad43d8ab6c43a5773aedadf0569c97b5ee4b1bd58eceb10e1879a30880c741c3d66bedd462c892309b688fb7b2673115a62d1f74d71ee375a578de9547f
 SHA512 
b4a7b368532a7a4a24376cfa7db8f6d3478f6d4446474342fc00b474ecf466330cd0f16783209263c4c72d5fc7ddedfb11b95578842e700cfb7ee0bb34cc95d6
 DIST llvm-project-15.0.1.src.tar.xz 112068688 BLAKE2B 
8fd6690445f7cbc8b47a7c1dd1f2c4fbc39f9a97f9d4a0015d466726454b090b0d1ff9b0d926eba7065e84782901687f74e6540a36dc6656a93f3c92c7bc7e06
 SHA512 
cef84bc173118a30db3ece5e5c6f874bf689c77afc40a4792fdcb7556555ac14a8e6de1dc811755405e5d162d63bc69abaecba30d220a42765160d69f0073fda
 DIST llvm-project-15.0.1.src.tar.xz.sig 438 BLAKE2B 
d8f634adab531bb19178fb27bc83b3a90c856e9402dd5af700f9af43813f68d20c21b9112dd95e9f6f10609ee51ed5aaf77edb96ca16fb93136b8aea432affd3
 SHA512 
cbf2570840d8dc12f6436c495a23cf9d439ee195755c01a6d1d5bcc20133599dc956dc43a0f5016698e3c9a960826f5f3c2840a73f993467e275856a67999fda
+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-215c9fa4deac9ec6b4e504843830551f03b60620.tar.gz 168942763 
BLAKE2B 
545c7c372c38667b7d811753464e91134aae600060d9054979eab8735d535a72d6bbb33a6008dc81f3b14513f58791ca3b8c3068e62ff146ccb14f32abb41a32
 SHA512 
d0c244357650ef5d56bc7afd836cd747cc2cce92d5f7fb4ddec3414e5bafe4e611acb2a7ff42343c184caad14a30fa9a6ced7e493df3ceb06fe8f9445aeb5a9b
 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 
2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b
 SHA512 
9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f

diff --git a/sys-devel/llvm/llvm-15.0.2.ebuild 
b/sys-devel/llvm/llvm-15.0.2.ebuild
new file mode 100644
index 000000000000..5f8f61bdd695
--- /dev/null
+++ b/sys-devel/llvm/llvm-15.0.2.ebuild
@@ -0,0 +1,528 @@
+# 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="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux 
~ppc-macos ~x64-macos"
+IUSE="+binutils-plugin debug doc exegesis libedit +libffi ncurses test xar xml 
z3"
+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}] )
+"
+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-libs/libcxx-$(ver_cut 1-3).9999
+               >=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:${SLOT}
+       binutils-plugin? ( >=sys-devel/llvmgold-${SLOT} )
+"
+
+LLVM_COMPONENTS=( llvm cmake third-party )
+LLVM_MANPAGES=1
+LLVM_PATCHSET=${PV/_/-}-r2
+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
+}
+
+# Is LLVM being linked against libc++?
+is_libcxx_linked() {
+       local code='#include <ciso646>
+#if defined(_LIBCPP_VERSION)
+       HAVE_LIBCXX
+#endif
+'
+       local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - 
<<<"${code}") || return 1
+
+       [[ ${out} == *HAVE_LIBCXX* ]]
+}
+
+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-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/${SLOT}"
+               -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_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
+       )
+
+       if is_libcxx_linked; 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.
+               mycmakeargs+=(
+                       -DLLVM_VERSION_SUFFIX="libcxx"
+                       -DLLVM_ENABLE_LIBCXX=ON
+               )
+       fi
+
+#      Note: go bindings have no CMake rules at the moment
+#      but let's kill the check in case they are introduced
+#      if ! multilib_is_native_abi || ! use go; then
+               mycmakeargs+=(
+                       -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
+               )
+#      fi
+
+       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/${SLOT}/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/${SLOT}/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(:.*)?=$(ver_cut 1)$" \
+                       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/${SLOT}/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/${SLOT}/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/${SLOT}/include "${ED}"/usr/include || die
+
+       LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" )
+}
+
+multilib_src_install_all() {
+       local revord=$(( 9999 - ${SLOT} ))
+       newenvd - "60llvm-${revord}" <<-_EOF_
+               PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+               # we need to duplicate it in ROOTPATH for Portage to respect...
+               ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+               MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+               LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )"
+       _EOF_
+
+       docompress "/usr/lib/llvm/${SLOT}/share/man"
+       llvm_install_manpages
+}
+
+pkg_postinst() {
+       elog "You can find additional opt-viewer utility scripts in:"
+       elog "  ${EROOT}/usr/lib/llvm/${SLOT}/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)"
+}

Reply via email to