From: Bernard Cafarelli Date: Fri, 13 Jan 2012 22:25:18 +0000 (+0000) Subject: Allow to run test without rebuilding llvm, bug #397559 by mgorny. Add AMD K10 suport... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0ec2a55c66368ad8c496e61b0c82633c9d539619;p=gentoo.git Allow to run test without rebuilding llvm, bug #397559 by mgorny. Add AMD K10 suport in 3.0, patch thanks to Fabio Scaccabarozzi in bug #398357 Package-Manager: portage-2.2.0_alpha84/cvs/Linux x86_64 --- diff --git a/sys-devel/clang/ChangeLog b/sys-devel/clang/ChangeLog index 0dcb5e9cc3a2..00b7f3c5b062 100644 --- a/sys-devel/clang/ChangeLog +++ b/sys-devel/clang/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-devel/clang -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.49 2011/12/02 13:20:51 voyageur Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.50 2012/01/13 22:25:18 voyageur Exp $ + +*clang-3.0-r1 (13 Jan 2012) + + 13 Jan 2012; Bernard Cafarelli +clang-3.0-r1.ebuild, + +files/clang-3.0-recognize-amd-k10-enable-sse4a.patch, clang-9999.ebuild: + Allow to run test without rebuilding llvm, bug #397559 by mgorny. Add AMD K10 + suport in 3.0, patch thanks to Fabio Scaccabarozzi in bug + #398357 *clang-3.0 (02 Dec 2011) diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest index 54e9c7161d7b..741d4a52e786 100644 --- a/sys-devel/clang/Manifest +++ b/sys-devel/clang/Manifest @@ -8,6 +8,7 @@ AUX clang-2.8-gcc-4.4.4.patch 710 RMD160 3d7246d1af95ab0a45035c9caede4844da33ef9 AUX clang-2.9-darwin-prefix.patch 5023 RMD160 eb394810701c92404312eb9366c4f6fb5c9a1e20 SHA1 a0c58d19df0eacb9bf915573973dae5771de8afd SHA256 12b49f753dbc22054906c8a4ab8ccb98b175a636226272bbcd49c298905836c7 AUX clang-2.9-gccversions.patch 661 RMD160 7cdc194ccc202f84a62fea56e8d5de4aded793a5 SHA1 79ff1f652d4ded66c509676a6b35eab0a41db761 SHA256 cdfd4202f50fd4edad694269ee1af64db3452cb14a5926539eb93a4cfb3fad08 AUX clang-3.0-fix_cxx_include_root.patch 1132 RMD160 40f5c11045111212d15ae9e462464360cdf4d1b6 SHA1 8ae4759100e6c7233733a89ae577043ed2d0ee15 SHA256 260f8e36650384304fd0c21f8d742a4b361db4b3a0411c9c74375df95f174898 +AUX clang-3.0-recognize-amd-k10-enable-sse4a.patch 2555 RMD160 de8ebe104708ac4f8c2effae7b0982e92bd31564 SHA1 5065ca8005a8a47649d5bc18eac78db12e5c27db SHA256 46d05e49cefe2f86a562062d7b11e03ecb4ec7a146ee9f674d9a31dda4af9faf DIST clang-2.8.tgz 5666777 RMD160 f00956b6de29cc09f3992aeabd140f2189c6cf39 SHA1 94977c84ce136307dbbeade95e67bfe3c25161ff SHA256 ed83481553e6a39a8a2953e89630d881d87833506f096a90f18d93ec2bdee0c1 DIST clang-2.9.tgz 6243772 RMD160 4ab79cbd0e2ad25a2272e6ee2fbbf546818dbd73 SHA1 5fd3b5cec050ec12858c1602b23cf096282ad4a4 SHA256 70c41f3f782a71cbaa7bc8d6ea29fce4263ad3e8558dfecc6dc11cdef17909df DIST clang-3.0.tar.gz 7240578 RMD160 640b309116db4357627c0b81ebba5dab824d9eeb SHA1 1fa11f07f957bd9c9de003d1b5a7a9ba1e0055e4 SHA256 b64e72da356d7c3428cfd7ac620d49ec042c84eaee13c26024879f555f4e126d @@ -16,14 +17,15 @@ DIST llvm-2.9.tgz 9574781 RMD160 caeaa067fda1eb34196b356a087645f83731cfb7 SHA1 5 DIST llvm-3.0.tar.gz 10350539 RMD160 85211cafbed1c5d838ac54669017b5298613f975 SHA1 b683e7294fcf69887c0d709025d4640f5dca755b SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477 EBUILD clang-2.8-r3.ebuild 6768 RMD160 7b552f45bca12124fe5659a9d3690b60706d14cb SHA1 c3b42800e461cda5852961f912e4ac0609062e0c SHA256 604b2964d566197adda982e6c1e6cdcc3365596ccfabadafe60e316049edabd7 EBUILD clang-2.9-r1.ebuild 6431 RMD160 cb9ed182675f9a76beb2caa0fc1fe26bfc534dd9 SHA1 1a7a912396c7d1823cd1867bb4be9679a31b2c0e SHA256 f9993c92ea46a43debdf55563b70093530e1eabebcee270c01e4d0e3b9490d1a +EBUILD clang-3.0-r1.ebuild 6314 RMD160 38d35dc272a3956dbd9ae0fbd70e4d6f545459f6 SHA1 b49afc2e711b98e77073ed7a866af5b084e14dd0 SHA256 932f31bdf21eb4155cb01f792e5d840ff63359e9cc62f6bd98e60a75037e1a36 EBUILD clang-3.0.ebuild 6126 RMD160 a4ed15f30aa6e88035d8ccccc9b07543c5102f20 SHA1 d52bef71e61f4ff0d7d134951f8dba7ea4dc88a3 SHA256 539491f7e2a6f24bd4d2617c417691f0947db4a3ea25178c319688511b5cc164 -EBUILD clang-9999.ebuild 5859 RMD160 883a9403292c93dc89bf4c1795f5b63ea7b6e235 SHA1 aa3d74416dccf67c0e4fa1d4cba981c63f06a33b SHA256 190c26c8c23e5a2d6230843512fa1438efc7acd04d99418393ebb7b1ee32ba55 -MISC ChangeLog 9262 RMD160 123946418df3b4eaf4f9767c1160d3f2b38098ff SHA1 8dd8da0354d5f77002bc743559fc7df897d1c613 SHA256 e9141af78725f6537ccd50574e52c7380fbd5b68c93fab42c47d48a98efc167f +EBUILD clang-9999.ebuild 6039 RMD160 d66c3e454f6834914844e9e3eb71275a0c40a52f SHA1 cc52f8fc0a408d9ca9599db5ca350564ff3dd182 SHA256 a151bd8d447007ceab57f7073e35b9e35e827d9374cdeeb29f1aa1706845facd +MISC ChangeLog 9614 RMD160 56fbe31771fa1a113546c9676472714cfcb1d117 SHA1 be0f93ac9b7541d35a3755e9eed5bea61958215a SHA256 e6a4a54e5cdffe33f300cab129e7a4d0594c88b4711bca4f9c97bfcdef889428 MISC metadata.xml 1339 RMD160 5f8b76cda96fc95f67fd8ff7f977c116a4f0f28a SHA1 034f922ae098216b179e9d5c78246f9caa95b9d6 SHA256 0ef2f9bcc4f3293dcb69b2c882b93737b9be496e6f8789efa69df6adb2c1edf8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) -iF4EAREIAAYFAk7Y0MoACgkQFYEBGcdFJfJTxgEAi0TMRc7y3uOdc2oEWwCOhQKi -0vQ3GlW/YIVsNgKEJtsBAJb+Bi+p28z6zj3aa6fPxlCRx6IY0nWmUTIFBG7lHZRT -=SWqv +iF4EAREIAAYFAk8Qr1sACgkQFYEBGcdFJfLfjAEAoLPPTLjdxZ4U3tJUN7D0elX2 +BmJRgoD6Y3IvS/pXhJIA/j8ZTxOk9G73KCX7OZ+cUYh8JdmxtMzBKKh8wXT5hR0g +=E8Zp -----END PGP SIGNATURE----- diff --git a/sys-devel/clang/clang-3.0-r1.ebuild b/sys-devel/clang/clang-3.0-r1.ebuild new file mode 100644 index 000000000000..73b1beaa5b56 --- /dev/null +++ b/sys-devel/clang/clang-3.0-r1.ebuild @@ -0,0 +1,190 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.0-r1.ebuild,v 1.1 2012/01/13 22:25:18 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 +SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz + http://llvm.org/releases/${PV}/${P}.tar.gz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="debug multitarget +static-analyzer +system-cxx-headers test" + +DEPEND="static-analyzer? ( dev-lang/perl )" +RDEPEND="~sys-devel/llvm-${PV}[multitarget=]" + +S=${WORKDIR}/llvm-${PV}.src + +src_prepare() { + mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang || die "clang source directory move failed" + + # 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 cxx_include_root path for Gentoo + epatch "${FILESDIR}"/${P/_*}-fix_cxx_include_root.patch + # 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" + # 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 and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + # Use system llc (from llvm ebuild) for tests + sed -e "/^registered_targets =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \ + -i tools/clang/test/lit.cfg || die "test path sed failed" + + # AMD K10 CPUs + SSE4a suppport, bug #398357 + epatch "${FILESDIR}"/${P}-recognize-amd-k10-enable-sse4a.patch +} + +src_configure() { + local CONF_FLAGS="--enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + # 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 multitarget; 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 + + if use system-cxx-headers; then + # Try to get current gcc headers path + local CXX_PATH=$(gcc-config -L| cut -d: -f1) + 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" + + # Broken test always assuming i386 host with multilib gcc 4.6.0 + # http://llvm.org/bugs/show_bug.cgi?id=11094 + rm -f test/Driver/linux-ld.c + + echo ">>> Test phase [test]: ${CATEGORY}/${PF}" + if ! emake -j1 VERBOSE=1 test; then + has test $FEATURES && die "Make test failed. See above for details." + has 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 "@executable_path/../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-9999.ebuild b/sys-devel/clang/clang-9999.ebuild index b5fc4a8aaddd..32c95d035461 100644 --- a/sys-devel/clang/clang-9999.ebuild +++ b/sys-devel/clang/clang-9999.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 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.20 2011/11/14 15:02:31 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-9999.ebuild,v 1.21 2012/01/13 22:25:18 voyageur Exp $ EAPI=3 @@ -61,6 +61,10 @@ src_prepare() { sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ -i Makefile.rules || die "rpath sed failed" + + # Use system llc (from llvm ebuild) for tests + sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \ + -i tools/clang/test/lit.cfg || die "test path sed failed" } src_configure() { diff --git a/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch new file mode 100644 index 000000000000..90f99abc344a --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch @@ -0,0 +1,82 @@ +--- llvm.orig/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/22 14:08:43 226633 ++++ llvm/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/30 22:20:17 226951 +@@ -1282,6 +1282,7 @@ + CK_K8SSE3, + CK_Opteron, + CK_OpteronSSE3, ++ CK_AMDFAM10, + + /// This specification is deprecated and will be removed in the future. + /// Users should prefer \see CK_K8. +@@ -1381,6 +1382,7 @@ + .Case("k8-sse3", CK_K8SSE3) + .Case("opteron", CK_Opteron) + .Case("opteron-sse3", CK_OpteronSSE3) ++ .Case("amdfam10", CK_AMDFAM10) + .Case("x86-64", CK_x86_64) + .Case("geode", CK_Geode) + .Default(CK_Generic); +@@ -1441,6 +1443,7 @@ + case CK_K8SSE3: + case CK_Opteron: + case CK_OpteronSSE3: ++ case CK_AMDFAM10: + case CK_x86_64: + return true; + } +@@ -1459,12 +1462,10 @@ + Features["ssse3"] = false; + Features["sse41"] = false; + Features["sse42"] = false; ++ Features["sse4a"] = false; + Features["aes"] = false; + Features["avx"] = false; + +- // LLVM does not currently recognize this. +- // Features["sse4a"] = false; +- + // FIXME: This *really* should not be here. + + // X86_64 always has SSE2. +@@ -1561,6 +1562,11 @@ + setFeatureEnabled(Features, "sse3", true); + setFeatureEnabled(Features, "3dnowa", true); + break; ++ case CK_AMDFAM10: ++ setFeatureEnabled(Features, "sse3", true); ++ setFeatureEnabled(Features, "sse4a", true); ++ setFeatureEnabled(Features, "3dnowa", true); ++ break; + case CK_C3_2: + setFeatureEnabled(Features, "mmx", true); + setFeatureEnabled(Features, "sse", true); +@@ -1604,6 +1610,8 @@ + else if (Name == "avx") + Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; ++ else if (Name == "sse4a") ++ Features["sse4a"] = true; + } else { + if (Name == "mmx") + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; +@@ -1630,6 +1638,8 @@ + Features["aes"] = false; + else if (Name == "avx") + Features["avx"] = false; ++ else if (Name == "sse4a") ++ Features["sse4a"] = false; + } + + return true; +@@ -1826,6 +1836,11 @@ + Builder.defineMacro("__k8__"); + Builder.defineMacro("__tune_k8__"); + break; ++ case CK_AMDFAM10: ++ Builder.defineMacro("__amdfam10"); ++ Builder.defineMacro("__amdfam10__"); ++ Builder.defineMacro("__tune_amdfam10__"); ++ break; + case CK_Geode: + Builder.defineMacro("__geode"); + Builder.defineMacro("__geode__");