From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 934521381F3 for ; Thu, 18 Jul 2013 21:52:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C7EADE0B75; Thu, 18 Jul 2013 21:52:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4DCD3E0B75 for ; Thu, 18 Jul 2013 21:52:55 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DC2CF33E746 for ; Thu, 18 Jul 2013 21:52:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 75B26E468F for ; Thu, 18 Jul 2013 21:52:52 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1374184361.84983975af34457a15152918636594e7fe219481.mgorny@gentoo> Subject: [gentoo-commits] dev/mgorny:master commit in: sys-devel/llvm/files/, sys-devel/clang/, sys-devel/llvm/ X-VCS-Repository: dev/mgorny X-VCS-Files: sys-devel/clang/clang-3.3-r100.ebuild sys-devel/clang/clang-9999-r100.ebuild sys-devel/llvm/Manifest sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch sys-devel/llvm/files/llvm-3.3-R600_debug.patch sys-devel/llvm/llvm-3.3-r1.ebuild X-VCS-Directories: sys-devel/llvm/files/ sys-devel/clang/ sys-devel/llvm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 84983975af34457a15152918636594e7fe219481 X-VCS-Branch: master Date: Thu, 18 Jul 2013 21:52:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b2e3d635-c832-4511-885d-a268c02e0ac7 X-Archives-Hash: fe2f650f65d0f845691b77821e0128a7 commit: 84983975af34457a15152918636594e7fe219481 Author: Michał Górny gentoo org> AuthorDate: Thu Jul 18 21:52:41 2013 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Jul 18 21:52:41 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=84983975 Backport the LLVM/Clang changes to 3.3. --- ...lang-9999-r100.ebuild => clang-3.3-r100.ebuild} | 4 +- sys-devel/clang/clang-9999-r100.ebuild | 2 +- sys-devel/llvm/Manifest | 4 + ...clang-3.1-gentoo-runtime-gcc-detection-v3.patch | 29 ++ sys-devel/llvm/files/llvm-3.3-R600_debug.patch | 22 ++ sys-devel/llvm/llvm-3.3-r1.ebuild | 400 +++++++++++++++++++++ 6 files changed, 458 insertions(+), 3 deletions(-) diff --git a/sys-devel/clang/clang-9999-r100.ebuild b/sys-devel/clang/clang-3.3-r100.ebuild similarity index 68% copy from sys-devel/clang/clang-9999-r100.ebuild copy to sys-devel/clang/clang-3.3-r100.ebuild index d60b42b..447fc8e 100644 --- a/sys-devel/clang/clang-9999-r100.ebuild +++ b/sys-devel/clang/clang-3.3-r100.ebuild @@ -10,10 +10,10 @@ SRC_URI="" LICENSE="UoI-NCSA" SLOT="0" -KEYWORDS="" +KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" IUSE="debug multitarget python +static-analyzer" -RDEPEND="sys-devel/llvm[clang(-),debug=,multitarget=,python=,static-analyzer=]" +RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget=,python=,static-analyzer=]" # Please keep this package around since it's quite likely that we'll # return to separate LLVM & clang ebuilds when the cmake build system diff --git a/sys-devel/clang/clang-9999-r100.ebuild b/sys-devel/clang/clang-9999-r100.ebuild index d60b42b..8691a84 100644 --- a/sys-devel/clang/clang-9999-r100.ebuild +++ b/sys-devel/clang/clang-9999-r100.ebuild @@ -13,7 +13,7 @@ SLOT="0" KEYWORDS="" IUSE="debug multitarget python +static-analyzer" -RDEPEND="sys-devel/llvm[clang(-),debug=,multitarget=,python=,static-analyzer=]" +RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget=,python=,static-analyzer=]" # Please keep this package around since it's quite likely that we'll # return to separate LLVM & clang ebuilds when the cmake build system diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest new file mode 100644 index 0000000..ad8ff49 --- /dev/null +++ b/sys-devel/llvm/Manifest @@ -0,0 +1,4 @@ +DIST cfe-3.3.src.tar.gz 9425539 SHA256 b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 SHA512 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc WHIRLPOOL 8b97b527f19015dd3283b9e174615170e639793f64c635ccc4ee4d8216f8de759fd0121a8ef3513fa1c6ad19b31aa3529091ffb44a01ee858edfef400881596a +DIST compiler-rt-3.3.src.tar.gz 1568034 SHA256 0e2f3180d6316e6c43f064fdd406c5c6515e682c5f31c57c28335b68c7525423 SHA512 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 WHIRLPOOL fcfd06bc860dfd901a7576cd4309f863e9d4363e36ab4c67e9e08fe3c8a37d627ee95eb96b9ed53eb6047dec06e73181b3c3e1555b1b49f1e893e6382f21ddc1 +DIST llvm-3.3-manpages.tar.bz2 27098 SHA256 46bb22d63d5fe7dd04e1a7bb7e16c03d93f2ed51d31540cfb9d97ed70059aa77 SHA512 6f24b66b13025d0606908f91ad9b4fc6de1b4aac2d97d261f6b989065476cf153d2f84792f8dd4972b95fb1a45a3931c328df3bcf8ce5ab21170a7a912a39783 WHIRLPOOL 31b9c3635b698f404b75b87c7891b4b6be9cbeb6062bcb6fba5476b0b3069a486ba60c27ab2b12b8a2da9404f666617162041860f023951050a9fc4c7d27748a +DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866 diff --git a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch new file mode 100644 index 0000000..49f1085 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,29 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400 +@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC + Prefixes.push_back(D.InstalledDir + "/.."); + } + ++ llvm::OwningPtr File; ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File)) ++ { ++ bool Exists; ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); diff --git a/sys-devel/llvm/files/llvm-3.3-R600_debug.patch b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch new file mode 100644 index 0000000..b104273 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch @@ -0,0 +1,22 @@ +Fixes compilation of llvm-3.3 on gcc-4.6 and 4.7 when VIDEO_CARDS=radeon + +This issue is caused because although Q is a multiset the original code tries to get +a set iterator which can't be converted in a multiset one. + +The fix is as simple as just using a multiset iterator. + +Patch by Francisco Blas Izquierdo Riera (klondike) +Consider the changes in the Public Domain +https://bugs.gentoo.org/show_bug.cgi?id=474096 + +--- lib/Target/R600/R600MachineScheduler.cpp ++++ lib/Target/R600/R600MachineScheduler.cpp +@@ -290,7 +290,7 @@ + SUnit *R600SchedStrategy::PopInst(std::multiset &Q) { + if (Q.empty()) + return NULL; +- for (std::set::iterator It = Q.begin(), E = Q.end(); ++ for (std::multiset::iterator It = Q.begin(), E = Q.end(); + It != E; ++It) { + SUnit *SU = *It; + InstructionsGroupCandidate.push_back(SU->getInstr()); diff --git a/sys-devel/llvm/llvm-3.3-r1.ebuild b/sys-devel/llvm/llvm-3.3-r1.ebuild new file mode 100644 index 0000000..5cd52a6 --- /dev/null +++ b/sys-devel/llvm/llvm-3.3-r1.ebuild @@ -0,0 +1,400 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header$ + +EAPI=5 + +PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy{1_9,2_0} ) + +inherit eutils flag-o-matic multilib multilib-minimal \ + python-r1 toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="clang debug doc gold kernel_FreeBSD +libffi multitarget ocaml python + +static-analyzer test udis86 vim-syntax video_cards_radeon" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + sys-libs/zlib + doc? ( dev-python/sphinx ) + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + ${PYTHON_DEPS}" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi[${MULTILIB_USEDEP}] ) + clang? ( python? ( ${PYTHON_DEPS} ) ) + udis86? ( dev-libs/udis86[pic(+),${MULTILIB_USEDEP}] ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) + !<=sys-devel/clang-3.3-r99 + !>=sys-devel/clang-9999 + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +pkg_setup() { + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + multilib_src_prepare() { + cd "${BUILD_DIR}" || die + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + if use clang; then + # Set correct path for the coverage lib + sed -e "s#lib\(/libprofile_rt.a\)#$(get_libdir)/llvm\1#" \ + -i tools/clang/lib/Driver/Tools.cpp \ + || die "driver tools paths sed failed" + fi + } + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + + + if use gold; then + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/gold/Makefile || die "gold rpath sed failed" + fi + + # FileCheck is needed at least for dragonegg tests + sed -e "/NO_INSTALL = 1/s/^/#/" -i utils/FileCheck/Makefile \ + || die "FileCheck Makefile sed failed" + + if use clang; then + # fix the static analyzer for in-tree install + sed -e 's/import ScanView/from clang \0/' \ + -i tools/clang/tools/scan-view/scan-view \ + || die "scan-view sed failed" + sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \ + -i tools/clang/tools/scan-build/scan-build \ + || die "scan-build sed failed" + # Set correct path for gold plugin + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ + -i tools/clang/lib/Driver/Tools.cpp \ + || die "driver tools paths sed failed" + + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch + + # Fix search paths on FreeBSD, bug #409269 + # This patch causes problem for multilib on fbsd, see comments in the patch + # (aballier@g.o) + # epatch "${FILESDIR}"/clang-3.1-gentoo-freebsd-fix-lib-path.patch + + # Fix regression caused by removal of USE=system-cxx-headers, bug #417541 + # Needs to be updated for 3.2 + #epatch "${FILESDIR}"/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch + fi + + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${P}-R600_debug.patch + + # User patches + epatch_user + + multilib_copy_sources + multilib_foreach_abi multilib_src_prepare +} + +multilib_src_configure() { + local CONF_FLAGS="--enable-keep-symbols + --enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use clang; then + CONF_FLAGS+=" + --with-clang-resource-dir=../lib/clang/${PV}" + fi + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp" + fi + + if [[ ${ABI} == amd64 ]]; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if multilib_is_native_abi && use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if multilib_is_native_abi && use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use video_cards_radeon; then + CONF_FLAGS="${CONF_FLAGS} + --enable-experimental-targets=R600" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + + # build with a suitable Python version + python_export_best + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + econf ${CONF_FLAGS} +} + +multilib_src_compile() { + local mymakeopts=( + VERBOSE=1 + REQUIRES_RTTI=1 + ) + + # Tests need all the LLVM built. + if multilib_is_native_abi || use test; then + emake "${mymakeopts[@]}" + else + # we need to build libs for llvm, then whole clang, + # since libs-only omits clang dir + # and clang fails to sub-compile with libs-only. + emake "${mymakeopts[@]}" libs-only + use clang && emake -C tools/clang "${mymakeopts[@]}" + fi + + if multilib_is_native_abi && use doc; then + emake -C docs -f Makefile.sphinx man + emake -C docs -f Makefile.sphinx html + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + fi + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + fi +} + +multilib_src_test() { + default + + use clang && emake -C tools/clang test +} + +src_install() { + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + use clang && MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local mymakeopts=( + DESTDIR="${D}" + ) + + if multilib_is_native_abi; then + emake "${mymakeopts[@]}" install + + # Move files back. + if path_exists -o "${ED}"/tmp/llvm-config.*; then + mv "${ED}"/tmp/llvm-config.* "${ED}"/usr/bin || die + fi + else + # we need to install libs for llvm, then whole clang + # since libs-only omits clang dir + # and clang install-libs doesn't install headers and stuff + # (we build it anyway, so install is not a problem) + emake "${mymakeopts[@]}" install-libs + use clang && emake -C tools/clang "${mymakeopts[@]}" install + + # Preserve ABI-variant of llvm-config, + # then drop all the executables since LLVM doesn't like to + # clobber when installing. + mkdir -p "${ED}"/tmp || die + mv "${ED}"/usr/bin/llvm-config "${ED}"/tmp/llvm-config.${ABI} || die + rm -r "${ED}"/usr/bin || die + fi + + if multilib_is_native_abi && use doc; then + # Note: use !doc is handled in multilib_src_install_all + doman docs/_build/man/*.1 + dohtml -r docs/_build/html/ + fi + + if multilib_is_native_abi && use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/lib{LTO,clang}.dylib ; do + # omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${f}" + eend $? + done + fi +} + +multilib_src_install_all() { + use doc || doman "${WORKDIR}"/${P}-manpages/*.1 + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi +}