summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eedfd9c2791c017a35a4de133f9c4b2c1927ff30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Maintainer: Lone_Wolf <lonewolf@xs4all.nl>
# Contributor: yurikoles <root@yurikoles.com>
# Contributor: bearoso <bearoso@gmail.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: Jan "heftig" Steffens <jan.steffens@gmail.com>
# 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>

pkgname=compiler-rt-lw-git
pkgver=9.0.0_r315265.6c9f6fd11b6
pkgrel=1
pkgdesc="Compiler runtime libraries for clang"
arch=('x86_64')
url="https://compiler-rt.llvm.org/"
license=('custom:University of Illinois/NCSA Open Source License')
depends=('gcc-libs')
makedepends=('git' 'llvm-lw-git' 'llvm-libs-lw-git' 'cmake' 'ninja' 'python' 'llvm-libs')
# llvm-libs is needed for llvm gold linker
# Build 32-bit compiler-rt libraries on x86_64 (FS#41911)
makedepends_x86_64=('lib32-gcc-libs')
options=('staticlibs')
source=(llvm-project::git+https://github.com/llvm/llvm-project.git)
sha256sums=('SKIP')

pkgver() {
    cd llvm-project/llvm

    # 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 |)' \
            '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}"
}


build() {
    if [  -d _build ]; then
        rm -rf _build
    fi
    mkdir _build
    cd _build
  
    cmake "$srcdir"/llvm-project/compiler-rt/ -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr
    if [[ ! $NINJAFLAGS ]]; then
        ninja
    else
        ninja "$NINJAFLAGS"
    fi
}

package() {
  conflicts=('compiler-rt')
  provides=(compiler-rt=$pkgver-$pkgrel compiler-rt-git=$pkgver-$pkgrel)

  cd _build 

  DESTDIR="$pkgdir" ninja install
  install -Dm644 "$srcdir"/llvm-project/compiler-rt/LICENSE.TXT "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  mkdir -p "$pkgdir"/usr/lib/clang/$pkgver/{lib,share}
  mv "$pkgdir"/usr/lib/{linux,clang/$pkgver/lib/}
  mv "$pkgdir"/usr/{share/*.txt,lib/clang/$pkgver/share/}
}

# vim:set ts=2 sw=2 et: