summaryrefslogtreecommitdiff
path: root/sys-devel/llvm/llvm-10.0.0.9999.ebuild
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/llvm/llvm-10.0.0.9999.ebuild')
-rw-r--r--sys-devel/llvm/llvm-10.0.0.9999.ebuild223
1 files changed, 220 insertions, 3 deletions
diff --git a/sys-devel/llvm/llvm-10.0.0.9999.ebuild b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
index e632d6c930c6..77a6c8423834 100644
--- a/sys-devel/llvm/llvm-10.0.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-10.0.0.9999.ebuild
@@ -18,7 +18,7 @@ EGIT_REPO_URI="https://git.llvm.org/git/llvm.git
https://github.com/llvm-mirror/llvm.git"
# Those are in lib/Targets, without explicit CMakeLists.txt mention
-ALL_LLVM_EXPERIMENTAL_TARGETS=( AVR Nios2 )
+ALL_LLVM_EXPERIMENTAL_TARGETS=( ARC AVR )
# Keep in sync with CMakeLists.txt
ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore
@@ -59,6 +59,7 @@ DEPEND="${RDEPEND}
gold? ( sys-libs/binutils-libs )"
BDEPEND="
dev-lang/perl
+ sys-devel/gnuconfig
|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
)
@@ -90,6 +91,94 @@ python_check_deps() {
has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]"
}
+check_live_ebuild() {
+ 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
+ # reorder
+ all_targets=( "${prod_targets[@]}" "${exp_targets[@]}" )
+
+ 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 [[ ${all_targets[*]} != ${ALL_LLVM_TARGETS[*]#llvm_targets_} ]]; then
+ eqawarn "ALL_LLVM_TARGETS is outdated!"
+ eqawarn " Have: ${ALL_LLVM_TARGETS[*]#llvm_targets_}"
+ eqawarn "Expected: ${all_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
+ ;;
+ 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
@@ -98,8 +187,14 @@ 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
+
# User patches + QA
cmake-utils_src_prepare
+
+ # Verify that the live ebuild is up-to-date
+ check_live_ebuild
}
# Is LLVM being linked against libc++?
@@ -114,6 +209,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
@@ -129,7 +340,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=""
@@ -221,6 +436,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() {
@@ -260,7 +477,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