OCaml 4.13.1 rebuild, fixes FS#72998
[arch-packages.git] / llvm / trunk / PKGBUILD
blob6be436ff51c42237f8ab22f7b3f6ad276615e82b
1 # Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
2 # Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
4 pkgname=('llvm' 'llvm-libs' 'llvm-ocaml')
5 pkgver=13.0.0
6 pkgrel=6
7 _ocaml_ver=4.13.1
8 arch=('x86_64')
9 url="https://llvm.org/"
10 license=('custom:Apache 2.0 with LLVM Exception')
11 makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2'
12              "ocaml>=$_ocaml_ver" 'ocaml-ctypes' 'ocaml-findlib'
13              'python-setuptools' 'python-psutil' 'python-sphinx'
14              'python-recommonmark')
15 options=('staticlibs')
16 _source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
17 source=($_source_base/$pkgname-$pkgver.src.tar.xz{,.sig}
18         don-t-accept-nullptr-as-GEP-element-type.patch
19         no-strict-aliasing-DwarfCompileUnit.patch
20         disable-bswap-for-spir.patch
21         llvm-config.h)
22 sha256sums=('408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020'
23             'SKIP'
24             'a7e902a7612d0fdabe436a917468b043cc296bc89d8954bfc3126f737beb9ac4'
25             'd1eff24508e35aae6c26a943dbaa3ef5acb60a145b008fd1ef9ac6f6c4faa662'
26             'af163392fbc19d65d11ab4b1510a2eae39b417d6228023b3ba5395b138bb41f5'
27             '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
28 validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
29 validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
31 prepare() {
32   cd "$srcdir/llvm-$pkgver.src"
33   mkdir build
35   # https://github.com/intel/intel-graphics-compiler/issues/204
36   patch -Rp2 -i ../don-t-accept-nullptr-as-GEP-element-type.patch
38   # Work around intermittent 'clang -O -g' crashes
39   # https://bugs.llvm.org/show_bug.cgi?id=50611#c3
40   patch -Np2 -i ../no-strict-aliasing-DwarfCompileUnit.patch
42   # Fix an ISPC build failure (https://github.com/ispc/ispc/issues/2189)
43   patch -Np2 -i ../disable-bswap-for-spir.patch
46 build() {
47   cd "$srcdir/llvm-$pkgver.src/build"
49   cmake .. -G Ninja \
50     -DCMAKE_BUILD_TYPE=Release \
51     -DCMAKE_INSTALL_PREFIX=/usr \
52     -DLLVM_HOST_TRIPLE=$CHOST \
53     -DLLVM_BUILD_LLVM_DYLIB=ON \
54     -DLLVM_LINK_LLVM_DYLIB=ON \
55     -DLLVM_INSTALL_UTILS=ON \
56     -DLLVM_ENABLE_RTTI=ON \
57     -DLLVM_ENABLE_FFI=ON \
58     -DLLVM_BUILD_TESTS=ON \
59     -DLLVM_BUILD_DOCS=ON \
60     -DLLVM_ENABLE_SPHINX=ON \
61     -DLLVM_ENABLE_DOXYGEN=OFF \
62     -DSPHINX_WARNINGS_AS_ERRORS=OFF \
63     -DLLVM_BINUTILS_INCDIR=/usr/include
64   ninja all ocaml_doc
67 check() {
68   cd "$srcdir/llvm-$pkgver.src/build"
69   ninja check
72 package_llvm() {
73   pkgdesc="Collection of modular and reusable compiler and toolchain technologies"
74   depends=('llvm-libs' 'perl')
76   cd "$srcdir/llvm-$pkgver.src/build"
78   DESTDIR="$pkgdir" ninja install
80   # Include lit for running lit-based tests in other projects
81   pushd ../utils/lit
82   python3 setup.py install --root="$pkgdir" -O1
83   popd
85   # Remove documentation sources
86   rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
88   # The runtime libraries go into llvm-libs
89   mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}*.so* "$srcdir"
90   mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir"
92   # OCaml bindings go to a separate package
93   rm -rf "$srcdir"/ocaml.{lib,doc}
94   mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib"
95   mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc"
97   if [[ $CARCH == x86_64 ]]; then
98     # Needed for multilib (https://bugs.archlinux.org/task/29951)
99     # Header stub is taken from Fedora
100     mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h
101     cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h"
102   fi
104   install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
107 package_llvm-libs() {
108   pkgdesc="LLVM runtime libraries"
109   depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2')
111   install -d "$pkgdir/usr/lib"
112   cp -P \
113     "$srcdir"/lib{LLVM,LTO,Remarks}*.so* \
114     "$srcdir"/LLVMgold.so \
115     "$pkgdir/usr/lib/"
117   # Symlink LLVMgold.so from /usr/lib/bfd-plugins
118   # https://bugs.archlinux.org/task/28479
119   install -d "$pkgdir/usr/lib/bfd-plugins"
120   ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so"
122   install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
123     "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
126 package_llvm-ocaml() {
127   pkgdesc="OCaml bindings for LLVM"
128   depends=('llvm' "ocaml>=$_ocaml_ver" 'ocaml-ctypes')
130   install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname}
131   cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml"
132   cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html"
134   install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \
135     "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
138 # vim:set ts=2 sw=2 et: