160 lines
4.7 KiB
Bash
160 lines
4.7 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" "libatomic")
|
|
makedepends=("cmake" "ninja")
|
|
options=("staticlibs")
|
|
source=(
|
|
"https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-$pkgver.src.tar.xz"
|
|
"0001-clang-add-fortify-include-paths-for-musl-triplets-en.patch"
|
|
"0002-clang-use-as-needed-by-default.patch"
|
|
"0003-clang-switch-on-default-now-relro.patch"
|
|
"0004-clang-default-to-fno-semantic-interposition.patch"
|
|
"0005-clang-implicitly-link-to-libatomic-on-linux-targets.patch"
|
|
"0006-clang-use-strong-stack-protector-by-default.patch"
|
|
)
|
|
sha256sums=(
|
|
"58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813"
|
|
"80023325d9d2d7c168b01efd188dbdb3f012207274aeedc7a3f4824e501b1ea4"
|
|
"672e4ab48aca039e5c8c50bcd7dd0be93304a3f1cc5d361e1f05b46ad98de1ef"
|
|
"f6271d753c3e74dab89a7e4111fe67a6c69bd0e2ac1b06336fb9132a69702ef2"
|
|
"6e6262fce80666a37abd76793a382eb2903d402463dad76afb4d1d408d5b37b0"
|
|
"296cb85a06e4b179881b3294fc2c0e4b235ced29a7c11b301794c3e96b16f77f"
|
|
"ec9aeeca5812cd98274035c0b6e79401754d7ed0407e2034ad727704a8c7dedc"
|
|
)
|
|
|
|
prepare() {
|
|
cd $pkgbase-$pkgver.src
|
|
|
|
patch -p1 <$srcdir/0001-clang-add-fortify-include-paths-for-musl-triplets-en.patch
|
|
patch -p1 <$srcdir/0002-clang-use-as-needed-by-default.patch
|
|
patch -p1 <$srcdir/0003-clang-switch-on-default-now-relro.patch
|
|
patch -p1 <$srcdir/0004-clang-default-to-fno-semantic-interposition.patch
|
|
patch -p1 <$srcdir/0005-clang-implicitly-link-to-libatomic-on-linux-targets.patch
|
|
patch -p1 <$srcdir/0006-clang-use-strong-stack-protector-by-default.patch
|
|
}
|
|
|
|
build() {
|
|
cd $pkgbase-$pkgver.src
|
|
|
|
local cmake_args=(
|
|
-G Ninja
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_INSTALL_PREFIX=/usr
|
|
-DCMAKE_INSTALL_LIBDIR=/usr/lib
|
|
-DCMAKE_PREFIX_PATH=/usr
|
|
-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_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
|
|
-DLIBUNWIND_ENABLE_STATIC=ON
|
|
-DLLD_VENDOR="Ikeda Linux"
|
|
)
|
|
|
|
cmake -B build-llvm -S llvm --log-level=trace "${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() {
|
|
pkgdesc+=" (Default LLVM libraries)"
|
|
|
|
cd $pkgbase-$pkgver.src
|
|
|
|
DESTDIR=$pkgdir ninja -C build-llvm install
|
|
}
|
|
|
|
package_llvm-runtimes() {
|
|
pkgdesc+=" (C++, Unwind and Atomic Runtimes)"
|
|
|
|
cd $pkgbase-$pkgver.src
|
|
|
|
DESTDIR=$pkgdir ninja -C build-llvm-runtimes install
|
|
}
|
|
|
|
package_clang() {
|
|
pkgdesc+=" (Default System C/C++ Compiler)"
|
|
|
|
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
|
|
ln -s clang++ $pkgdir/usr/bin/c++
|
|
}
|
|
|
|
package_lld() {
|
|
pkgdesc+=" (Default Syetem Linker)"
|
|
|
|
cd $pkgbase-$pkgver.src
|
|
|
|
DESTDIR=$pkgdir ninja -C build-lld install
|
|
|
|
ln -s ld.lld $pkgdir/usr/bin/ld
|
|
}
|