diff options
Diffstat (limited to 'community-testing/llvm')
-rw-r--r-- | community-testing/llvm/PKGBUILD | 79 | ||||
-rw-r--r-- | community-testing/llvm/clang-pure64.patch | 38 | ||||
-rw-r--r-- | community-testing/llvm/enable-lto.patch | 36 |
3 files changed, 135 insertions, 18 deletions
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 <foutrelis@gmail.com> +# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com> # Contributor: Sebastian Nowicki <sebnow@gmail.com> # Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us> # Contributor: Tobias Kieslich <tobias@justdreams.de> @@ -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 diff --git a/community-testing/llvm/clang-pure64.patch b/community-testing/llvm/clang-pure64.patch new file mode 100644 index 000000000..da6178519 --- /dev/null +++ b/community-testing/llvm/clang-pure64.patch @@ -0,0 +1,38 @@ +Index: lib/Driver/Tools.cpp +=================================================================== +--- lib/Driver/Tools.cpp (revision 123373) ++++ lib/Driver/Tools.cpp (working copy) +@@ -3306,7 +3306,7 @@ + else if (ToolChain.getArch() == llvm::Triple::arm) + CmdArgs.push_back("/lib/ld-linux.so.3"); + else +- CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2"); ++ CmdArgs.push_back("/lib/ld-linux-x86-64.so.2"); + } + + CmdArgs.push_back("-o"); +Index: lib/Driver/ToolChains.cpp +=================================================================== +--- lib/Driver/ToolChains.cpp (revision 123373) ++++ lib/Driver/ToolChains.cpp (working copy) +@@ -1317,18 +1317,10 @@ + if (Arch == llvm::Triple::x86) + Suffix64 = "/64"; + +- std::string Lib32 = "lib"; +- +- bool Exists; +- if (!llvm::sys::fs::exists("/lib32", Exists) && Exists) +- Lib32 = "lib32"; +- ++ std::string Lib32 = "lib32"; + std::string Lib64 = "lib"; +- bool Symlink; +- if (!llvm::sys::fs::exists("/lib64", Exists) && Exists && +- (llvm::sys::fs::is_symlink("/lib64", Symlink) || !Symlink)) +- Lib64 = "lib64"; + ++ bool Exists; + std::string GccTriple = ""; + if (Arch == llvm::Triple::arm) { + if (!llvm::sys::fs::exists("/usr/lib/gcc/arm-linux-gnueabi", Exists) && diff --git a/community-testing/llvm/enable-lto.patch b/community-testing/llvm/enable-lto.patch new file mode 100644 index 000000000..40d93104a --- /dev/null +++ b/community-testing/llvm/enable-lto.patch @@ -0,0 +1,36 @@ +Index: lib/Driver/ToolChains.cpp +=================================================================== +--- lib/Driver/ToolChains.cpp (revision 123373) ++++ lib/Driver/ToolChains.cpp (working copy) +@@ -1398,11 +1398,11 @@ + Lib = Lib64; + } + +- llvm::sys::Path LinkerPath(Base + "/../../../../" + GccTriple + "/bin/ld"); ++ llvm::sys::Path LinkerPath(Base + "/../../../../" + GccTriple + "/bin/ld.gold"); + if (!llvm::sys::fs::exists(LinkerPath.str(), Exists) && Exists) + Linker = LinkerPath.str(); + else +- Linker = GetProgramPath("ld"); ++ Linker = GetProgramPath("ld.gold"); + + LinuxDistro Distro = DetectLinuxDistro(Arch); + +Index: lib/Driver/Tools.cpp +=================================================================== +--- lib/Driver/Tools.cpp (revision 123373) ++++ lib/Driver/Tools.cpp (working copy) +@@ -3412,11 +3412,11 @@ + } + } + +- if (Args.hasArg(options::OPT_use_gold_plugin)) { ++ // if (Args.hasArg(options::OPT_use_gold_plugin)) { + CmdArgs.push_back("-plugin"); + std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); +- } ++ // } + + C.addCommand(new Command(JA, *this, ToolChain.Linker.c_str(), CmdArgs)); + } |