1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=('llvm' 'llvm-libs')
8 url="https://llvm.org/"
9 license=('custom:Apache 2.0 with LLVM Exception')
10 makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2'
11 'python-setuptools' 'python-psutil' 'python-sphinx'
12 'python-recommonmark')
13 options=('staticlibs' '!lto') # Getting thousands of test failures with LTO
14 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
15 source=($_source_base/llvm-$pkgver.src.tar.xz{,.sig}
16 llvm-coroutines-ubsan.patch
18 sha256sums=('050922ecaaca5781fdf6631ea92bc715183f202f9d2f15147226f023414f619a'
20 'ee9baf6df05474083857044d92f26f59d3ee709cdf82ba3bdb2792e6645f71d9'
21 '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
22 validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
28 # https://github.com/llvm/llvm-project/issues/49689
29 patch -Np2 -i ../llvm-coroutines-ubsan.patch
33 cd llvm-$pkgver.src/build
37 -DCMAKE_BUILD_TYPE=Release
38 -DCMAKE_INSTALL_DOCDIR=share/doc
39 -DCMAKE_INSTALL_PREFIX=/usr
41 -DLLVM_BINUTILS_INCDIR=/usr/include
43 -DLLVM_BUILD_LLVM_DYLIB=ON
45 -DLLVM_ENABLE_BINDINGS=OFF
48 -DLLVM_ENABLE_SPHINX=ON
49 -DLLVM_HOST_TRIPLE=$CHOST
50 -DLLVM_INCLUDE_BENCHMARKS=OFF
51 -DLLVM_INSTALL_UTILS=ON
52 -DLLVM_LINK_LLVM_DYLIB=ON
54 -DSPHINX_WARNINGS_AS_ERRORS=OFF
56 cmake .. "${cmake_args[@]}"
61 cd llvm-$pkgver.src/build
62 LD_LIBRARY_PATH=$PWD/lib ninja check
66 pkgdesc="Compiler infrastructure"
67 depends=('llvm-libs' 'perl')
69 cd llvm-$pkgver.src/build
71 DESTDIR="$pkgdir" ninja install
73 # Include lit for running lit-based tests in other projects
75 python3 setup.py install --root="$pkgdir" -O1
78 # The runtime libraries go into llvm-libs
79 mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}*.so* "$srcdir"
80 mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir"
82 if [[ $CARCH == x86_64 ]]; then
83 # Needed for multilib (https://bugs.archlinux.org/task/29951)
84 # Header stub is taken from Fedora
85 mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h
86 cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h"
89 # Remove documentation sources
90 rm -r "$pkgdir"/usr/share/doc/llvm/html/{_sources,.buildinfo}
92 install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
96 pkgdesc="LLVM runtime libraries"
97 depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
99 install -d "$pkgdir/usr/lib"
101 "$srcdir"/lib{LLVM,LTO,Remarks}*.so* \
102 "$srcdir"/LLVMgold.so \
105 # Symlink LLVMgold.so from /usr/lib/bfd-plugins
106 # https://bugs.archlinux.org/task/28479
107 install -d "$pkgdir/usr/lib/bfd-plugins"
108 ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so"
110 install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
111 "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
114 # vim:set ts=2 sw=2 et: