# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=3.2 pkgrel=4 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/clang-$pkgver.src.tar.gz llvm-3.2-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"/clang-$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 } 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 \ --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="71610289bbc819e3e15fdd562809a2d7 llvm-3.2.src.tar.gz 3896ef4334df08563b05d0848ba80582 clang-3.2.src.tar.gz 3014842ee498ffe044773ef3a7f859ca llvm-3.2-alpine-linux.patch" sha256sums="125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 llvm-3.2.src.tar.gz 2aaaf03f7c0f6b16fe97ecc81247dc2bf2d4bec7620a77cc74670b7e07ff5658 clang-3.2.src.tar.gz 0496f84b97131b393662f4031bf7e117caaa29702bea569e8d4d783093c3067f llvm-3.2-alpine-linux.patch" sha512sums="cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc llvm-3.2.src.tar.gz 99fc57d19b76c42af9821eaaa762056a926eb68178f6b7dd5e8bf092c9ee201a554b91d760d5a30a57f38102eae340e080ef8c6a39327f6881eda391b20b108d clang-3.2.src.tar.gz 3878cfff1ab702c275d47b831751d87b2a112223ea6fe1fcc30e5f8e06b2fedf4f07b8ca9c65b3e6ac35dc6feba8d91a8b0579f9b2fe194ccdb202c2b9338640 llvm-3.2-alpine-linux.patch"