# $Id$ # Maintainer: Evangelos Foutras # Contributor: Jan "heftig" Steffens pkgname=('llvm' 'llvm-libs' 'llvm-ocaml') pkgver=6.0.0 pkgrel=1 _ocaml_ver=4.05.0 arch=('x86_64') url="https://llvm.org/" license=('custom:University of Illinois/NCSA Open Source License') makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2' 'python3-sphinx' "ocaml=$_ocaml_ver" 'ocaml-ctypes' 'ocaml-findlib') options=('staticlibs') source=(https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig} PR35947-export-LLVMInitializeInstCombine-as-extern-C.patch PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch D44420-cmake-fix-a-typo-in-llvm_config-macro.patch llvm-config.h) sha256sums=('1ff53c915b4e761ef400b803f07261ade637b0c269d99569f18040f3dcee4408' 'SKIP' '7d0082d1c641873c1d45c2f076b9533fbc43002d605336afa92198b8830a5bcb' '5a90833c15c4981e7accd405290491d7930f991d30943d7ae9e4e338149731ff' 'da80b59c9abe9fe864ff8dc42132c5aa135a79d342fd147ae6f54e2621e009fa' '96e2f3ca8b7d1bdbe2606a1eebb12c57b39838d1bcc15e40388e8d59649a9f4a' '5cc114fd711e6ea836a6270b2f713e2e751c49e8b5ffa6c6812127ca801acef3' '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48') validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard prepare() { cd "$srcdir/llvm-$pkgver.src" mkdir build # https://bugs.llvm.org/show_bug.cgi?id=35947 patch -Np1 -i ../PR35947-export-LLVMInitializeInstCombine-as-extern-C.patch # https://bugs.llvm.org/show_bug.cgi?id=36417 patch -Np1 -i ../PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch patch -Np1 -i ../PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch # https://reviews.llvm.org/D44391 patch -Np1 -i ../D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch # https://reviews.llvm.org/D44420 patch -Np0 -i ../D44420-cmake-fix-a-typo-in-llvm_config-macro.patch } build() { cd "$srcdir/llvm-$pkgver.src/build" cmake .. -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DLLVM_HOST_TRIPLE=$CHOST \ -DLLVM_BUILD_LLVM_DYLIB=ON \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DLLVM_INSTALL_UTILS=ON \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_FFI=ON \ -DLLVM_BUILD_TESTS=ON \ -DLLVM_BUILD_DOCS=ON \ -DLLVM_ENABLE_SPHINX=ON \ -DLLVM_ENABLE_DOXYGEN=OFF \ -DSPHINX_WARNINGS_AS_ERRORS=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \ -DLLVM_BINUTILS_INCDIR=/usr/include ninja all ocaml_doc } check() { cd "$srcdir/llvm-$pkgver.src/build" ninja check } package_llvm() { pkgdesc="Collection of modular and reusable compiler and toolchain technologies" depends=('llvm-libs' 'perl') optdepends=('python-setuptools: for using lit (LLVM Integrated Tester)') cd "$srcdir/llvm-$pkgver.src/build" DESTDIR="$pkgdir" ninja install # Include lit for running tests with clang and friends pushd ../utils/lit python3 setup.py install --root="$pkgdir" -O1 popd # Remove documentation sources rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo} # The runtime libraries go into llvm-libs mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO}*.so* "$srcdir" mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir" # OCaml bindings go to a separate package rm -rf "$srcdir"/ocaml.{lib,doc} mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib" mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc" if [[ $CARCH == x86_64 ]]; then # Needed for multilib (https://bugs.archlinux.org/task/29951) # Header stub is taken from Fedora mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h" fi install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } package_llvm-libs() { pkgdesc="LLVM runtime libraries" depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2') install -d "$pkgdir/usr/lib" cp -P \ "$srcdir"/lib{LLVM,LTO}*.so* \ "$srcdir"/LLVMgold.so \ "$pkgdir/usr/lib/" # Symlink LLVMgold.so from /usr/lib/bfd-plugins # https://bugs.archlinux.org/task/28479 install -d "$pkgdir/usr/lib/bfd-plugins" ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so" install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } package_llvm-ocaml() { pkgdesc="OCaml bindings for LLVM" depends=('llvm' "ocaml=$_ocaml_ver" 'ocaml-ctypes') install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname} cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml" cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html" install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } # vim:set ts=2 sw=2 et: