From 47b0fe524081658791dbcc4b9a005401fd7d7347 Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Tue, 27 Jul 2010 13:06:47 +0000 Subject: Add a USE-flag for system CXX headers, fix for x86. llvm-gcc users should leave the flag off (Portage version: 2.2_rc67/cvs/Linux x86_64) --- sys-devel/clang/ChangeLog | 9 ++- sys-devel/clang/clang-2.7-r1.ebuild | 142 --------------------------------- sys-devel/clang/clang-2.7-r2.ebuild | 151 ++++++++++++++++++++++++++++++++++++ sys-devel/clang/clang-9999.ebuild | 27 ++++--- sys-devel/clang/metadata.xml | 1 + 5 files changed, 178 insertions(+), 152 deletions(-) delete mode 100644 sys-devel/clang/clang-2.7-r1.ebuild create mode 100644 sys-devel/clang/clang-2.7-r2.ebuild (limited to 'sys-devel/clang') diff --git a/sys-devel/clang/ChangeLog b/sys-devel/clang/ChangeLog index dd8d96dc8e36..ed74ff43e0a9 100644 --- a/sys-devel/clang/ChangeLog +++ b/sys-devel/clang/ChangeLog @@ -1,6 +1,13 @@ # 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.17 2010/07/20 09:35:43 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.18 2010/07/27 13:06:47 voyageur Exp $ + +*clang-2.7-r2 (27 Jul 2010) + + 27 Jul 2010; Bernard Cafarelli -clang-2.7-r1.ebuild, + +clang-2.7-r2.ebuild, clang-9999.ebuild, metadata.xml: + Add a USE-flag for system CXX headers, fix for x86. llvm-gcc users should + leave the flag off *clang-2.7-r1 (20 Jul 2010) diff --git a/sys-devel/clang/clang-2.7-r1.ebuild b/sys-devel/clang/clang-2.7-r1.ebuild deleted file mode 100644 index 0a5242811297..000000000000 --- a/sys-devel/clang/clang-2.7-r1.ebuild +++ /dev/null @@ -1,142 +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.7-r1.ebuild,v 1.1 2010/07/20 09:35:43 voyageur Exp $ - -EAPI=2 - -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 -SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz - http://llvm.org/releases/${PV}/${P}.tgz" - -LICENSE="UoI-NCSA" -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="debug +static-analyzer 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 ) - test? ( dev-util/dejagnu )" -RDEPEND="~sys-devel/llvm-${PV}" - -S="${WORKDIR}/llvm-2.7" - -src_prepare() { - mv "${WORKDIR}"/clang-2.7 "${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 := /etc/llvm,' \ - -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir), \ - -i Makefile.config.in || die "Makefile.config sed failed" - - einfo "Fixing rpath" - sed -e 's/\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))//g' -i Makefile.rules \ - || die "rpath sed failed" -} - -src_configure() { - local CONF_FLAGS="" - - 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 - - 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" - - # Try to get current C++ headers path - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1)/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 - 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 "${D}"/"$(python_get_sitedir)"/clang/__init__.py - } - python_execute_function install-scan-view - fi -} - -pkg_postinst() { - python_mod_optimize clang - 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" -} - -pkg_postrm() { - python_mod_cleanup clang -} diff --git a/sys-devel/clang/clang-2.7-r2.ebuild b/sys-devel/clang/clang-2.7-r2.ebuild new file mode 100644 index 000000000000..421d384538a0 --- /dev/null +++ b/sys-devel/clang/clang-2.7-r2.ebuild @@ -0,0 +1,151 @@ +# 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.7-r2.ebuild,v 1.1 2010/07/27 13:06:47 voyageur Exp $ + +EAPI=2 + +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 +SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz + http://llvm.org/releases/${PV}/${P}.tgz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="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 ) + test? ( dev-util/dejagnu )" +RDEPEND="~sys-devel/llvm-${PV}" + +S="${WORKDIR}/llvm-2.7" + +src_prepare() { + mv "${WORKDIR}"/clang-2.7 "${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 := /etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir), \ + -i Makefile.config.in || die "Makefile.config sed failed" + + einfo "Fixing rpath" + sed -e 's/\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))//g' -i Makefile.rules \ + || die "rpath sed failed" +} + +src_configure() { + local CONF_FLAGS="" + + 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 + + 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 "${D}"/"$(python_get_sitedir)"/clang/__init__.py + } + python_execute_function install-scan-view + 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-9999.ebuild b/sys-devel/clang/clang-9999.ebuild index dc5b6ef988a2..bb2d4b53da0b 100644 --- a/sys-devel/clang/clang-9999.ebuild +++ b/sys-devel/clang/clang-9999.ebuild @@ -1,6 +1,6 @@ # 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-9999.ebuild,v 1.3 2010/07/20 09:35:43 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-9999.ebuild,v 1.4 2010/07/27 13:06:47 voyageur Exp $ EAPI=2 @@ -83,12 +83,15 @@ src_configure() { # Skip llvm-gcc parts even if installed CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null" - # Try to get current C++ headers path - CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1)/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" + 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" } @@ -135,9 +138,15 @@ src_install() { pkg_postinst() { python_mod_optimize clang - 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" + 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() { diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml index 4527f3eb8502..d6429cc3d137 100644 --- a/sys-devel/clang/metadata.xml +++ b/sys-devel/clang/metadata.xml @@ -30,5 +30,6 @@ A single unified parser for C, Objective C, C++, and Objective C++ Conformance with C/C++/ObjC and their variants Install the Clang static analyzer + By default, clang++ searchs for C++ headers in a series of hardcoded paths. Enabling this flag will force it to use the active gcc profile ones -- cgit v1.2.3-65-gdbad