summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-09-10 13:52:29 +0200
committerMichał Górny <mgorny@gentoo.org>2019-10-02 22:27:34 +0200
commit22a57fe378193e3fff45dac0d668eaeecc3aee9f (patch)
treea46ea0402146355942e710777fcb3e1ee6f97823 /sys-devel/llvm
parentgames-server/minecraft-server: amd64 stable wrt bug #695344 (diff)
downloadgentoo-22a57fe378193e3fff45dac0d668eaeecc3aee9f.tar.gz
gentoo-22a57fe378193e3fff45dac0d668eaeecc3aee9f.tar.bz2
gentoo-22a57fe378193e3fff45dac0d668eaeecc3aee9f.zip
sys-devel/llvm: Switch 10+ to dylib build
Build and install the single dylib instead of split shared libs in 10+. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-devel/llvm')
-rw-r--r--sys-devel/llvm/llvm-10.0.0.9999.ebuild182
1 files changed, 180 insertions, 2 deletions
diff --git a/sys-devel/llvm/llvm-10.0.0.9999.ebuild b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
index 92a9c5ae1c1c..eccfd8a533b1 100644
--- a/sys-devel/llvm/llvm-10.0.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
@@ -122,6 +122,62 @@ check_live_ebuild() {
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
+ ;;
+ 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() {
# Fix llvm-config for shared linking and sane flags
# https://bugs.gentoo.org/show_bug.cgi?id=565358
@@ -149,6 +205,122 @@ is_libcxx_linked() {
[[ ${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
+
+ # tools
+ bugpoint
+ dsymutil
+ llc
+ lli
+ lli-child-target
+ llvm-addr2line
+ llvm-ar
+ llvm-as
+ llvm-bcanalyzer
+ llvm-c-test
+ llvm-cat
+ llvm-cfi-verify
+ llvm-config
+ llvm-cov
+ llvm-cvtres
+ llvm-cxxdump
+ llvm-cxxfilt
+ llvm-cxxmap
+ llvm-diff
+ llvm-dis
+ llvm-dlltool
+ llvm-dwarfdump
+ llvm-dwp
+ llvm-elfabi
+ llvm-exegesis
+ llvm-extract
+ llvm-ifs
+ llvm-jitlink
+ llvm-lib
+ llvm-link
+ llvm-lipo
+ llvm-lto
+ llvm-lto2
+ llvm-mc
+ llvm-mca
+ llvm-modextract
+ llvm-mt
+ llvm-nm
+ llvm-objcopy
+ llvm-objdump
+ llvm-opt-report
+ llvm-pdbutil
+ llvm-profdata
+ llvm-ranlib
+ llvm-rc
+ llvm-readelf
+ llvm-readobj
+ llvm-reduce
+ llvm-rtdyld
+ llvm-size
+ llvm-split
+ llvm-stress
+ llvm-strings
+ llvm-strip
+ llvm-symbolizer
+ llvm-undname
+ llvm-xray
+ obj2yaml
+ opt
+ sancov
+ sanstats
+ verify-uselistorder
+ yaml2obj
+
+ # python modules
+ opt-viewer
+ )
+
+ use doc && out+=(
+ docs-dsymutil-man
+ docs-llvm-dwarfdump-man
+ docs-llvm-man
+ docs-llvm-html
+ )
+
+ use gold && out+=(
+ LLVMgold
+ )
+ fi
+
+ printf "%s${sep}" "${out[@]}"
+}
+
multilib_src_configure() {
local ffi_cflags ffi_ldflags
if use libffi; then
@@ -164,7 +336,11 @@ multilib_src_configure() {
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
- -DBUILD_SHARED_LIBS=ON
+ -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=""
@@ -256,6 +432,8 @@ multilib_src_configure() {
# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
cmake-utils_src_configure
+
+ multilib_is_native_abi && check_distribution_components
}
multilib_src_compile() {
@@ -295,7 +473,7 @@ src_install() {
}
multilib_src_install() {
- cmake-utils_src_install
+ DESTDIR=${D} cmake-utils_src_make install-distribution
# move headers to /usr/include for wrapping
rm -rf "${ED}"/usr/include || die