sbcl rebuild
[arch-packages.git] / clang13 / trunk / PKGBUILD
blob8250173a4e5fd5b9021ab60c63999a86138164fa
1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=clang13
5 pkgver=13.0.1
6 pkgrel=3
7 pkgdesc="C language family frontend for LLVM 13"
8 arch=('x86_64')
9 url="https://clang.llvm.org/"
10 license=('custom:Apache 2.0 with LLVM Exception')
11 depends=('llvm13-libs' 'gcc')
12 makedepends=('llvm13' 'cmake' 'ninja' 'python')
13 optdepends=('openmp: OpenMP support in clang with -fopenmp'
14             'llvm13: referenced by some clang headers')
15 checkdepends=('llvm')
16 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
17 source=($_source_base/clang-$pkgver.src.tar.xz{,.sig}
18         $_source_base/llvm-$pkgver.src.tar.xz{,.sig}
19         strip-exception-specifications-in-CFI-type-names.patch
20         enable-SSP-and-PIE-by-default.patch)
21 sha256sums=('787a9e2d99f5c8720aa1773e4be009461cd30d3bd40fdd24591e473467c917c9'
22             'SKIP'
23             'ec6b80d82c384acad2dc192903a6cf2cdbaffb889b84bfb98da9d71e630fc834'
24             'SKIP'
25             '3f4a2784a4c2b2df13e03beb0b66d5805c520f2b9f16ff76e0557daeb284c8fa'
26             '67706047fc93a2e79185d344bdac48219ce042c55ddb9b9397bc98db2153ba58')
27 validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
29 # Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
30 # installing static libraries; inspired by Gentoo
31 _get_distribution_components() {
32   local target
33   ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do
34     case $target in
35       clang-libraries|distribution)
36         continue
37         ;;
38       # trim static analyzer and other bits
39       bash-autocomplete|clang-format|clang-rename|hmaptool|scan-*)
40         continue
41         ;;
42       # avoid shadowing libclang.so.13 from clang 14
43       # https://github.com/llvm/llvm-project/issues/53684#issuecomment-1162669770
44       libclang|c-index-test)
45         continue
46         ;;
47       clang|clang-*)
48         ;;
49       clang*|findAllSymbols)
50         continue
51         ;;
52     esac
53     echo $target
54   done
57 prepare() {
58   cd clang-$pkgver.src
59   mkdir build
60   patch -Np2 -i ../enable-SSP-and-PIE-by-default.patch
61   patch -Np2 -i ../strip-exception-specifications-in-CFI-type-names.patch
64 build() {
65   cd clang-$pkgver.src/build
67   local cmake_args=(
68     -G Ninja
69     -DCMAKE_BUILD_TYPE=Release
70     -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm13
71     -DCMAKE_SKIP_RPATH=ON
72     -DCLANG_LINK_CLANG_DYLIB=ON
73     -DLLVM_BUILD_TESTS=ON
74     -DLLVM_CONFIG=/usr/lib/llvm13/bin/llvm-config
75     -DLLVM_ENABLE_RTTI=ON
76     -DLLVM_EXTERNAL_LIT=/usr/bin/lit
77     -DLLVM_LINK_LLVM_DYLIB=ON
78     -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
79   )
81   cmake .. "${cmake_args[@]}"
82   local distribution_components=$(_get_distribution_components | paste -sd\;)
83   test -n "$distribution_components"
84   cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
86   cmake .. "${cmake_args[@]}"
87   ninja
90 check() {
91   cd clang-$pkgver.src/build
92   LD_LIBRARY_PATH=$PWD/lib ninja check-clang
95 package() {
96   cd clang-$pkgver.src/build
98   DESTDIR="$pkgdir" ninja install-distribution
99   install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
101   mv "$pkgdir"/usr/lib/{llvm13/lib/,}libclang-cpp.so.13
102   ln -s ../../libclang-cpp.so.13 "$pkgdir/usr/lib/llvm13/lib/libclang-cpp.so.13"
105 # vim:set ts=2 sw=2 et: