1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=('llvm11' 'llvm11-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' '!debug')
13 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
14 source=($_source_base/llvm-$pkgver.src.tar.xz{,.sig}
15 utils-benchmark-fix-missing-include.patch
16 amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch
17 not-sure-what-is-causing-this.patch
18 no-strict-aliasing-DwarfCompileUnit.patch)
19 sha256sums=('ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5'
21 '5f666675fd45848e4c4b0f94068f7648dd9ff88df4a7b19d2a9f2b83ee358a7e'
22 '85b6977005899bc76fcc548e0b6501cae5f50a8ad03060b9f58d03d775323327'
23 'cd8a1280deb6f418d1f669a4672f1ff2cb54a4d20066563d7739f509c44de2f5'
24 'd1eff24508e35aae6c26a943dbaa3ef5acb60a145b008fd1ef9ac6f6c4faa662')
25 validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
27 # Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
28 # CMake reference to LLVMgold; inspired by Gentoo
29 _get_distribution_components() {
31 ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do
33 llvm-libraries|distribution)
45 cd "$srcdir/llvm-$pkgver.src"
48 patch -Np2 -i ../utils-benchmark-fix-missing-include.patch
50 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/4107
51 # https://bugs.llvm.org/show_bug.cgi?id=48921#c2
52 patch -Np2 -i ../amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch
54 # Fix troll tests (might be a change in libstdc++)
55 patch -Np2 -i ../not-sure-what-is-causing-this.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"
64 CFLAGS+=' -ffat-lto-objects'
65 CXXFLAGS+=' -ffat-lto-objects'
69 -DCMAKE_BUILD_TYPE=Release
70 -DCMAKE_INSTALL_PREFIX=/usr
71 -DLLVM_HOST_TRIPLE=$CHOST
72 -DLLVM_BUILD_LLVM_DYLIB=ON
73 -DLLVM_LINK_LLVM_DYLIB=ON
74 -DLLVM_INSTALL_UTILS=ON
78 -DLLVM_BINUTILS_INCDIR=/usr/include
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[@]}"
91 cd "$srcdir/llvm-$pkgver.src/build"
96 pkgdesc="Collection of modular and reusable compiler and toolchain technologies"
97 depends=('llvm11-libs' 'perl')
100 cd "$srcdir/llvm-$pkgver.src/build"
102 DESTDIR="$pkgdir" ninja install-distribution
104 # Include lit for running lit-based tests in other projects
106 python3 setup.py install --root="$pkgdir" -O1
109 # The runtime libraries go into llvm11-libs
110 mv -f "$pkgdir"/usr/lib/lib{LLVM-*.so,{LTO,Remarks}.so.*} "$srcdir"
112 # Remove files which conflict with llvm-libs
113 rm "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}.so
115 install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
118 package_llvm11-libs() {
119 pkgdesc="LLVM 11 runtime libraries"
120 depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
122 install -d "$pkgdir/usr/lib"
123 cp -P "$srcdir"/lib{LLVM-*.so,{LTO,Remarks}.so.*} "$pkgdir/usr/lib/"
125 install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
126 "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
129 # vim:set ts=2 sw=2 et: