1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=('llvm12' 'llvm12-libs')
8 url="https://llvm.org/"
9 license=('custom:Apache 2.0 with LLVM Exception')
10 makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2'
12 options=('staticlibs')
13 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
14 source=($_source_base/llvm-$pkgver.src.tar.xz{,.sig}
15 llvm-link-with-Bsymbolic-functions.patch
16 add-fno-semantic-interposition.patch
17 x86-twist-shuffle-mask.patch
18 no-strict-aliasing-DwarfCompileUnit.patch)
19 sha256sums=('7d9a8405f557cefc5a21bf5672af73903b64749d9bc3a50322239f56f34ffddf'
21 '560ce1e206c19f4b86f4c583b743db0ad47a610418999350710aafd60ae50fcd'
22 'fc8c64267a5d179e9fc24fb2bc6150edef2598c83f5b2d138d14e05ce9f4e345'
23 'c51b8754f76eb3774f46d530409f6d89f5bb47d90f0d718dbfa861f716b29693'
24 'd1eff24508e35aae6c26a943dbaa3ef5acb60a145b008fd1ef9ac6f6c4faa662')
25 validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
26 validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
28 # Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
29 # CMake reference to LLVMgold; inspired by Gentoo
30 _get_distribution_components() {
32 ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do
34 llvm-libraries|distribution)
46 cd "$srcdir/llvm-$pkgver.src"
49 # https://bugs.archlinux.org/task/70697
50 patch -Np2 -i ../llvm-link-with-Bsymbolic-functions.patch
51 # https://reviews.llvm.org/D102453
52 patch -Np2 -i ../add-fno-semantic-interposition.patch
54 # https://bugs.llvm.org/show_bug.cgi?id=50823
55 patch -Np2 -i ../x86-twist-shuffle-mask.patch
57 # https://bugs.llvm.org/show_bug.cgi?id=50611#c3
58 patch -Np2 -i ../no-strict-aliasing-DwarfCompileUnit.patch
62 cd "$srcdir/llvm-$pkgver.src/build"
66 -DCMAKE_BUILD_TYPE=Release
67 -DCMAKE_INSTALL_PREFIX=/usr
68 -DLLVM_HOST_TRIPLE=$CHOST
69 -DLLVM_BUILD_LLVM_DYLIB=ON
70 -DLLVM_LINK_LLVM_DYLIB=ON
71 -DLLVM_INSTALL_UTILS=ON
75 -DLLVM_BINUTILS_INCDIR=/usr/include
78 cmake .. "${cmake_args[@]}"
79 local distribution_components=$(_get_distribution_components | paste -sd\;)
80 test -n "$distribution_components"
81 cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
83 cmake .. "${cmake_args[@]}"
88 cd "$srcdir/llvm-$pkgver.src/build"
93 pkgdesc="Collection of modular and reusable compiler and toolchain technologies"
94 depends=('llvm12-libs' 'perl')
97 cd "$srcdir/llvm-$pkgver.src/build"
99 DESTDIR="$pkgdir" ninja install-distribution
101 # Include lit for running lit-based tests in other projects
103 python3 setup.py install --root="$pkgdir" -O1
106 # The runtime libraries go into llvm12-libs
107 mv -f "$pkgdir"/usr/lib/lib{LLVM-*.so,{LTO,Remarks}.so.*} "$srcdir"
109 # Remove files which conflict with llvm-libs
110 rm "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}.so
112 install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
115 package_llvm12-libs() {
116 pkgdesc="LLVM 11 runtime libraries"
117 depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
119 install -d "$pkgdir/usr/lib"
120 cp -P "$srcdir"/lib{LLVM-*.so,{LTO,Remarks}.so.*} "$pkgdir/usr/lib/"
122 install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
123 "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
126 # vim:set ts=2 sw=2 et: