jobextra/llvm/PKGBUILD

179 lines
5.9 KiB
Bash
Raw Normal View History

2022-03-20 13:34:07 +01:00
#!/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 |---------------------------------------
2022-07-28 22:40:01 +02:00
pkgname=('llvm' 'llvm-libs')
2023-01-22 15:03:17 +01:00
pkgver=15.0.7
2023-04-30 04:16:33 +02:00
pkgrel=03
2022-03-20 13:34:07 +01:00
url="https://llvm.org/"
makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2'
2022-07-28 22:40:01 +02:00
'python-setuptools' 'python-psutil' 'python-sphinx'
2023-01-22 15:03:17 +01:00
'python-recommonmark' 'zlib')
2022-03-20 13:34:07 +01:00
options=('staticlibs' '!lto') # Getting thousands of test failures with LTO
#options=('staticlibs' 'debug' '!lto') #### uncomment this to get debug pkg
2022-03-20 13:34:07 +01:00
_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
source=($_source_base/$pkgname-$pkgver.src.tar.xz{,.sig}
2023-01-22 15:03:17 +01:00
$_source_base/cmake-$pkgver.src.tar.xz{,.sig}
2022-03-20 13:34:07 +01:00
llvm-config.h)
sha256sums=('4ad8b2cc8003c86d0078d15d987d84e3a739f24aae9033865c027abae93ee7a4'
'SKIP'
'8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea'
'SKIP'
'597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
'D574BD5D1D0E98895E3BF90044F2485E45D59042') # Tobias Hieta <tobias@hieta.se>
# 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
}
2022-03-20 13:34:07 +01:00
prepare() {
2023-01-22 15:03:17 +01:00
mv cmake{-$pkgver.src,}
2022-06-28 08:12:23 +02:00
cd llvm-$pkgver.src
2023-01-22 15:03:17 +01:00
# # https://github.com/llvm/llvm-project/issues/49689
# patch -Np2 -i ../llvm-coroutines-ubsan.patch
2022-03-20 13:34:07 +01:00
mkdir build
}
build() {
2022-06-28 08:12:23 +02:00
cd llvm-$pkgver.src/build
# Build only minimal debug info to reduce size
2023-01-22 15:03:17 +01:00
CFLAGS=${CFLAGS/-g /-g1 }
CXXFLAGS=${CXXFLAGS/-g /-g1 }
2022-06-28 08:12:23 +02:00
local cmake_args=(
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_DOCDIR=share/doc
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_SKIP_RPATH=ON
2022-03-20 13:34:07 +01:00
-DLLVM_BINUTILS_INCDIR=/usr/include
2022-06-28 08:12:23 +02:00
-DLLVM_BUILD_DOCS=ON
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_BUILD_TESTS=ON
-DLLVM_ENABLE_BINDINGS=OFF
-DLLVM_ENABLE_FFI=ON
-DLLVM_ENABLE_RTTI=ON
-DLLVM_ENABLE_SPHINX=ON
-DLLVM_HOST_TRIPLE=$CHOST
-DLLVM_INCLUDE_BENCHMARKS=OFF
-DLLVM_INSTALL_UTILS=ON
-DLLVM_LINK_LLVM_DYLIB=ON
2022-07-28 22:40:01 +02:00
-DLLVM_USE_PERF=ON
2022-06-28 08:12:23 +02:00
-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")
2022-06-28 08:12:23 +02:00
cmake .. "${cmake_args[@]}"
ninja
2022-03-20 13:34:07 +01:00
}
## almost at the end before last couple of checks it sticks and does not proceed - so skipped at this time
## the above with 13.0.0 let's see how the 13.0.1 does with the altered ninja check
2022-06-28 08:12:23 +02:00
## it did the same Same story with 14.0.6
2022-03-20 13:34:07 +01:00
#check() {
2022-06-28 08:12:23 +02:00
# cd llvm-$pkgver.src/build
2022-03-20 13:34:07 +01:00
# LD_LIBRARY_PATH=$PWD/lib ninja check
#}
package_llvm() {
pkgdesc="Collection of modular and reusable compiler and toolchain technologies no zstd"
2022-03-20 13:34:07 +01:00
depends=('llvm-libs' 'perl')
2022-06-28 08:12:23 +02:00
cd llvm-$pkgver.src/build
2022-03-20 13:34:07 +01:00
DESTDIR="$pkgdir" ninja install-distribution
2022-03-20 13:34:07 +01:00
# Include lit for running lit-based tests in other projects
pushd ../utils/lit
python3 setup.py install --root="$pkgdir" -O1
popd
# The runtime libraries go into llvm-libs
mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}*.so* "$srcdir"
mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir"
if [[ $CARCH == x86_64 ]]; then
# Needed for multilib (https://bugs.archlinux.org/task/29951)
# Header stub is taken from Fedora
mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h
cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h"
fi
2022-06-28 08:12:23 +02:00
# Remove documentation sources
rm -r "$pkgdir"/usr/share/doc/llvm/html/{_sources,.buildinfo}
2022-03-20 13:34:07 +01:00
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_llvm-libs() {
pkgdesc="LLVM runtime libraries no zstd"
2022-03-20 13:34:07 +01:00
depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
install -d "$pkgdir/usr/lib"
cp -P \
"$srcdir"/lib{LLVM,LTO,Remarks}*.so* \
"$srcdir"/LLVMgold.so \
"$pkgdir/usr/lib/"
# Symlink LLVMgold.so from /usr/lib/bfd-plugins
# https://bugs.archlinux.org/task/28479
install -d "$pkgdir/usr/lib/bfd-plugins"
ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so"
install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
2023-04-30 04:16:33 +02:00
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
2022-03-20 13:34:07 +01:00
license=('custom:Apache 2.0 with LLVM Exception')
2023-01-22 15:03:17 +01:00
validpgpkeys=(474E22316ABF4785A88C6E8EA2C794A986419D8A # Tom Stellard <tstellar@redhat.com>
D574BD5D1D0E98895E3BF90044F2485E45D59042) # Tobias Hieta <tobias@hieta.se>
2022-03-20 13:34:07 +01:00
2023-01-22 15:03:17 +01:00
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
2022-03-20 13:34:07 +01:00
597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48) # llvm-config.h
2023-04-30 04:16:33 +02:00
## bb5126e43cc0b620763d9726bcad6f580be84cf02036ba809cc23d8204a086ad llvm-15.0.7-03-x86_64.pkg.tar.lz
## 1e324cace39115d6abe17271656812414b8f011ad5aa36904e82ba754ba42b4c llvm-libs-15.0.7-03-x86_64.pkg.tar.lz