summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorYurii Kolesnykov2018-12-05 14:53:23 +0100
committerYurii Kolesnykov2018-12-05 14:55:51 +0100
commit7d2ae9494bdbf2d650ddbb7cf99137f68de0105d (patch)
treebcb3bd4f7636913776dbb2be09975ebca2e8238c /PKGBUILD
downloadaur-7d2ae9494bdbf2d650ddbb7cf99137f68de0105d.tar.gz
init,8.0.0_r172524.52f31f630a5
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD517
1 files changed, 517 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..217502d5ad6b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,517 @@
+# Maintainer: Yurii Kolesnykov <root@yurikoles.com>
+# Contributor: Luchesar V. ILIEV <luchesar%2eiliev%40gmail%2ecom>
+# Contributor: Anders Bergh <anders@archlinuxppc.org>
+# Contributor: Armin K. <krejzi at email dot com>
+# Contributor: Christian Babeux <christian.babeux@0x80.ca>
+# Contributor: Evangelos Foutras <evangelos@foutrelis.com>
+# Contributor: Hesiod (https://github.com/hesiod)
+# Contributor: Roberto Alsina <ralsina@kde.org>
+# Contributor: Thomas Dziedzic < gostrc at gmail >
+# Contributor: Tomas Lindquist Olsen <tomas@famolsen.dk>
+# Contributor: Tomas Wilhelmsson <tomas.wilhelmsson@gmail.com>
+
+pkgbase=llvm-git
+
+pkgname=(
+ 'llvm-git'
+ 'llvm-libs-git'
+ 'llvm-ocaml-git'
+ 'lld-git'
+ 'lldb-yurikoles-git'
+ 'clang-git'
+ 'clang-analyzer-git'
+ 'clang-compiler-rt-git'
+ 'clang-tools-extra-git'
+)
+_pkgname='llvm'
+pkgver=8.0.0_r172524.52f31f630a5
+pkgrel=1
+
+arch=('i686' 'x86_64')
+url='https://llvm.org/'
+license=('custom:University of Illinois')
+
+makedepends=(
+ 'cmake'
+ 'git'
+ 'libedit'
+ 'libffi'
+ 'ocaml-ctypes'
+ 'ocaml-findlib'
+ 'python2'
+ 'python2-recommonmark'
+ 'python2-requests'
+ 'python2-sphinx'
+ 'swig'
+)
+
+# this is always the latest svn so debug info can be useful
+options=('staticlibs' '!strip')
+
+source=(
+ "${_pkgname}::git+https://git.llvm.org/git/llvm.git"
+ 'clang::git+https://git.llvm.org/git/clang.git'
+ 'clang-tools-extra::git+https://git.llvm.org/git/clang-tools-extra.git'
+ 'compiler-rt::git+https://git.llvm.org/git/compiler-rt.git'
+ 'lld::git+https://git.llvm.org/git/lld.git'
+ 'lldb::git+https://git.llvm.org/git/lldb.git'
+ 'polly::git+https://git.llvm.org/git/polly.git'
+ 'llvm-Config-llvm-config.h'
+)
+
+sha256sums=(
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48'
+)
+
+#
+# BEGIN INTERNAL VARIABLES AND FUNCTIONS
+#
+
+# Python site-packages dir (relative to ${pkgdir})
+_py_sitepkg_dir="/usr/lib/python2.7/site-packages"
+
+# Determine the installed OCaml package version
+# Arguments: NONE
+_ocamlver() {
+ { pacman -Q ocaml 2>/dev/null || pacman -Sp --print-format '%n %v' ocaml ;} \
+ | awk '{ print $2 }' | cut -d - -f 1 | cut -d . -f 1,2,3
+}
+
+# Fix the Python interpreter path in .py files to point to python2
+# Arguments: py_file_to_patch [py_file_to_patch ...]
+_fix_python_exec_path() {
+ sed -i \
+ -e 's|^#!/usr/bin/python$|&2|' \
+ -e 's|^#!/usr/bin/env python$|&2|' \
+ ${@}
+}
+
+# Compile the Python files in a directory
+# Arguments: directory_to_operate_on
+_compile_python_files() {
+ python2 -m compileall "${1}"
+ python2 -O -m compileall "${1}"
+}
+
+# Install the Python bindings of a package
+# Arguments: source_directory_to_install_from
+_install_python_bindings() {
+ install -m 0755 -d "${pkgdir}${_py_sitepkg_dir}"
+ cp -r "${1}" "${pkgdir}${_py_sitepkg_dir}/"
+ _compile_python_files "${pkgdir}${_py_sitepkg_dir}/${1##*/}"
+}
+
+# Install the license files for a package
+# Arguments: source_directory_to_install_from
+# Notes: We prune some directories that are inserted into the tree in prepare()
+# in order to eliminate possible duplicates. We also use NULL-terminated
+# strings, just in case we have paths including spaces. Finally, we opt
+# for a flat directory structure, so all license files in subdirectories
+# get their names from the relative path with '/'s replaced by dashes.
+# Not the most elegant solution, but should be working well enough.
+_install_licenses() {
+ find "${1}" \
+ \( \
+ -path "${srcdir}/${_pkgname}/tools/lld" -o \
+ -path "${srcdir}/${_pkgname}/tools/clang" -o \
+ -path "${srcdir}/${_pkgname}/tools/lldb" -o \
+ -path "${srcdir}/${_pkgname}/projects/compiler-rt" \
+ \) -prune -o \
+ \( \
+ -iname 'license*' -o \
+ -iname 'credits*' -o \
+ -iname 'copyright*' \
+ \) -printf '%P\0' \
+ | while read -d $'\0' license_file; do
+ install -D -m 0644 \
+ "${1}/${license_file}" \
+ "${pkgdir}/usr/share/licenses/${pkgname}/${license_file//\//-}"
+ done
+}
+
+#
+# END INTERNAL VARIABLES AND FUNCTIONS
+#
+
+pkgver() {
+ cd "${srcdir}/${_pkgname}"
+
+ # This will almost match the output of `llvm-config --version` when the
+ # LLVM_APPEND_VC_REV cmake flag is turned on. The only difference is
+ # dash being replaced with underscore because of Pacman requirements.
+ local _pkgver=$(awk -F 'MAJOR |MINOR |PATCH |SUFFIX |)' \
+ 'BEGIN { ORS="." ; i=0 } \
+ /set\(LLVM_VERSION_/ { print $2 ; i++ ; if (i==2) ORS="" } \
+ END { print "\n" }' \
+ CMakeLists.txt)_r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
+ echo "${_pkgver//svn}"
+}
+
+prepare() {
+ cd "${srcdir}/${_pkgname}"
+
+ # Anything added here and packaged separately should be pruned in _install_licenses() above.
+ mkdir -pv tools/{clang/tools/extra,lld,lldb,polly} projects/compiler-rt
+ git --git-dir="${srcdir}"/clang/.git archive master|tar -xp -C tools/clang
+ git --git-dir="${srcdir}"/clang-tools-extra/.git archive master|tar -xp -C tools/clang/tools/extra
+ git --git-dir="${srcdir}"/compiler-rt/.git archive master|tar -xp -C projects/compiler-rt
+ git --git-dir="${srcdir}"/lld/.git archive master|tar -xp -C tools/lld
+ git --git-dir="${srcdir}"/lldb/.git archive master|tar -xp -C tools/lldb
+ git --git-dir="${srcdir}"/polly/.git archive master|tar -xp -C tools/polly
+
+ mkdir -p "${srcdir}/build"
+}
+
+build() {
+ cd "${srcdir}/build"
+
+ # Building with any already installed on the system LLVM OCaml bindings is very error-prone.
+ # The problems almost certainly arise from incompatibilities between the installed system-wide
+ # bindings and the newly built ones. Unfortunately, the OCAMLPATH environment variable doesn't
+ # allow overriding the search path set in the system configuration file, only adding to it.
+ # Even same version bindings cause problems in certain circumstances, so let's play safe.
+ ocamlfind query llvm >/dev/null 2>&1 && {
+ error 'Incompatible LLVM OCaml bindings installed.'
+ plain 'Building with already installed on the system LLVM OCaml bindings is not supported.'
+ plain 'Please either uninstall any currently installed llvm-ocaml* package before building,'
+ plain 'or, __preferably__, build in a clean chroot, as described on the Arch Linux wiki:'
+ plain 'https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot'
+ exit 1
+ }
+
+ export PKG_CONFIG_PATH='/usr/lib/pkgconfig'
+
+ # LLVM_BUILD_LLVM_DYLIB: Build the dynamic runtime libraries (e.g. libLLVM.so).
+ # LLVM_LINK_LLVM_DYLIB: Link our own tools against the libLLVM dynamic library, too.
+ # LLVM_BINUTILS_INCDIR: Set to binutils' plugin-api.h location in order to build LLVMgold.
+ cmake -G 'Unix Makefiles' \
+ -DCMAKE_BUILD_TYPE:STRING=Release \
+ -DCMAKE_INSTALL_PREFIX:PATH=/usr \
+ -DLLVM_APPEND_VC_REV:BOOL=ON \
+ -DLLVM_ENABLE_RTTI:BOOL=ON \
+ -DLLVM_ENABLE_FFI:BOOL=ON \
+ -DFFI_INCLUDE_DIR:PATH="$(pkg-config --variable=includedir libffi)" \
+ -DFFI_LIBRARY_DIR:PATH="$(pkg-config --variable=libdir libffi)" \
+ -DLLVM_BUILD_DOCS:BOOL=ON \
+ -DLLVM_ENABLE_SPHINX:BOOL=ON \
+ -DPOLLY_ENABLE_GPGPU_CODEGEN:BOOL=ON \
+ -DLINK_POLLY_INTO_TOOLS:BOOL=ON \
+ -DSPHINX_OUTPUT_HTML:BOOL=ON \
+ -DSPHINX_OUTPUT_MAN:BOOL=ON \
+ -DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \
+ -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
+ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
+ -DLLVM_BINUTILS_INCDIR:PATH=/usr/include \
+ "../${_pkgname}"
+
+ make
+ make ocaml_doc
+}
+
+check() {
+ cd "${srcdir}/build"
+ # Dirty fix for unittests failing because the shared lib is not in the library path.
+ # Also, disable the LLVM tests on i686 as they seem to fail too often there.
+ [[ "${CARCH}" == "i686" ]] || LD_LIBRARY_PATH="${srcdir}/build/lib" make check
+ make check-clang
+ make check-polly
+}
+
+package_llvm-git() {
+ pkgdesc='The LLVM Compiler Infrastructure'
+ depends=(
+ "llvm-libs-git=${pkgver}-${pkgrel}"
+ )
+ groups=('llvm-toolchain-git')
+ provides=('llvm-svn' 'llvm')
+ conflicts=('llvm-svn' 'llvm')
+
+ cd "${srcdir}/build"
+
+ # Disable automatic installation of components that go into subpackages
+ sed -i '/\(clang\|lld\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
+
+ make DESTDIR="${pkgdir}" install
+
+ # The runtime libraries get installed in llvm-libs-git
+ rm -f "${pkgdir}"/usr/lib/lib{LLVM,LTO}{,-*}.so{,.*}
+ mv -f "${pkgdir}"/usr/lib/{BugpointPasses,LLVMgold,LLVMHello}.so "${srcdir}/"
+
+ # Clang libraries and OCaml bindings go to separate packages
+ rm -rf "${srcdir}"/{clang,ocaml.{doc,lib}}
+ mv "${pkgdir}/usr/lib/clang" "${srcdir}/clang"
+ mv "${pkgdir}/usr/lib/ocaml" "${srcdir}/ocaml.lib"
+ mv "${pkgdir}/usr/share/doc/llvm/ocaml-html" "${srcdir}/ocaml.doc"
+
+ if [[ "${CARCH}" == "x86_64" ]]; then
+ # Needed for multilib (https://bugs.archlinux.org/task/29951)
+ # Header stubs are taken from Fedora
+ mv "${pkgdir}/usr/include/llvm/Config/llvm-config"{,-64}.h
+ cp "${srcdir}/llvm-Config-llvm-config.h" "${pkgdir}/usr/include/llvm/Config/llvm-config.h"
+ fi
+
+ # Clean up documentation
+ # TODO: This may not be needed any more.
+ rm -rf "${pkgdir}/usr/share/doc/llvm/html/_sources"
+
+ _install_python_bindings "${srcdir}/llvm/bindings/python/llvm"
+
+ _install_licenses "${srcdir}/llvm"
+}
+
+package_llvm-libs-git() {
+ pkgdesc='The LLVM Compiler Infrastructure (runtime libraries)'
+ depends=(
+ 'libedit'
+ 'libffi'
+ 'libxml2'
+ 'zlib'
+ )
+ groups=('llvm-toolchain-git')
+ provides=('llvm-libs-svn' 'llvm-libs')
+ conflicts=('llvm-libs-svn' 'llvm-libs')
+
+ cd "${srcdir}/build"
+
+ make DESTDIR="${pkgdir}" install-{LLVM,LTO}
+
+ # Moved from the llvm-git package here
+ mv "${srcdir}"/{BugpointPasses,LLVMgold,LLVMHello}.so "${pkgdir}/usr/lib/"
+
+ # Ref: https://llvm.org/docs/GoldPlugin.html
+ install -m755 -d "${pkgdir}/usr/lib/bfd-plugins"
+ ln -s {/usr/lib,"${pkgdir}/usr/lib/bfd-plugins"}/LLVMgold.so
+
+ # Since r262066 lto.h is also installed, but we don't need it in the -libs package.
+ rm -rf "${pkgdir}/usr/include"
+
+ # Must have a symlink that corresponds to the output of `llvm-config --version`.
+ # Without it, some builds, e.g. Mesa, might fail for "lack of shared libraries".
+ _sover="$(echo ${pkgver} | cut -d . -f -1)svn"
+ # libLLVM.so.3.8.0svn-r123456
+ ln -s "libLLVM-${_sover}.so" "${pkgdir}/usr/lib/libLLVM.so.$(echo ${pkgver} | tr _ -)"
+ # libLLVM-3.8.0svn-r123456.so
+ ln -s "libLLVM-${_sover}.so" "${pkgdir}/usr/lib/libLLVM-$(echo ${pkgver} | tr _ -).so"
+
+ _install_licenses "${srcdir}/llvm"
+}
+
+package_llvm-ocaml-git() {
+ pkgdesc='OCaml bindings for LLVM'
+ depends=(
+ "llvm-git=${pkgver}-${pkgrel}"
+ "ocaml=$(_ocamlver)"
+ 'ocaml-ctypes'
+ )
+ provides=('llvm-ocaml-svn' 'llvm-ocaml')
+ conflicts=('llvm-ocaml-svn' 'llvm-ocaml')
+
+ cd "${srcdir}/build"
+
+ install -m755 -d "${pkgdir}/usr/lib"
+ install -m755 -d "${pkgdir}/usr/share/doc/llvm"
+ cp -a "${srcdir}/ocaml.lib" "${pkgdir}/usr/lib/ocaml"
+ cp -a "${srcdir}/ocaml.doc" "${pkgdir}/usr/share/doc/llvm/ocaml-html"
+
+ _install_licenses "${srcdir}/llvm"
+}
+
+package_lld-git() {
+ pkgdesc='A linker from the LLVM project'
+ url='https://lld.llvm.org/'
+ depends=(
+ "llvm-libs-git=${pkgver}-${pkgrel}"
+ )
+ groups=('llvm-toolchain-git')
+ provides=('lld-svn' 'lld')
+ conflicts=('lld-svn' 'lld')
+
+ cd "${srcdir}/build/tools/lld"
+
+ make DESTDIR="${pkgdir}" install
+
+ # Clean up documentation
+ # TODO: This may at some point not be needed any more.
+ rm -rf "${pkgdir}/usr/share/doc/lld/html/_sources"
+
+ _install_licenses "${srcdir}/lld"
+}
+
+package_lldb-yurikoles-git() {
+ pkgdesc='Next generation, high-performance debugger'
+ url='https://lldb.llvm.org/'
+ depends=(
+ "llvm-libs-git=${pkgver}-${pkgrel}"
+ 'python2-six'
+ )
+ groups=('llvm-toolchain-git')
+ provides=('lldb-svn' 'lldb')
+ conflicts=('lldb-svn' 'lldb')
+
+ cd "${srcdir}/build/tools/lldb"
+
+ make DESTDIR="${pkgdir}" install
+
+ # Clean up conflicting files
+ # TODO: This should probably be discussed with upstream.
+ rm -rf "${pkgdir}/usr/lib/python2.7/site-packages/six.py"
+
+ _fix_python_exec_path \
+ "${pkgdir}${_py_sitepkg_dir}/lldb/utils/symbolication.py"
+
+ _compile_python_files "${pkgdir}${_py_sitepkg_dir}/lldb"
+
+ _install_licenses "${srcdir}/lldb"
+}
+
+package_clang-git() {
+ pkgdesc='C language family frontend for LLVM'
+ url='https://clang.llvm.org/'
+ depends=(
+ "llvm-git=${pkgver}-${pkgrel}"
+ )
+ optdepends=(
+ 'clang-analyzer-git: source code analysis for Clang, supporting C, C++, and Objective-C'
+ 'clang-compiler-rt-git: sanitizer runtimes, builtins, profile library and BlocksRuntime'
+ 'clang-tools-extra-git: standalone tools: syntax checking, formatting, refactoring, etc.'
+ 'python2: git-clang-format and clang-format-diff.py support'
+ )
+ groups=('llvm-toolchain-git')
+ provides=('clang-svn' 'clang')
+ conflicts=('clang-svn' 'clang')
+
+ cd "${srcdir}/build/tools/clang"
+
+ # Exclude the extra directory, since it'll be installed in a separate package
+ sed -i \
+ "s|^\([[:blank:]]*include(\"${srcdir}/build/tools/clang/tools/extra/cmake_install.cmake\")\)$|#\1|" \
+ tools/cmake_install.cmake
+
+ make DESTDIR="${pkgdir}" install
+
+ # The Clang Static Analyzer is installed in a separate package
+ # TODO: Probably there's more elegant way to achieve this.
+
+ rm -rf "${srcdir}/clang-analyzer.tmp"
+
+ install -m 0755 -d \
+ "${srcdir}/clang-analyzer.tmp/usr/bin" \
+ "${srcdir}/clang-analyzer.tmp/usr/share/man/man1" \
+ "${srcdir}/clang-analyzer.tmp/usr/share/scan-build" \
+ "${srcdir}/clang-analyzer.tmp/usr/share/scan-view"
+
+ mv \
+ "${pkgdir}/usr/bin/scan-build" \
+ "${pkgdir}/usr/bin/scan-view" \
+ "${pkgdir}/usr/libexec/c++-analyzer" \
+ "${pkgdir}/usr/libexec/ccc-analyzer" \
+ \
+ "${srcdir}/clang-analyzer.tmp/usr/bin/"
+
+ mv \
+ "${pkgdir}/usr/share/man/man1/scan-build.1" \
+ \
+ "${srcdir}/clang-analyzer.tmp/usr/share/man/man1/"
+
+ mv \
+ "${pkgdir}/usr/share/scan-build/scanview.css" \
+ "${pkgdir}/usr/share/scan-build/sorttable.js" \
+ \
+ "${srcdir}/clang-analyzer.tmp/usr/share/scan-build/"
+
+ mv \
+ "${pkgdir}/usr/share/scan-view/FileRadar.scpt" \
+ "${pkgdir}/usr/share/scan-view/GetRadarVersion.scpt" \
+ "${pkgdir}/usr/share/scan-view/Reporter.py" \
+ "${pkgdir}/usr/share/scan-view/ScanView.py" \
+ "${pkgdir}/usr/share/scan-view/bugcatcher.ico" \
+ "${pkgdir}/usr/share/scan-view/startfile.py" \
+ \
+ "${srcdir}/clang-analyzer.tmp/usr/share/scan-view/"
+
+ rmdir \
+ "${pkgdir}/usr/libexec" \
+ "${pkgdir}/usr/share/scan-build" \
+ "${pkgdir}/usr/share/scan-view"
+
+ # Clean up documentation
+ # TODO: This may not be needed any more.
+ rm -rf "${pkgdir}/usr/share/doc/clang/html/_sources"
+
+ _fix_python_exec_path \
+ "${pkgdir}/usr/bin/git-clang-format" \
+ "${pkgdir}/usr/share/clang/clang-format-diff.py"
+
+ _install_python_bindings "${srcdir}/llvm/tools/clang/bindings/python/clang"
+
+ _install_licenses "${srcdir}/clang"
+}
+
+package_clang-analyzer-git() {
+ pkgdesc='Source code analysis tool for Clang, supporting C, C++, and Objective-C'
+ url='https://clang-analyzer.llvm.org/'
+ depends=(
+ "clang-git=${pkgver}-${pkgrel}"
+ 'perl'
+ 'python2'
+ )
+ groups=('llvm-toolchain-git')
+ provides=('clang-analyzer-git' 'clang-analyzer')
+ conflicts=('clang-analyzer-git' 'clang-analyzer')
+
+ cd "${srcdir}"
+
+ mv "${srcdir}/clang-analyzer.tmp"/* "${pkgdir}"/
+
+ sed -i 's|/libexec/|/bin/|' "${pkgdir}/usr/bin/scan-build"
+
+ _fix_python_exec_path \
+ "${pkgdir}/usr/bin/scan-view"
+
+ _compile_python_files "${pkgdir}/usr/share/scan-view"
+
+ _install_licenses "${srcdir}/clang"
+}
+
+package_clang-compiler-rt-git() {
+ pkgdesc='The "compiler-rt" set of runtime libraries for Clang and LLVM'
+ url='https://compiler-rt.llvm.org/'
+ depends=(
+ "clang-git=${pkgver}-${pkgrel}"
+ )
+ groups=('llvm-toolchain-git')
+ provides=('clang-compiler-rt-git' 'clang-compiler-rt')
+ conflicts=('clang-compiler-rt-git' 'clang-compiler-rt')
+
+ cd "${srcdir}/build/projects/compiler-rt"
+
+ make DESTDIR="${pkgdir}" install
+
+ _install_licenses "${srcdir}/compiler-rt"
+}
+
+package_clang-tools-extra-git() {
+ pkgdesc='Standalone tools for Clang: syntax checking, formatting, refactoring, etc.'
+ url='https://clang.llvm.org/docs/ClangTools.html'
+ depends=(
+ "clang-git=${pkgver}-${pkgrel}"
+ )
+ groups=('llvm-toolchain-git')
+ provides=('clang-tools-extra-git' 'clang-tools-extra')
+ conflicts=('clang-tools-extra-git' 'clang-tools-extra')
+
+ cd "${srcdir}/build/tools/clang/tools/extra"
+
+ make DESTDIR="${pkgdir}" install
+
+ _install_licenses "${srcdir}/clang-tools-extra"
+}
+
+# vim:set ts=4 sts=4 sw=4 et: