Date: Sunday, February 26, 2023 @ 11:24:15
Author: foutrelis
Revision: 469624
upgpkg: llvm 15.0.7-2: drop most static libs (FS#77644)
We're building with LLVM_BUILD_LLVM_DYLIB=ON so there is little point to
shipping static libs. Let's see if anything breaks after we remove them.
Modified:
llvm/trunk/PKGBUILD
----------+
PKGBUILD | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2023-02-26 11:00:39 UTC (rev 469623)
+++ PKGBUILD 2023-02-26 11:24:15 UTC (rev 469624)
@@ -3,7 +3,7 @@
pkgname=('llvm' 'llvm-libs')
pkgver=15.0.7
-pkgrel=1
+pkgrel=2
arch=('x86_64')
url="https://llvm.org/"
license=('custom:Apache 2.0 with LLVM Exception')
@@ -23,6 +23,34 @@
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard
<[email protected]>
'D574BD5D1D0E98895E3BF90044F2485E45D59042') # Tobias Hieta
<[email protected]>
+# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
+# installing static libraries; 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
+ ;;
+ # shared libraries
+ LLVM|LLVMgold)
+ ;;
+ # libraries needed for clang-tblgen
+ LLVMDemangle|LLVMSupport|LLVMTableGen)
+ ;;
+ # exclude static libraries
+ LLVM*)
+ continue
+ ;;
+ # exclude llvm-exegesis (doesn't seem useful without libpfm)
+ llvm-exegesis)
+ continue
+ ;;
+ esac
+ echo $target
+ done
+}
+
prepare() {
mv cmake{-$pkgver.src,}
cd llvm-$pkgver.src
@@ -57,7 +85,13 @@
-DLLVM_USE_PERF=ON
-DSPHINX_WARNINGS_AS_ERRORS=OFF
)
+
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
}
@@ -72,7 +106,7 @@
cd 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