[arch-commits] Commit in llvm11/trunk (PKGBUILD)
Evangelos Foutras
foutrelis at archlinux.org
Thu May 27 13:49:11 UTC 2021
Date: Thursday, May 27, 2021 @ 13:49:10
Author: foutrelis
Revision: 416535
upgpkg: llvm11 11.1.0-2: avoid CMake reference to LLVMgold.so
https://bugs.archlinux.org/task/70437
Modified:
llvm11/trunk/PKGBUILD
----------+
PKGBUILD | 52 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 13 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-05-27 13:37:30 UTC (rev 416534)
+++ PKGBUILD 2021-05-27 13:49:10 UTC (rev 416535)
@@ -3,7 +3,7 @@
pkgname=('llvm11' 'llvm11-libs')
pkgver=11.1.0
-pkgrel=1
+pkgrel=2
arch=('x86_64')
url="https://llvm.org/"
license=('custom:Apache 2.0 with LLVM Exception')
@@ -21,6 +21,23 @@
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
+# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
+# CMake reference to LLVMgold; inspired by Gentoo
+_get_distribution_components() {
+ local target
+ ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do
+ case $target in
+ llvm-libraries|distribution)
+ continue
+ ;;
+ LLVMgold)
+ continue
+ ;;
+ esac
+ echo $target
+ done
+}
+
prepare() {
cd "$srcdir/llvm-$pkgver.src"
mkdir build
@@ -35,17 +52,26 @@
build() {
cd "$srcdir/llvm-$pkgver.src/build"
- cmake .. -G Ninja \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DLLVM_HOST_TRIPLE=$CHOST \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
- -DLLVM_LINK_LLVM_DYLIB=ON \
- -DLLVM_INSTALL_UTILS=ON \
- -DLLVM_ENABLE_RTTI=ON \
- -DLLVM_ENABLE_FFI=ON \
- -DLLVM_BUILD_TESTS=ON \
+ local cmake_args=(
+ -G Ninja
+ -DCMAKE_BUILD_TYPE=Release
+ -DCMAKE_INSTALL_PREFIX=/usr
+ -DLLVM_HOST_TRIPLE=$CHOST
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DLLVM_INSTALL_UTILS=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_ENABLE_FFI=ON
+ -DLLVM_BUILD_TESTS=ON
-DLLVM_BINUTILS_INCDIR=/usr/include
+ )
+
+ cmake .. "${cmake_args[@]}"
+ local distribution_components=$(_get_distribution_components | paste -sd\;)
+ test -n "$distribution_components"
+ cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
+
+ cmake .. "${cmake_args[@]}"
ninja
}
@@ -61,7 +87,7 @@
cd "$srcdir/llvm-$pkgver.src/build"
- DESTDIR="$pkgdir" ninja install
+ DESTDIR="$pkgdir" ninja install-distribution
# Include lit for running lit-based tests in other projects
pushd ../utils/lit
@@ -72,7 +98,7 @@
mv -f "$pkgdir"/usr/lib/lib{LLVM-*.so,{LTO,Remarks}.so.*} "$srcdir"
# Remove files which conflict with llvm-libs
- rm "$pkgdir"/usr/lib/{LLVMgold,lib{LLVM,LTO,Remarks}}.so
+ rm "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}.so
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
More information about the arch-commits
mailing list