summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 12e34b9b0d8cced751dd32f00c6e018cd72363d2 (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
# Maintainer: Ebrahim Byagowi <ebrahim@gnu.org>

pkgname=llvm-toolchain-nightly-bin
pkgver=12
pkgrel=1
pkgdesc="NOT READY YET. Precompiled binaries of llvm-toolchain (clang+lld+lldb+...) nightly builds. Status: Can't fetch llvm version."
arch=('x86_64')
url="https://llvm.org/"
license=('custom:Apache 2.0 with LLVM Exception')
depends=("libedit" "zlib") # TODO: check what it actually relies to by looking at control files
makedepends=('patchelf' 'wget')
provides=("clang-analyzer=$pkgver" "clang-tools-extra=$pkgver"
          "clang=$pkgver" "lld=$pkgver" "llvm=$pkgver"
          "compiler-rt=$pkgver" "polly=$pkgver"
          "lldb=$pkgver" "openmp=$pkgver")
source=()
sha256sums=()

package() {
  wget --mirror --no-directories --no-parent --compress=auto \
    --reject="index.html*" --reject="*-dbgsym_*" \
    --reject="*_i386*" --reject="*_arm*" \
    --reject="*.tar.xz" --reject="*.dsc" \
    --reject="*ocaml*" \
    https://apt.llvm.org/unstable/pool/main/l/llvm-toolchain-snapshot/

  for f in *.deb; do
    ar xv $f
    tar xf data.tar.xz -C "${pkgdir}"
    rm debian-binary control.tar.xz data.tar.xz
  done

  cd "$pkgdir/usr/bin"
  for f in *-$pkgver; do
    ln -s $f ${f::-3}
  done

  cd "$pkgdir/usr/lib/x86_64-linux-gnu"
  for f in *; do
    # TODO: a better way?
    ln -s $(readlink -f $f) ../$f
  done

  patchelf=(patchelf)
  patchelf+=(--replace-needed "libedit.so.2" "libedit.so")
  patchelf+=(--replace-needed "libz3.so.4" "libz.so")
  find "${pkgdir}/" -type f -not -name '*.py' -not -name '*.el' \
    -not -name '*.sh' -not -name '*.h' -not -path '*/usr/share/*' \
    -not -name '*.def' -not -name '*.td' -not -name '*.inc' \
    -not -path '*/utils/lit/*' -not -path '*/include/*' \
    -not -path '*/cmake/*' \
    -exec "${patchelf[@]}" {} \;
}