jobextra/llvm15/PKGBUILD

147 lines
4.5 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=('llvm15' 'llvm15-libs')
pkgver=15.0.7
pkgrel=01
url="https://llvm.org/"
makedepends=('cmake' 'ninja' 'zlib' '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})
# 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
# 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/llvm15
-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_llvm15() {
pkgdesc="Compiler infrastructure (LLVM 15)"
depends=('llvm15-libs' 'perl')
cd llvm-$pkgver.src/build
DESTDIR="$pkgdir" ninja install-distribution
# The runtime libraries go into llvm15-libs
mv -f "$pkgdir"/usr/lib/llvm15/lib/libLLVM-{15,$pkgver}.so "$srcdir/"
mv -f "$pkgdir"/usr/lib/llvm15/lib/LLVMgold.so "$srcdir/"
# Create versioned symlinks from /usr/bin/ to /usr/lib/llvm15/bin/
install -d "$pkgdir/usr/bin"
local _binary
for _binary in "$pkgdir"/usr/lib/llvm15/bin/*; do
local _basename=${_binary##*/}
ln -s ../lib/llvm15/bin/$_basename "$pkgdir/usr/bin/$_basename-15"
done
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_llvm15-libs() {
pkgdesc="LLVM 15 runtime libraries"
depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
install -d "$pkgdir/usr/lib/llvm15/lib"
cp -P \
"$srcdir"/libLLVM-{15,$pkgver}.so \
"$pkgdir/usr/lib/"
ln -s ../../libLLVM-15.so "$pkgdir/usr/lib/llvm15/lib/libLLVM-15.so"
ln -s ../../libLLVM-15.so "$pkgdir/usr/lib/llvm15/lib/libLLVM-$pkgver.so"
cp -P "$srcdir"/LLVMgold.so "$pkgdir/usr/lib/llvm15/lib/"
install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('custom:Apache 2.0 with LLVM Exception')
validpgpkeys=(474E22316ABF4785A88C6E8EA2C794A986419D8A) # Tom Stellard <tstellar@redhat.com>
sha256sums=(4ad8b2cc8003c86d0078d15d987d84e3a739f24aae9033865c027abae93ee7a4 # llvm-15.0.7.src.tar.xz
6567588e261c7df6b06316a627ff46e4028c6e73f9e1fe5b09aba66b3a7a3bff # llvm-15.0.7.src.tar.xz.sig
8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea # cmake-15.0.7.src.tar.xz
ab0237b061d53350622796343d2a130d29086d42be93b47f616acdeda81b36eb) # cmake-15.0.7.src.tar.xz.sig
## 44ddd436a0ee15eff52236462495eab9a524ee11821bce0f4a9a1dae5e840c01 llvm15-15.0.7-01-x86_64.pkg.tar.lz
## 83a30018a10355b797693b99e02c4af91b8722d705b445c7b13a7d84755287f7 llvm15-libs-15.0.7-01-x86_64.pkg.tar.lz