From 28b5bbf3fee0627993658e096eadab71c2779912 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 12 Apr 2011 10:53:36 +0000 Subject: Tue Apr 12 10:53:36 UTC 2011 --- community-testing/llvm/PKGBUILD | 79 +++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 18 deletions(-) (limited to 'community-testing/llvm/PKGBUILD') diff --git a/community-testing/llvm/PKGBUILD b/community-testing/llvm/PKGBUILD index 641daa196..99ea6e4a7 100644 --- a/community-testing/llvm/PKGBUILD +++ b/community-testing/llvm/PKGBUILD @@ -1,5 +1,6 @@ -# $Id: PKGBUILD 44509 2011-04-07 21:22:51Z foutrelis $ +# $Id: PKGBUILD 44752 2011-04-11 14:36:48Z foutrelis $ # Maintainer: Evangelos Foutras +# Contributor: Jan "heftig" Steffens # Contributor: Sebastian Nowicki # Contributor: Devin Cofer # Contributor: Tobias Kieslich @@ -11,21 +12,27 @@ pkgname=('llvm' 'llvm-ocaml' 'clang' 'clang-analyzer') pkgver=2.9 _gcc_ver=4.6.0 -pkgrel=3 +pkgrel=4 arch=('i686' 'x86_64') url="http://llvm.org/" license=('custom:University of Illinois/NCSA Open Source License') makedepends=('gcc-libs' 'libffi' 'python2' 'ocaml' "gcc=$_gcc_ver") source=(http://llvm.org/releases/$pkgver/$pkgname-$pkgver.tgz http://llvm.org/releases/$pkgver/clang-$pkgver.tgz + ftp://ftp.archlinux.org/other/community/clang/gcc-headers-4.5.2.tar.xz clang-plugin-loader-registry.patch cindexer-clang-path.patch - clang-toolchains-gcc-versions.patch) + clang-toolchains-gcc-versions.patch + clang-pure64.patch + enable-lto.patch) md5sums=('793138412d2af2c7c7f54615f8943771' '634de18d04b7a4ded19ec4c17d23cfca' + '70e23a3dc2b38ecb2bb4d2c48f47295d' '02c23b4aaca3445b8bf39fddb2f9906e' '87a7162dbe99e9ffce6c40bd09f5f4f0' - '8da236120a9a287a977b575b8b905c93') + '8da236120a9a287a977b575b8b905c93' + '225ee6b531f8327f34f344a18cb4ec81' + '8f7582d7440e4a8342c3aea9ec714fb4') build() { cd "$srcdir/$pkgname-$pkgver" @@ -57,21 +64,52 @@ build() { # Add GCC 4.6.0 to GccVersions (FS#23631) patch -d tools/clang -Np1 -i "$srcdir/clang-toolchains-gcc-versions.patch" + if [[ $CARCH == x86_64 ]]; then + # Adjust lib paths + patch -d tools/clang -Np0 -i "$srcdir/clang-pure64.patch" + fi + + # Make -flto work + # Use gold instead of default linker, and always use the plugin + patch -d tools/clang -Np0 -i "$srcdir/enable-lto.patch" + # Apply strip option to configure - _optimize_flag="--enable-optimize" - [ "$(check_option strip)" = "n" ] && _optimize_flag="--disable-optimize" + _optimized_switch="enable" + [[ $(check_option strip) == n ]] && _optimized_switch="disable" # Include location of libffi headers in CPPFLAGS export CPPFLAGS="$CPPFLAGS $(pkg-config --cflags libffi)" - ./configure --prefix=/usr --libdir=/usr/lib/llvm --sysconfdir=/etc \ - --enable-shared --enable-libffi \ - --enable-bindings=ocaml --enable-targets=all \ - --disable-expensive-checks --disable-debug-runtime \ - --disable-assertions --with-binutils-include=/usr/include \ - $_optimize_flag \ - --with-cxx-include-root=/usr/include/c++/$_gcc_ver \ - --with-cxx-include-arch=$CHOST + # TODO: Uncomment when clang works with GCC 4.6+ + #_cxx_headers="/usr/include/c++/$_gcc_ver" + #if [[ ! -d $_cxx_headers ]]; then + # error "Couldn't find the C++ headers, PKGBUILD needs fixing!" + # return 1 + #fi + _cxx_headers="/usr/include/c++/clang-$pkgver" + + _32bit_headers="" + if [[ $CARCH == x86_64 ]]; then + # Important for multilib + _32bit_headers="32" + fi + + ./configure \ + --prefix=/usr \ + --libdir=/usr/lib/llvm \ + --sysconfdir=/etc \ + --enable-shared \ + --enable-libffi \ + --enable-targets=all \ + --disable-expensive-checks \ + --disable-debug-runtime \ + --disable-assertions \ + --with-binutils-include=/usr/include \ + --with-cxx-include-root=$_cxx_headers \ + --with-cxx-include-arch=$CHOST \ + --with-cxx-include-32bit-dir=$_32bit_headers \ + --$_optimized_switch-optimized + make REQUIRES_RTTI=1 } @@ -105,7 +143,7 @@ package_llvm() { rm "$pkgdir"/usr/lib/llvm/*LLVMHello.* # Symlink the gold plugin where clang expects it - ln -s "llvm/libLLVMgold.so" "$pkgdir/usr/lib/LLVMgold.so" + ln -s llvm/LLVMgold.so "$pkgdir/usr/lib/LLVMgold.so" # Add ld.so.conf.d entry install -d "$pkgdir/etc/ld.so.conf.d" @@ -151,6 +189,11 @@ package_clang() { sed -i 's:$(PROJ_prefix)/share/doc/clang:$(PROJ_prefix)/share/doc/llvm:' \ "$srcdir/llvm-$pkgver/Makefile.config" + # Install old libstdc++ headers. Contains combined headers from + # gcc 4.5.2-6-i686 and gcc-multilib-4.5.2-6-x86_64 + install -d "$pkgdir/usr/include/c++" + cp -rd "$srcdir/gcc-headers-4.5.2" "$pkgdir/usr/include/c++/clang-$pkgver" + install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/clang/LICENSE" } @@ -162,9 +205,9 @@ package_clang-analyzer() { cd "$srcdir/llvm-$pkgver/tools/clang" install -d "$pkgdir"/usr/{bin,lib/clang-analyzer} - for tool in scan-{build,view}; do - cp -r tools/$tool "$pkgdir/usr/lib/clang-analyzer" - ln -s /usr/lib/clang-analyzer/$tool/$tool "$pkgdir/usr/bin" + for _tool in scan-{build,view}; do + cp -r tools/$_tool "$pkgdir/usr/lib/clang-analyzer/" + ln -s /usr/lib/clang-analyzer/$_tool/$_tool "$pkgdir/usr/bin/" done # Use Python 2 -- cgit v1.2.3-54-g00ecf