From 40ddd449922c96011466c0f85fe878a6923d3079 Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Sun, 19 Dec 2010 22:45:55 +0000 Subject: Backport to rename alignof, fixes C++'0x compilers support. Also adds gcc 4.4.4 headers support by default, thanks to Bertjan Broeksema in bug #345683 (Portage version: 2.2.0_alpha9/cvs/Linux x86_64) --- sys-devel/clang/ChangeLog | 11 +- sys-devel/clang/clang-2.8-r1.ebuild | 172 ---------------- sys-devel/clang/clang-2.8-r2.ebuild | 196 ------------------ sys-devel/clang/clang-2.8-r3.ebuild | 201 ++++++++++++++++++ sys-devel/clang/files/clang-2.8-alignof.patch | 258 ++++++++++++++++++++++++ sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch | 16 ++ 6 files changed, 485 insertions(+), 369 deletions(-) delete mode 100644 sys-devel/clang/clang-2.8-r1.ebuild delete mode 100644 sys-devel/clang/clang-2.8-r2.ebuild create mode 100644 sys-devel/clang/clang-2.8-r3.ebuild create mode 100644 sys-devel/clang/files/clang-2.8-alignof.patch create mode 100644 sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch (limited to 'sys-devel') diff --git a/sys-devel/clang/ChangeLog b/sys-devel/clang/ChangeLog index df4c96d58c04..062bb62a91ae 100644 --- a/sys-devel/clang/ChangeLog +++ b/sys-devel/clang/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-devel/clang # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.31 2010/10/24 17:42:05 grobian Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.32 2010/12/19 22:45:55 voyageur Exp $ + +*clang-2.8-r3 (19 Dec 2010) + + 19 Dec 2010; Bernard Cafarelli -clang-2.8-r1.ebuild, + -clang-2.8-r2.ebuild, +clang-2.8-r3.ebuild, +files/clang-2.8-alignof.patch, + +files/clang-2.8-gcc-4.4.4.patch: + Backport to rename alignof, fixes C++'0x compilers support. Also adds gcc + 4.4.4 headers support by default, thanks to Bertjan Broeksema + in bug #345683 24 Oct 2010; Fabian Groffen clang-2.8-r2.ebuild, clang-9999.ebuild: diff --git a/sys-devel/clang/clang-2.8-r1.ebuild b/sys-devel/clang/clang-2.8-r1.ebuild deleted file mode 100644 index 4515ae9359ac..000000000000 --- a/sys-devel/clang/clang-2.8-r1.ebuild +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.8-r1.ebuild,v 1.1 2010/10/12 09:24:54 voyageur Exp $ - -EAPI=3 - -RESTRICT_PYTHON_ABIS="3.*" -SUPPORT_PYTHON_ABIS="1" - -inherit eutils multilib python - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="http://clang.llvm.org/" -# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840 -# Drop the -> on 2.9 -SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz - http://llvm.org/releases/${PV}/${P}.tgz" - -LICENSE="UoI-NCSA" -SLOT="0" -KEYWORDS="~amd64 ~x86 ~amd64-linux ~ppc-macos" -IUSE="alltargets debug +static-analyzer system-cxx-headers test" - -# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html -DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[alltargets=]" - -S="${WORKDIR}/llvm-${PV}" - -src_prepare() { - mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found" - - # Same as llvm doc patches - epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch - - # multilib-strict - sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \ - -i tools/clang/lib/Headers/Makefile \ - || die "clang Makefile failed" - # 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#/usr/share/${PN}#" \ - -i tools/clang/tools/scan-build/scan-build \ - || die "scan-build sed failed" - # Specify python version - python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view - - # From llvm src_prepare - 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)/llvm, \ - -i Makefile.config.in || die "Makefile.config sed failed" - - einfo "Fixing rpath" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ - -i Makefile.rules || die "rpath sed failed" -} - -src_configure() { - local CONF_FLAGS="--enable-shared" - - if use debug; then - CONF_FLAGS="${CONF_FLAGS} --disable-optimized" - einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries" - # ...and you probably shouldn't use tmpfs, unless it can hold 900MB - else - CONF_FLAGS="${CONF_FLAGS} \ - --enable-optimized \ - --disable-assertions \ - --disable-expensive-checks" - fi - - # Setup the search path to include the Prefix includes - if use prefix ; then - CONF_FLAGS="${CONF_FLAGS} \ - --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include" - fi - - if use alltargets; then - CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" - else - CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" - fi - - if use amd64; then - CONF_FLAGS="${CONF_FLAGS} --enable-pic" - fi - - # Skip llvm-gcc parts even if installed - CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null" - - if use system-cxx-headers; then - # Try to get current C++ headers path - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1 | sed '/-v4$/! s,$,/include/g++-v4,')" - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST" - if has_multilib_profile; then - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32" - fi - fi - - econf ${CONF_FLAGS} || die "econf failed" -} - -src_compile() { - emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed" -} - -src_test() { - cd "${S}"/test || die "cd failed" - emake site.exp || die "updating llvm site.exp failed" - - cd "${S}"/tools/clang || die "cd clang failed" - - echo ">>> Test phase [test]: ${CATEGORY}/${PF}" - if ! emake -j1 VERBOSE=1 test; then - hasq test $FEATURES && die "Make test failed. See above for details." - hasq test $FEATURES || eerror "Make test failed. See above for details." - fi -} - -src_install() { - cd "${S}"/tools/clang || die "cd clang failed" - emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" - - 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 - - cd tools/scan-view || die "cd scan-view failed" - dobin scan-view - install-scan-view() { - insinto "$(python_get_sitedir)"/clang - doins Reporter.py Resources ScanView.py startfile.py - touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py - } - python_execute_function install-scan-view - fi - - # Fix install_names on Darwin. The build system is too complicated - # to just fix this, so we correct it post-install - if [[ ${CHOST} == *-darwin* ]] ; then - for lib in libCIndex.dylib ; do - install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ - "${ED}"/usr/lib/llvm/${lib} - done - fi -} - -pkg_postinst() { - python_mod_optimize clang - if use system-cxx-headers; then - elog "C++ headers search path is hardcoded to the active gcc profile one" - elog "If you change the active gcc profile, or update gcc to a new version," - elog "you will have to remerge this package to update the search path" - else - elog "If clang++ fails to find C++ headers on your system," - elog "you can remerge clang with USE=system-cxx-headers to use C++ headers" - elog "from the active gcc profile" - fi -} - -pkg_postrm() { - python_mod_cleanup clang -} diff --git a/sys-devel/clang/clang-2.8-r2.ebuild b/sys-devel/clang/clang-2.8-r2.ebuild deleted file mode 100644 index f21b7dbe3656..000000000000 --- a/sys-devel/clang/clang-2.8-r2.ebuild +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.8-r2.ebuild,v 1.3 2010/10/24 17:42:05 grobian Exp $ - -EAPI=3 - -RESTRICT_PYTHON_ABIS="3.*" -SUPPORT_PYTHON_ABIS="1" - -inherit eutils multilib python - -DESCRIPTION="C language family frontend for LLVM" -HOMEPAGE="http://clang.llvm.org/" -# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840 -# Drop the -> on 2.9 -SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz - http://llvm.org/releases/${PV}/${P}.tgz" - -LICENSE="UoI-NCSA" -SLOT="0" -KEYWORDS="~amd64 ~x86 ~amd64-linux ~ppc-macos" -IUSE="alltargets debug +static-analyzer system-cxx-headers test" - -# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html -DEPEND="static-analyzer? ( dev-lang/perl )" -RDEPEND="~sys-devel/llvm-${PV}[alltargets=]" - -S="${WORKDIR}/llvm-${PV}" - -src_prepare() { - mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found" - - # Same as llvm doc patches - epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch - - # Fix toolchain lookup for Darwin/Prefix. - epatch "${FILESDIR}"/${PN}-2.8-darwin-prefix.patch - sed -e "s|@GENTOO_PORTAGE_CHOST_ARCH@|${CHOST%%-darwin*}-darwin|g" \ - -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST}|g" \ - -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \ - -i tools/clang/lib/Driver/ToolChains.cpp \ - || die "fixing toolchain lookup" - - # multilib-strict - sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \ - -i tools/clang/lib/Headers/Makefile \ - || die "clang Makefile failed" - # 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#/usr/share/${PN}#" \ - -i tools/clang/tools/scan-build/scan-build \ - || die "scan-build sed failed" - # Specify python version - python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view - - # From llvm src_prepare - 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)/llvm, \ - -i Makefile.config.in || die "Makefile.config sed failed" - - einfo "Fixing rpath" - sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ - -i Makefile.rules || die "rpath sed failed" -} - -src_configure() { - local CONF_FLAGS="--enable-shared" - - if use debug; then - CONF_FLAGS="${CONF_FLAGS} --disable-optimized" - einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries" - # ...and you probably shouldn't use tmpfs, unless it can hold 900MB - else - CONF_FLAGS="${CONF_FLAGS} \ - --enable-optimized \ - --disable-assertions \ - --disable-expensive-checks" - fi - - # Setup the search path to include the Prefix includes - if use prefix ; then - CONF_FLAGS="${CONF_FLAGS} \ - --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include" - fi - - if use alltargets; then - CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" - else - CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" - fi - - if use amd64; then - CONF_FLAGS="${CONF_FLAGS} --enable-pic" - fi - - # Skip llvm-gcc parts even if installed - CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null" - - if use system-cxx-headers; then - # Try to get current gcc headers path - local CXX_PATH=$(gcc-config -X| cut -d: -f1 | sed 's,/include/g++-v4$,,') - CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include" - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4" - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST" - if has_multilib_profile; then - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32" - fi - fi - - econf ${CONF_FLAGS} || die "econf failed" -} - -src_compile() { - emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed" -} - -src_test() { - cd "${S}"/test || die "cd failed" - emake site.exp || die "updating llvm site.exp failed" - - cd "${S}"/tools/clang || die "cd clang failed" - - echo ">>> Test phase [test]: ${CATEGORY}/${PF}" - if ! emake -j1 VERBOSE=1 test; then - hasq test $FEATURES && die "Make test failed. See above for details." - hasq test $FEATURES || eerror "Make test failed. See above for details." - fi -} - -src_install() { - cd "${S}"/tools/clang || die "cd clang failed" - emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" - - 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 - - cd tools/scan-view || die "cd scan-view failed" - dobin scan-view - install-scan-view() { - insinto "$(python_get_sitedir)"/clang - doins Reporter.py Resources ScanView.py startfile.py - touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py - } - python_execute_function install-scan-view - fi - - # Fix install_names on Darwin. The build system is too complicated - # to just fix this, so we correct it post-install - if [[ ${CHOST} == *-darwin* ]] ; then - for lib in libclang.dylib ; do - ebegin "fixing install_name of $lib" - install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ - "${ED}"/usr/lib/llvm/${lib} - eend $? - done - for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do - ebegin "fixing references in ${f##*/}" - install_name_tool \ - -change "@rpath/libclang.dylib" \ - "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ - -change "${S}"/Release/lib/libLLVM-${PV}.dylib \ - "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \ - -change "${S}"/Release/lib/libclang.dylib \ - "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ - "${ED}"/$f - eend $? - done - fi -} - -pkg_postinst() { - python_mod_optimize clang - if use system-cxx-headers; then - elog "C++ headers search path is hardcoded to the active gcc profile one" - elog "If you change the active gcc profile, or update gcc to a new version," - elog "you will have to remerge this package to update the search path" - else - elog "If clang++ fails to find C++ headers on your system," - elog "you can remerge clang with USE=system-cxx-headers to use C++ headers" - elog "from the active gcc profile" - fi -} - -pkg_postrm() { - python_mod_cleanup clang -} diff --git a/sys-devel/clang/clang-2.8-r3.ebuild b/sys-devel/clang/clang-2.8-r3.ebuild new file mode 100644 index 000000000000..078e64b38fdf --- /dev/null +++ b/sys-devel/clang/clang-2.8-r3.ebuild @@ -0,0 +1,201 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.8-r3.ebuild,v 1.1 2010/12/19 22:45:55 voyageur Exp $ + +EAPI=3 + +RESTRICT_PYTHON_ABIS="3.*" +SUPPORT_PYTHON_ABIS="1" + +inherit eutils multilib python + +DESCRIPTION="C language family frontend for LLVM" +HOMEPAGE="http://clang.llvm.org/" +# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840 +# Drop the -> on 2.9 +SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz + http://llvm.org/releases/${PV}/${P}.tgz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~ppc-macos" +IUSE="alltargets debug +static-analyzer system-cxx-headers test" + +# Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html +DEPEND="static-analyzer? ( dev-lang/perl )" +RDEPEND="~sys-devel/llvm-${PV}[alltargets=]" + +S="${WORKDIR}/llvm-${PV}" + +src_prepare() { + mv "${WORKDIR}"/clang-${PV} "${S}"/tools/clang || die "clang source directory not found" + + # Same as llvm doc patches + epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch + + # Upstream backport, r117774 and r117775 + epatch "${FILESDIR}"/${P}-alignof.patch + # Upstream backport, r119348 + epatch "${FILESDIR}"/${P}-gcc-4.4.4.patch + + # Fix toolchain lookup for Darwin/Prefix. + epatch "${FILESDIR}"/${PN}-2.8-darwin-prefix.patch + sed -e "s|@GENTOO_PORTAGE_CHOST_ARCH@|${CHOST%%-darwin*}-darwin|g" \ + -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST}|g" \ + -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \ + -i tools/clang/lib/Driver/ToolChains.cpp \ + || die "fixing toolchain lookup" + + # multilib-strict + sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \ + -i tools/clang/lib/Headers/Makefile \ + || die "clang Makefile failed" + # 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#/usr/share/${PN}#" \ + -i tools/clang/tools/scan-build/scan-build \ + || die "scan-build sed failed" + # Specify python version + python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view + + # From llvm src_prepare + 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)/llvm, \ + -i Makefile.config.in || die "Makefile.config sed failed" + + einfo "Fixing rpath" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + -i Makefile.rules || die "rpath sed failed" +} + +src_configure() { + local CONF_FLAGS="--enable-shared" + + if use debug; then + CONF_FLAGS="${CONF_FLAGS} --disable-optimized" + einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries" + # ...and you probably shouldn't use tmpfs, unless it can hold 900MB + else + CONF_FLAGS="${CONF_FLAGS} \ + --enable-optimized \ + --disable-assertions \ + --disable-expensive-checks" + fi + + # Setup the search path to include the Prefix includes + if use prefix ; then + CONF_FLAGS="${CONF_FLAGS} \ + --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include" + fi + + if use alltargets; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + # Skip llvm-gcc parts even if installed + CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null" + + if use system-cxx-headers; then + # Try to get current gcc headers path + local CXX_PATH=$(gcc-config -X| cut -d: -f1 | sed 's,/include/g++-v4$,,') + CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include" + CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4" + CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST" + if has_multilib_profile; then + CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32" + fi + fi + + econf ${CONF_FLAGS} || die "econf failed" +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed" +} + +src_test() { + cd "${S}"/test || die "cd failed" + emake site.exp || die "updating llvm site.exp failed" + + cd "${S}"/tools/clang || die "cd clang failed" + + echo ">>> Test phase [test]: ${CATEGORY}/${PF}" + if ! emake -j1 VERBOSE=1 test; then + hasq test $FEATURES && die "Make test failed. See above for details." + hasq test $FEATURES || eerror "Make test failed. See above for details." + fi +} + +src_install() { + cd "${S}"/tools/clang || die "cd clang failed" + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" + + 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 + + cd tools/scan-view || die "cd scan-view failed" + dobin scan-view + install-scan-view() { + insinto "$(python_get_sitedir)"/clang + doins Reporter.py Resources ScanView.py startfile.py + touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + } + python_execute_function install-scan-view + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in libclang.dylib ; do + ebegin "fixing install_name of $lib" + install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ + "${ED}"/usr/lib/llvm/${lib} + eend $? + done + for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do + ebegin "fixing references in ${f##*/}" + install_name_tool \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + -change "${S}"/Release/lib/libLLVM-${PV}.dylib \ + "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${ED}"/$f + eend $? + done + fi +} + +pkg_postinst() { + python_mod_optimize clang + if use system-cxx-headers; then + elog "C++ headers search path is hardcoded to the active gcc profile one" + elog "If you change the active gcc profile, or update gcc to a new version," + elog "you will have to remerge this package to update the search path" + else + elog "If clang++ fails to find C++ headers on your system," + elog "you can remerge clang with USE=system-cxx-headers to use C++ headers" + elog "from the active gcc profile" + fi +} + +pkg_postrm() { + python_mod_cleanup clang +} diff --git a/sys-devel/clang/files/clang-2.8-alignof.patch b/sys-devel/clang/files/clang-2.8-alignof.patch new file mode 100644 index 000000000000..a15f118caee6 --- /dev/null +++ b/sys-devel/clang/files/clang-2.8-alignof.patch @@ -0,0 +1,258 @@ +Index: include/llvm/ADT/StringMap.h +=================================================================== +--- include/llvm/ADT/StringMap.h (révision 117773) ++++ include/llvm/ADT/StringMap.h (révision 117774) +@@ -167,7 +167,7 @@ + + unsigned AllocSize = static_cast(sizeof(StringMapEntry))+ + KeyLength+1; +- unsigned Alignment = alignof(); ++ unsigned Alignment = alignOf(); + + StringMapEntry *NewItem = + static_cast(Allocator.Allocate(AllocSize,Alignment)); +Index: include/llvm/Support/AlignOf.h +=================================================================== +--- include/llvm/Support/AlignOf.h (révision 117773) ++++ include/llvm/Support/AlignOf.h (révision 117774) +@@ -49,12 +49,12 @@ + + }; + +-/// alignof - A templated function that returns the mininum alignment of ++/// alignOf - A templated function that returns the mininum alignment of + /// of a type. This provides no extra functionality beyond the AlignOf + /// class besides some cosmetic cleanliness. Example usage: +-/// alignof() returns the alignment of an int. ++/// alignOf() returns the alignment of an int. + template +-static inline unsigned alignof() { return AlignOf::Alignment; } ++static inline unsigned alignOf() { return AlignOf::Alignment; } + + } // end namespace llvm + #endif +Index: include/llvm/Support/Allocator.h +=================================================================== +--- include/llvm/Support/Allocator.h (révision 117773) ++++ include/llvm/Support/Allocator.h (révision 117774) +@@ -201,7 +201,7 @@ + char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr : + (char *)Slab + Slab->Size; + for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) { +- Ptr = Allocator.AlignPtr(Ptr, alignof()); ++ Ptr = Allocator.AlignPtr(Ptr, alignOf()); + if (Ptr + sizeof(T) <= End) + reinterpret_cast(Ptr)->~T(); + } +Index: include/llvm/CodeGen/SlotIndexes.h +=================================================================== +--- include/llvm/CodeGen/SlotIndexes.h (révision 117773) ++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774) +@@ -393,7 +393,7 @@ + IndexListEntry *entry = + static_cast( + ileAllocator.Allocate(sizeof(IndexListEntry), +- alignof())); ++ alignOf())); + + new (entry) IndexListEntry(mi, index); + +Index: tools/clang/lib/Basic/IdentifierTable.cpp +=================================================================== +--- tools/clang/lib/Basic/IdentifierTable.cpp (révision 117774) ++++ tools/clang/lib/Basic/IdentifierTable.cpp (révision 117775) +@@ -390,7 +390,7 @@ + unsigned Size = sizeof(MultiKeywordSelector) + nKeys*sizeof(IdentifierInfo *); + MultiKeywordSelector *SI = + (MultiKeywordSelector*)SelTabImpl.Allocator.Allocate(Size, +- llvm::alignof()); ++ llvm::alignOf()); + new (SI) MultiKeywordSelector(nKeys, IIV); + SelTabImpl.Table.InsertNode(SI, InsertPos); + return Selector(SI); +Index: tools/clang/lib/AST/ExprCXX.cpp +=================================================================== +--- tools/clang/lib/AST/ExprCXX.cpp (révision 117774) ++++ tools/clang/lib/AST/ExprCXX.cpp (révision 117775) +@@ -233,7 +233,7 @@ + if (NumTemplateArgs != 0) + size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof()); ++ void *Mem = C.Allocate(size, llvm::alignOf()); + UnresolvedLookupExpr *E = new (Mem) UnresolvedLookupExpr(EmptyShell()); + E->HasExplicitTemplateArgs = NumTemplateArgs != 0; + return E; +@@ -261,7 +261,7 @@ + if (NumResults) { + Results = static_cast( + C.Allocate(sizeof(DeclAccessPair) * NumResults, +- llvm::alignof())); ++ llvm::alignOf())); + memcpy(Results, &*Begin.getIterator(), + NumResults * sizeof(DeclAccessPair)); + } +@@ -737,7 +737,7 @@ + if (TemplateArgs) + size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof()); ++ void *Mem = C.Allocate(size, llvm::alignOf()); + return new (Mem) CXXDependentScopeMemberExpr(C, Base, BaseType, + IsArrow, OperatorLoc, + Qualifier, QualifierRange, +@@ -756,7 +756,7 @@ + + std::size_t size = sizeof(CXXDependentScopeMemberExpr) + + ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); +- void *Mem = C.Allocate(size, llvm::alignof()); ++ void *Mem = C.Allocate(size, llvm::alignOf()); + CXXDependentScopeMemberExpr *E + = new (Mem) CXXDependentScopeMemberExpr(C, 0, QualType(), + 0, SourceLocation(), 0, +@@ -812,7 +812,7 @@ + if (TemplateArgs) + size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof()); ++ void *Mem = C.Allocate(size, llvm::alignOf()); + return new (Mem) UnresolvedMemberExpr(C, + Dependent ? C.DependentTy : C.OverloadTy, + Dependent, HasUnresolvedUsing, Base, BaseType, +@@ -826,7 +826,7 @@ + if (NumTemplateArgs != 0) + size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof()); ++ void *Mem = C.Allocate(size, llvm::alignOf()); + UnresolvedMemberExpr *E = new (Mem) UnresolvedMemberExpr(EmptyShell()); + E->HasExplicitTemplateArgs = NumTemplateArgs != 0; + return E; +Index: tools/clang/lib/AST/DeclObjC.cpp +=================================================================== +--- tools/clang/lib/AST/DeclObjC.cpp (révision 117774) ++++ tools/clang/lib/AST/DeclObjC.cpp (révision 117775) +@@ -711,7 +711,7 @@ + void ObjCClassDecl::setClassList(ASTContext &C, ObjCInterfaceDecl*const*List, + const SourceLocation *Locs, unsigned Num) { + ForwardDecls = (ObjCClassRef*) C.Allocate(sizeof(ObjCClassRef)*Num, +- llvm::alignof()); ++ llvm::alignOf()); + for (unsigned i = 0; i < Num; ++i) + new (&ForwardDecls[i]) ObjCClassRef(List[i], Locs[i]); + +Index: tools/clang/lib/AST/Stmt.cpp +=================================================================== +--- tools/clang/lib/AST/Stmt.cpp (révision 117774) ++++ tools/clang/lib/AST/Stmt.cpp (révision 117775) +@@ -416,7 +416,7 @@ + Stmt *atFinallyStmt) { + unsigned Size = sizeof(ObjCAtTryStmt) + + (1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *); +- void *Mem = Context.Allocate(Size, llvm::alignof()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf()); + return new (Mem) ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts, + atFinallyStmt); + } +@@ -426,7 +426,7 @@ + bool HasFinally) { + unsigned Size = sizeof(ObjCAtTryStmt) + + (1 + NumCatchStmts + HasFinally) * sizeof(Stmt *); +- void *Mem = Context.Allocate(Size, llvm::alignof()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf()); + return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally); + } + +@@ -448,7 +448,7 @@ + std::size_t Size = sizeof(CXXTryStmt); + Size += ((numHandlers + 1) * sizeof(Stmt)); + +- void *Mem = C.Allocate(Size, llvm::alignof()); ++ void *Mem = C.Allocate(Size, llvm::alignOf()); + return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers, numHandlers); + } + +@@ -457,7 +457,7 @@ + std::size_t Size = sizeof(CXXTryStmt); + Size += ((numHandlers + 1) * sizeof(Stmt)); + +- void *Mem = C.Allocate(Size, llvm::alignof()); ++ void *Mem = C.Allocate(Size, llvm::alignOf()); + return new (Mem) CXXTryStmt(Empty, numHandlers); + } + +Index: tools/clang/lib/AST/Expr.cpp +=================================================================== +--- tools/clang/lib/AST/Expr.cpp (révision 117774) ++++ tools/clang/lib/AST/Expr.cpp (révision 117775) +@@ -257,7 +257,7 @@ + if (TemplateArgs) + Size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = Context.Allocate(Size, llvm::alignof()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf()); + return new (Mem) DeclRefExpr(Qualifier, QualifierRange, D, NameInfo, + TemplateArgs, T); + } +@@ -271,7 +271,7 @@ + if (NumTemplateArgs) + Size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = Context.Allocate(Size, llvm::alignof()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf()); + return new (Mem) DeclRefExpr(EmptyShell()); + } + +@@ -432,7 +432,7 @@ + // any concatenated string tokens. + void *Mem = C.Allocate(sizeof(StringLiteral)+ + sizeof(SourceLocation)*(NumStrs-1), +- llvm::alignof()); ++ llvm::alignOf()); + StringLiteral *SL = new (Mem) StringLiteral(Ty); + + // OPTIMIZE: could allocate this appended to the StringLiteral. +@@ -452,7 +452,7 @@ + StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) { + void *Mem = C.Allocate(sizeof(StringLiteral)+ + sizeof(SourceLocation)*(NumStrs-1), +- llvm::alignof()); ++ llvm::alignOf()); + StringLiteral *SL = new (Mem) StringLiteral(QualType()); + SL->StrData = 0; + SL->ByteLength = 0; +@@ -714,7 +714,7 @@ + if (targs) + Size += ExplicitTemplateArgumentList::sizeFor(*targs); + +- void *Mem = C.Allocate(Size, llvm::alignof()); ++ void *Mem = C.Allocate(Size, llvm::alignOf()); + MemberExpr *E = new (Mem) MemberExpr(base, isarrow, memberdecl, nameinfo, ty); + + if (hasQualOrFound) { +Index: tools/clang/lib/AST/DeclCXX.cpp +=================================================================== +--- tools/clang/lib/AST/DeclCXX.cpp (révision 117774) ++++ tools/clang/lib/AST/DeclCXX.cpp (révision 117775) +@@ -1057,7 +1057,7 @@ + unsigned NumIndices) { + void *Mem = Context.Allocate(sizeof(CXXBaseOrMemberInitializer) + + sizeof(VarDecl *) * NumIndices, +- llvm::alignof()); ++ llvm::alignOf()); + return new (Mem) CXXBaseOrMemberInitializer(Context, Member, MemberLoc, + L, Init, R, Indices, NumIndices); + } +Index: tools/clang/lib/Lex/TokenLexer.cpp +=================================================================== +--- tools/clang/lib/Lex/TokenLexer.cpp (révision 117774) ++++ tools/clang/lib/Lex/TokenLexer.cpp (révision 117775) +@@ -287,7 +287,7 @@ + llvm::BumpPtrAllocator &Alloc = PP.getPreprocessorAllocator(); + Token *Res = + static_cast(Alloc.Allocate(sizeof(Token)*ResultToks.size(), +- llvm::alignof())); ++ llvm::alignOf())); + if (NumTokens) + memcpy(Res, &ResultToks[0], NumTokens*sizeof(Token)); + Tokens = Res; diff --git a/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch new file mode 100644 index 000000000000..f60d051e9d49 --- /dev/null +++ b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch @@ -0,0 +1,16 @@ +Index: tools/clang/lib/Frontend/InitHeaderSearch.cpp +=================================================================== +--- tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119347) ++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119348) +@@ -745,6 +745,11 @@ + "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4", + "x86_64-pc-linux-gnu", "32", "", triple); + ++ // Gentoo amd64 gcc 4.4.4 ++ AddGnuCPlusPlusIncludePaths( ++ "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4", ++ "x86_64-pc-linux-gnu", "32", "", triple); ++ + // Gentoo amd64 llvm-gcc trunk + AddGnuCPlusPlusIncludePaths( + "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", -- cgit v1.2.3-65-gdbad