# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=3.4.2 pkgrel=0 pkgdesc="low level virtual machine compiler system" arch="x86 x86_64 armhf" 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-alpine-linux.patch llvm-musl.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() { 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 update_config_sub || 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() { mkdir "$_builddir" 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 \ --enable-optimized \ || 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="a20669f75967440de949ac3b1bad439c llvm-3.4.2.src.tar.gz 87945973b7c73038871c5f849a818588 cfe-3.4.2.src.tar.gz 524a204746c423bae0b041e4b409a687 llvm-alpine-linux.patch 69892689105e1698988b5be3a763b511 llvm-musl.patch" sha256sums="17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7 llvm-3.4.2.src.tar.gz 5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10 cfe-3.4.2.src.tar.gz c741573b6495d307085cf06bfc7d315bd3d6ef92fbb01e4c09cd5f1d84840a6a llvm-alpine-linux.patch 69bf4a102d50e31853371883da1062560bdf7894bdb289c0a9522a214e0473c8 llvm-musl.patch" sha512sums="6c1453f7d9d9110257db3574cc4f6227fed8938705cbb09851ac09a868089b48f1556a1b6e758aff6d97520b08b5605d3ed20411ad9dd22cdc573d62176905f0 llvm-3.4.2.src.tar.gz e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d cfe-3.4.2.src.tar.gz fc566961272054e7415d0215712fd6d986341850d9281ccbcfc861c320bac6d9f3bac90571f2b72e940be4f843ad6e9133446d9fce0770514ccf39ad923bc0c8 llvm-alpine-linux.patch 3049ad58c65791549cc696edc5920a1a2fabf87808c92a4c3fc5b70ee88745df63e2f0fd38be50e9df2055d05d922d2ccb3fe2542e9f31b4133c47c2f2b0fa93 llvm-musl.patch"