opt/clang/Pkgfile
2021-05-08 13:47:24 +10:00

39 lines
1.6 KiB
Plaintext

# Description: clang compiler
# URL: https://clang.llvm.org/
# Maintainer: CRUX System Team, core-ports at crux dot nu
# Depends on: compiler-rt llvm
name=clang
version=12.0.0
release=1
source=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/$name-$version.src.tar.xz
https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/$name-tools-extra-$version.src.tar.xz
0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch
0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch
0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch)
build() {
patch -d $name-tools-extra-$version.src -p2 -i $SRC/0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch
patch -d $name-$version.src -p2 -i $SRC/0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch
patch -d $name-$version.src -p2 -i $SRC/0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch
cmake -S $name-$version.src -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBEXECDIR=lib/clang \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
-D LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="../$name-tools-extra-$version.src" \
-D LLVM_TARGETS_TO_BUILD='X86;AMDGPU;BPF;NVPTX' \
-D LLVM_INCLUDE_TESTS=0 \
-D LLVM_PARALLEL_COMPILE_JOBS="${JOBS:-1}" \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
# -DCMAKE_INSTALL_LIBEXECDIR is still hardcoded..
mv $PKG/usr/libexec/{c++-analyzer,ccc-analyzer} $PKG/usr/lib/clang
rmdir $PKG/usr/libexec
sed -i 's|libexec|lib/clang|' $PKG/usr/bin/scan-build
}