# Contributor: William Pitcock # Maintainer: William Pitcock pkgname=llvm pkgver=3.5.1 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="2d3d8004f38852aa679e5945b8ce0b14 llvm-3.5.1.src.tar.xz 93f9532f8f7e6f1d8e5c1116907051cb cfe-3.5.1.src.tar.xz 6027b00815344fe834e3e3208fc471d9 llvm-alpine-linux.patch 832e665e4972afb94fb6c976a7e35c69 llvm-musl.patch" sha256sums="bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 llvm-3.5.1.src.tar.xz 6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c cfe-3.5.1.src.tar.xz 789ae8672503be241ef371933795cee148cbc16c3b633c37344ea7b4aef89189 llvm-alpine-linux.patch 1e4c4d9e2d76719c2fedc6fe1ce03e59a16521bdb2562e84255a82d510a4f894 llvm-musl.patch" sha512sums="a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 llvm-3.5.1.src.tar.xz bd904586f6155c05d2f7ddd05b86c28feae883cdc60e2cb3b48d4ae0ce55916064bcea414a46518d0fb73618f18a3f3fca6cc4cad81083428a2221299f5c5c7f cfe-3.5.1.src.tar.xz 65a74090d6541e105220e79944181dca15aca258178a755ac42b7066277202b59836998a27856bab57cf76200a4e538124a6110ea8bcdc15b0abf2508a6e681d llvm-alpine-linux.patch e9531f86521628a1f0b73e15da55c6d51c7283a0239bc481b89a73c5195ae605b6680e75cbcd9197b71ceab534082f86e0e4d39701edcbe9195cc01df97285b9 llvm-musl.patch"