pkgs/llvm-project/PKGBUILD

124 lines
3.5 KiB
Bash

# Maintainer: Daryl Ronningen <relms@relms.dev>
pkgbase=llvm-project
pkgname=(
llvm
llvm-runtimes
clang
lld
)
pkgver=17.0.6
pkgrel=1
pkgdesc="collection of modular and reusable compiler and toolchain technologies."
arch=("x86_64")
url="https://llvm.org"
license=("LLVM-exception")
depends=("zlib-ng")
makedepends=()
source=("https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-$pkgver.src.tar.xz")
sha256sums=('58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813')
build() {
cd $pkgbase-$pkgver.src
local cmake_args=(
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl \
-DLLVM_HOST_TRIPLE=x86_64-pc-linux-musl \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DENABLE_LINKER_BUILD_ID=ON \
-DLLVM_ENABLE_LIBCXX=ON \
-DLLVM_ENABLE_ZSTD=ON \
-DLLVM_ENABLE_TERMINFO=ON \
-DLLVM_ENABLE_LIBEDIT=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_LIBPFM=OFF \
-DLLVM_ENABLE_OCAMLDOC=OFF \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_INSTALL_BINUTILS_SYMLINKS=ON \
-DLLVM_INSTALL_CCTOOLS_SYMLINKS=ON \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
-DCOMPILER_RT_USE_LLVM_UNWINDER=ON \
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
-DCOMPILER_RT_CXX_LIBRARY=libcxx \
-DCOMPILER_RT_INSTALL_PATH=/usr/lib/clang/${pkgver%%.*} \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_DEFAULT_RTLIB=compiler-rt \
-DCLANG_DEFAULT_UNWINDLIB=libunwind \
-DCLANG_INCLUDE_TESTS=OFF \
-DCLANG_VENDOR="Ikeda Linux" \
-DLIBCXX_HAS_MUSL_LIBC=ON \
-DLIBCXX_ENABLE_LOCALIZATION=ON \
-DLIBCXX_ENABLE_NEW_DELETE_DEFINITIONS=ON \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
-DLIBCXX_ENABLE_ASSERTIONS=ON \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBUNWIND_INSTALL_HEADERS=ON \
-DLIBUNWIND_USE_COMPILER_RT=ON \
-DLLD_VENDOR="Ikeda Linux"
)
cmake -B build-llvm -S llvm "${cmake_args[@]}"
cmake -B build-llvm-runtimes -S runtimes -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxx;libcxxabi" "${cmake_args[@]}"
cmake -B build-clang -S clang "${cmake_args[@]}"
cmake -B build-lld -S lld "${cmake_args[@]}"
ninja -C build-llvm
ninja -C build-llvm-runtimes
ninja -C build-clang
ninja -C build-lld
}
package_llvm() {
cd $pkgbase-$pkgver.src
DESTDIR=$pkgdir ninja -C build-llvm install
}
package_llvm-runtimes() {
cd $pkgbase-$pkgver.src
DESTDIR=$pkgdir ninja -C build-llvm-runtimes install
}
package_clang() {
cd $pkgbase-$pkgver.src
DESTDIR=$pkgdir ninja -C build-clang install
ln -s clang $pkgdir/usr/bin/cc
ln -s clang++ $pkgdir/usr/bin/cpp
}
package_lld() {
cd $pkgbase-$pkgver.src
DESTDIR=$pkgdir ninja -C build-lld install
ln -s ld.lld $pkgdir/usr/bin/ld
}