# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=3.5.0 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.xz http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz 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 \ || 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="d6987305a1a0e58e128c1374cd3b8fef llvm-3.5.0.src.tar.xz 27718dd13c7df83e15f997116bbb4aef cfe-3.5.0.src.tar.xz 6027b00815344fe834e3e3208fc471d9 llvm-alpine-linux.patch 832e665e4972afb94fb6c976a7e35c69 llvm-musl.patch" sha256sums="28e199f368ef0a4666708f31c7991ad3bcc3a578342b0306526dd35f07595c03 llvm-3.5.0.src.tar.xz fc80992e004b06f6c7afb612de1cdaa9ac9d25811c55f94fcf7331d9b81cdb8b cfe-3.5.0.src.tar.xz 789ae8672503be241ef371933795cee148cbc16c3b633c37344ea7b4aef89189 llvm-alpine-linux.patch 1e4c4d9e2d76719c2fedc6fe1ce03e59a16521bdb2562e84255a82d510a4f894 llvm-musl.patch" sha512sums="b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 llvm-3.5.0.src.tar.xz b26a5e2cd81c150607c23b22fafc0d9c7f12b83b45e476b8e75bf5e99d42be7c98ffeac7349df664f01b00900864a01429860b298e48961861377a4b2daf3e49 cfe-3.5.0.src.tar.xz 65a74090d6541e105220e79944181dca15aca258178a755ac42b7066277202b59836998a27856bab57cf76200a4e538124a6110ea8bcdc15b0abf2508a6e681d llvm-alpine-linux.patch e9531f86521628a1f0b73e15da55c6d51c7283a0239bc481b89a73c5195ae605b6680e75cbcd9197b71ceab534082f86e0e4d39701edcbe9195cc01df97285b9 llvm-musl.patch"