OCaml 4.14.0 rebuild
[arch-packages.git] / llvm / trunk / PKGBUILD
blob5509ddcd8c425fe7ec85d932447880842d1e52b4
1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=('llvm' 'llvm-libs')
5 pkgver=14.0.6
6 pkgrel=3
7 arch=('x86_64')
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
17         llvm-config.h)
18 sha256sums=('050922ecaaca5781fdf6631ea92bc715183f202f9d2f15147226f023414f619a'
19             'SKIP'
20             'ee9baf6df05474083857044d92f26f59d3ee709cdf82ba3bdb2792e6645f71d9'
21             '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
22 validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
24 prepare() {
25   cd llvm-$pkgver.src
26   mkdir build
28   # https://github.com/llvm/llvm-project/issues/49689
29   patch -Np2 -i ../llvm-coroutines-ubsan.patch
32 build() {
33   cd llvm-$pkgver.src/build
35   local cmake_args=(
36     -G Ninja
37     -DCMAKE_BUILD_TYPE=Release
38     -DCMAKE_INSTALL_DOCDIR=share/doc
39     -DCMAKE_INSTALL_PREFIX=/usr
40     -DCMAKE_SKIP_RPATH=ON
41     -DLLVM_BINUTILS_INCDIR=/usr/include
42     -DLLVM_BUILD_DOCS=ON
43     -DLLVM_BUILD_LLVM_DYLIB=ON
44     -DLLVM_BUILD_TESTS=ON
45     -DLLVM_ENABLE_BINDINGS=OFF
46     -DLLVM_ENABLE_FFI=ON
47     -DLLVM_ENABLE_RTTI=ON
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
53     -DLLVM_USE_PERF=ON
54     -DSPHINX_WARNINGS_AS_ERRORS=OFF
55   )
56   cmake .. "${cmake_args[@]}"
57   ninja
60 check() {
61   cd llvm-$pkgver.src/build
62   LD_LIBRARY_PATH=$PWD/lib ninja check
65 package_llvm() {
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
74   pushd ../utils/lit
75   python3 setup.py install --root="$pkgdir" -O1
76   popd
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"
87   fi
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"
95 package_llvm-libs() {
96   pkgdesc="LLVM runtime libraries"
97   depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
99   install -d "$pkgdir/usr/lib"
100   cp -P \
101     "$srcdir"/lib{LLVM,LTO,Remarks}*.so* \
102     "$srcdir"/LLVMgold.so \
103     "$pkgdir/usr/lib/"
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: