# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=2.9 pkgrel=5 pkgdesc="low level virtual machine compiler system" arch="x86 x86_64" url="http://llvm.org/" license="UOI-NCSA" depends= depends_dev="perl" makedepends="$depends_dev groff libffi-dev" install= subpackages="clang $pkgname-dev $pkgname-doc $pkgname-libs" source="http://llvm.org/releases/$pkgver/llvm-$pkgver.tgz http://llvm.org/releases/$pkgver/clang-$pkgver.tgz clang-2.9-alpine-linux.patch " _builddir="$srcdir"/build prepare() { mkdir "$_builddir" msg "Preparing CLANG sources..." mv "$srcdir"/clang-$pkgver "$srcdir"/$pkgname-$pkgver/tools/clang msg "Patching LLVM core..." cd "$srcdir"/$pkgname-$pkgver for i in $source; do case $i in *.patch) msg "Applying $i..." patch -s -p1 -N -i "$srcdir"/$i || return 1 ;; esac done } build() { cd "$_builddir" ../$pkgname-$pkgver/configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --enable-ffi \ --enable-shared \ || return 1 # configure gets it wrong. We do have error_t sed -i -e 's/.*undef HAVE_ERROR_T.*/#define HAVE_ERROR_T 1/' \ -e '/define error_t/d' \ ./include/llvm/Config/config.h || return 1 make || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install #relocate docs mkdir -p "$pkgdir"/usr/share/doc mv "$pkgdir"/usr/docs/llvm "$pkgdir"/usr/share/doc/ || return 1 rmdir "$pkgdir"/usr/docs || return 1 } clang() { pkgdesc="A C language family front-end for LLVM" mkdir -p "$subpkgdir"/usr/bin \ "$subpkgdir"/usr/lib mv "$pkgdir"/usr/bin/clang* "$pkgdir"/usr/bin/tblgen \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/lib/clang \ "$pkgdir"/usr/lib/libclang.so \ "$subpkgdir"/usr/lib/ || return 1 } libs() { pkgdesc="LLVM shared libraries" mkdir -p "$subpkgdir"/usr/lib/ mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/ } md5sums="793138412d2af2c7c7f54615f8943771 llvm-2.9.tgz 634de18d04b7a4ded19ec4c17d23cfca clang-2.9.tgz 6ca9d6b9706ab4e04d976c25e72952dd clang-2.9-alpine-linux.patch"