# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=3.3 pkgrel=0 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 python chrpath" install= subpackages="clang $pkgname-dev $pkgname-doc $pkgname-libs" source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.gz http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.gz llvm-3.3-alpine-linux.patch " # clang hardcodes linker paths; and don't know of a fix like the --with-dynamic-linker # patch we use for gcc. So llvm-3.2-alpine-linux.patch needs to be updated if/when the # uClibc ABI version (as of uClibc 0.9.33.2, this is 0.9.32) increases. _builddir="$srcdir"/build _srcdir="$srcdir"/"$pkgname-$pkgver.src" prepare() { mkdir "$_builddir" msg "Preparing CLANG sources..." mv "$srcdir"/cfe-$pkgver.src \ "$srcdir"/$pkgname-$pkgver.src/tools/clang || return 1 msg "Patching LLVM core..." cd "$srcdir"/$pkgname-$pkgver.src || return 1 for i in $source; do case $i in *.patch) msg "Applying $i..." patch -s -p1 -N -i "$srcdir"/$i || return 1 ;; esac done # fails to link rm ./unittests/Support/formatted_raw_ostream_test.cpp } build() { cd "$_builddir" export CBUILD sed -i -e '/case "\${UNAME_MACHINE}:\${UNAME_SYSTEM}:\${UNAME_RELEASE}:\${UNAME_VERSION}" in/i \' \ -e 'if [ x != "x$CBUILD" ]; then echo "$CBUILD"; exit; fi' \ ../$pkgname-$pkgver.src/autoconf/config.guess \ ../$pkgname-$pkgver.src/projects/sample/autoconf/config.guess \ || return 1 $_srcdir/configure \ --build=$CBUILD \ --host=$CHOST \ --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 chrpath -d "$pkgdir"/usr/bin/* "$pkgdir"/usr/lib/*.so } clang() { pkgdesc="A C language family front-end for LLVM" mkdir -p "$subpkgdir"/usr/bin \ "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang mv "$pkgdir"/usr/bin/clang* "$pkgdir"/usr/bin/c-index-test \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/lib/clang \ "$pkgdir"/usr/lib/libclang.so \ "$subpkgdir"/usr/lib/ || return 1 cp -r "$_srcdir"/tools/clang/tools/scan-build "$subpkgdir"/usr/share/clang/scan-build cp -r "$_srcdir"/tools/clang/tools/scan-view "$subpkgdir"/usr/share/clang/scan-view ln -s /usr/share/clang/scan-build/scan-build "$subpkgdir"/usr/bin/scan-build ln -s /usr/share/clang/scan-view/scan-view "$subpkgdir"/usr/bin/scan-view } libs() { pkgdesc="LLVM shared libraries" mkdir -p "$subpkgdir"/usr/lib/ mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/ } md5sums="40564e1dc390f9844f1711c08b08e391 llvm-3.3.src.tar.gz 8284891e3e311829b8e44ac813d0c9ef cfe-3.3.src.tar.gz 5d5f4da3582349c9a8626cf55f8ac5e4 llvm-3.3-alpine-linux.patch" sha256sums="68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 llvm-3.3.src.tar.gz b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 cfe-3.3.src.tar.gz 4c9a6b6838585ffe8d5ea063a1fa51514d407f9bb32ad56e859ed30c612fa641 llvm-3.3-alpine-linux.patch" sha512sums="1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 llvm-3.3.src.tar.gz 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc cfe-3.3.src.tar.gz 4c177652bca81168e70ed37f95b337eea0fc4ad17ca8a5d77a018124aad89c06f851b92b9c89708b616fa37404a4a26f002dc035f6d4d7e22d97369d3fe71a95 llvm-3.3-alpine-linux.patch"