Skip to content

Instantly share code, notes, and snippets.

@ebraminio
Last active May 14, 2021 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebraminio/ef74d558737daddb4ed77184c1f26168 to your computer and use it in GitHub Desktop.
Save ebraminio/ef74d558737daddb4ed77184c1f26168 to your computer and use it in GitHub Desktop.
[WIP] Download and install llvm nightly in Arch Linux
pkgbase = llvm-toolchain-nightly-bin
pkgdesc = NOT READY YET. Precompiled binaries of llvm-toolchain (clang+lld+lldb+...) nightly builds. Status: Can't fetch llvm version.
pkgver = 12
pkgrel = 1
url = https://llvm.org/
arch = x86_64
license = custom:Apache 2.0 with LLVM Exception
makedepends = patchelf
makedepends = wget
depends = libedit
depends = zlib
provides = clang-analyzer=12
provides = clang-tools-extra=12
provides = clang=12
provides = lld=12
provides = llvm=12
provides = compiler-rt=12
provides = polly=12
provides = lldb=12
provides = openmp=12
pkgname = llvm-toolchain-nightly-bin
# 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[@]}" {} \;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment