mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
139 lines
4.2 KiB
Bash
139 lines
4.2 KiB
Bash
# Maintainer: Evangelos Foutras <foutrelis@archlinux.org>
|
|
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
|
|
|
|
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
# - llvm17 version
|
|
|
|
pkgname=('llvm17' 'llvm17-libs')
|
|
pkgver=17.0.6
|
|
pkgrel=1
|
|
arch=('x86_64')
|
|
url="https://llvm.org/"
|
|
license=('custom:Apache 2.0 with LLVM Exception')
|
|
makedepends=('cmake' 'ninja' 'zlib' 'zstd' 'libffi' 'libedit' 'ncurses'
|
|
'libxml2' 'python')
|
|
checkdepends=('python-psutil')
|
|
options=('staticlibs' '!lto') # https://github.com/llvm/llvm-project/issues/57740
|
|
_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
|
|
source=($_source_base/llvm-$pkgver.src.tar.xz{,.sig}
|
|
$_source_base/cmake-$pkgver.src.tar.xz{,.sig}
|
|
$_source_base/third-party-$pkgver.src.tar.xz{,.sig})
|
|
sha256sums=('b638167da139126ca11917b6880207cc6e8f9d1cbb1a48d87d017f697ef78188'
|
|
'SKIP'
|
|
'807f069c54dc20cb47b21c1f6acafdd9c649f3ae015609040d6182cab01140f4'
|
|
'SKIP'
|
|
'3054d0a9c9375dab1a4539cc2cc45ab340341c5d71475f9599ba7752e222947b'
|
|
'SKIP')
|
|
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
|
|
|
|
# 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() {
|
|
rename -v -- "-$pkgver.src" '' {cmake,third-party}-$pkgver.src
|
|
cd llvm-$pkgver.src
|
|
mkdir build
|
|
}
|
|
|
|
build() {
|
|
cd llvm-$pkgver.src/build
|
|
|
|
# Build only minimal debug info to reduce size
|
|
CFLAGS=${CFLAGS/-g /-g1 }
|
|
CXXFLAGS=${CXXFLAGS/-g /-g1 }
|
|
|
|
local cmake_args=(
|
|
-G Ninja
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm17
|
|
-DCMAKE_SKIP_RPATH=ON
|
|
-DLLVM_BINUTILS_INCDIR=/usr/include
|
|
-DLLVM_BUILD_LLVM_DYLIB=ON
|
|
-DLLVM_BUILD_TESTS=ON
|
|
-DLLVM_ENABLE_BINDINGS=OFF
|
|
-DLLVM_ENABLE_FFI=ON
|
|
-DLLVM_ENABLE_RTTI=ON
|
|
-DLLVM_HOST_TRIPLE=$CHOST
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
|
-DLLVM_INSTALL_UTILS=ON
|
|
-DLLVM_LINK_LLVM_DYLIB=ON
|
|
-DLLVM_USE_PERF=ON
|
|
)
|
|
|
|
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
|
|
}
|
|
|
|
check() {
|
|
cd llvm-$pkgver.src/build
|
|
LD_LIBRARY_PATH=$PWD/lib ninja check
|
|
}
|
|
|
|
package_llvm17() {
|
|
pkgdesc="Compiler infrastructure (LLVM 17)"
|
|
depends=('llvm17-libs' 'perl')
|
|
|
|
cd llvm-$pkgver.src/build
|
|
|
|
DESTDIR="$pkgdir" ninja install-distribution
|
|
|
|
# The runtime libraries go into llvm17-libs
|
|
mv -f "$pkgdir"/usr/lib/llvm17/lib/libLLVM-{17,$pkgver}.so "$srcdir/"
|
|
mv -f "$pkgdir"/usr/lib/llvm17/lib/LLVMgold.so "$srcdir/"
|
|
|
|
# Create versioned symlinks from /usr/bin/ to /usr/lib/llvm17/bin/
|
|
install -d "$pkgdir/usr/bin"
|
|
local _binary
|
|
for _binary in "$pkgdir"/usr/lib/llvm17/bin/*; do
|
|
local _basename=${_binary##*/}
|
|
ln -s ../lib/llvm17/bin/$_basename "$pkgdir/usr/bin/$_basename-17"
|
|
done
|
|
|
|
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
}
|
|
|
|
package_llvm17-libs() {
|
|
pkgdesc="LLVM 17 runtime libraries"
|
|
depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
|
|
|
|
install -d "$pkgdir/usr/lib/llvm17/lib"
|
|
cp -P "$srcdir"/libLLVM-{17,$pkgver}.so "$pkgdir/usr/lib/"
|
|
ln -s ../../libLLVM-17.so "$pkgdir/usr/lib/llvm17/lib/libLLVM-17.so"
|
|
ln -s ../../libLLVM-17.so "$pkgdir/usr/lib/llvm17/lib/libLLVM-$pkgver.so"
|
|
cp -P "$srcdir"/LLVMgold.so "$pkgdir/usr/lib/llvm17/lib/"
|
|
|
|
install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
|
|
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
}
|
|
|
|
# vim:set ts=2 sw=2 et:
|