summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2012-05-24 13:00:09 +0000
committerRichard Yao <ryao@gentoo.org>2012-05-24 13:00:09 +0000
commitd50bf3ff712cce075fc497cdf693b7095b6b68f4 (patch)
tree904282f625375f90c92e743810195a3d9c2ad2c5 /sys-devel
parentStable for x86, wrt bug #410859 (diff)
downloadgentoo-2-d50bf3ff712cce075fc497cdf693b7095b6b68f4.tar.gz
gentoo-2-d50bf3ff712cce075fc497cdf693b7095b6b68f4.tar.bz2
gentoo-2-d50bf3ff712cce075fc497cdf693b7095b6b68f4.zip
Add runtime detection of active GCC on Linux (bug \#406163) and FreeBSD (bug \#409269).
Remove unnecessary headers on FreeBSD, bug \#417171. Run time detection enables Clang to build C++ code without USE=system-cxx-headers, so no longer set it by default (Portage version: 2.1.10.49/cvs/Linux x86_64)
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/clang/ChangeLog12
-rw-r--r--sys-devel/clang/clang-3.0-r4.ebuild (renamed from sys-devel/clang/clang-3.0-r3.ebuild)13
-rw-r--r--sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch20
-rw-r--r--sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch43
4 files changed, 85 insertions, 3 deletions
diff --git a/sys-devel/clang/ChangeLog b/sys-devel/clang/ChangeLog
index 79d50ed1ec15..e16ff795cea4 100644
--- a/sys-devel/clang/ChangeLog
+++ b/sys-devel/clang/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for sys-devel/clang
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.61 2012/05/23 20:46:57 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/ChangeLog,v 1.62 2012/05/24 13:00:09 ryao Exp $
+
+*clang-3.0-r4 (24 May 2012)
+
+ 24 May 2012; Richard Yao <ryao@gentoo.org> +clang-3.0-r4.ebuild,
+ +files/clang-3.0-freebsd-runtime-gcc-detection.patch,
+ +files/clang-3.0-linux-runtime-gcc-detection.patch, -clang-3.0-r3.ebuild:
+ Add runtime detection of active GCC on Linux (bug \#406163) and FreeBSD (bug
+ \#409269). Remove unnecessary headers on FreeBSD, bug \#417171. Run time
+ detection enables Clang to build C++ code without USE=system-cxx-headers, so
+ no longer set it by default
*clang-3.1 (23 May 2012)
diff --git a/sys-devel/clang/clang-3.0-r3.ebuild b/sys-devel/clang/clang-3.0-r4.ebuild
index 91faa4ccf131..97a0ddaf0f21 100644
--- a/sys-devel/clang/clang-3.0-r3.ebuild
+++ b/sys-devel/clang/clang-3.0-r4.ebuild
@@ -1,6 +1,6 @@
# 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-r3.ebuild,v 1.5 2012/04/13 14:14:39 voyageur Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.0-r4.ebuild,v 1.1 2012/05/24 13:00:09 ryao Exp $
EAPI=3
@@ -18,7 +18,7 @@ SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.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"
+IUSE="debug kernel_FreeBSD multitarget +static-analyzer system-cxx-headers test"
DEPEND="static-analyzer? ( dev-lang/perl )"
RDEPEND="~sys-devel/llvm-${PV}[multitarget=]"
@@ -73,6 +73,12 @@ src_prepare() {
# AMD K10 CPUs + SSE4a suppport, bug #398357
epatch "${FILESDIR}"/${P}-recognize-amd-k10-enable-sse4a.patch
+ # Automatically select active system GCC's libraries, bug #406163
+ epatch "${FILESDIR}"/${P}-linux-runtime-gcc-detection.patch
+
+ # Fix search paths on FreeBSD, bug #409269
+ epatch "${FILESDIR}"/${P}-freebsd-runtime-gcc-detection.patch
+
# User patches
epatch_user
}
@@ -184,6 +190,9 @@ src_install() {
eend $?
done
fi
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ use kernel_FreeBSD && rm "${ED}/usr/lib/clang/3.1/include/"{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
}
pkg_postinst() {
diff --git a/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch
new file mode 100644
index 000000000000..5c016f551c11
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch
@@ -0,0 +1,20 @@
+diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:45:01.333127000 -0400
++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 16:16:26.023642076 -0400
+@@ -1215,6 +1215,16 @@ FreeBSD::FreeBSD(const HostInfo &Host, c
+ } else {
+ getFilePaths().push_back("/usr/lib");
+ }
++
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + getDriver().DefaultHostTriple, File))
++ {
++ bool Exists;
++ StringRef Version = File.get()->getBuffer().rsplit('-').second.substr(0,5);
++ const std::string GentooPath = "/usr/lib/gcc/" + getDriver().DefaultHostTriple + "/" + Version.str();
++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
++ getFilePaths().push_back(GentooPath);
++ }
+ }
+
+ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
diff --git a/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch
new file mode 100644
index 000000000000..a1f7ce2a98fb
--- /dev/null
+++ b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch
@@ -0,0 +1,43 @@
+diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:01.070411000 -0400
++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:22.371785000 -0400
+@@ -1382,6 +1382,7 @@ enum LinuxDistro {
+ DebianSqueeze,
+ DebianWheezy,
+ Exherbo,
++ Gentoo,
+ RHEL4,
+ RHEL5,
+ RHEL6,
+@@ -1403,6 +1404,10 @@ enum LinuxDistro {
+ UnknownDistro
+ };
+
++static bool IsGentoo(enum LinuxDistro Distro) {
++ return Distro == Gentoo;
++}
++
+ static bool IsRedhat(enum LinuxDistro Distro) {
+ return Distro == Fedora13 || Distro == Fedora14 ||
+ Distro == Fedora15 || Distro == FedoraRawhide ||
+@@ -1433,7 +1438,9 @@ static LinuxDistro DetectLinuxDistro(llv
+ SmallVector<StringRef, 8> Lines;
+ Data.split(Lines, "\n");
+ for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) {
+- if (Lines[i] == "DISTRIB_CODENAME=hardy")
++ if (Lines[i] == "DISTRIB_ID=\"Gentoo\"")
++ return Gentoo;
++ else if (Lines[i] == "DISTRIB_CODENAME=hardy")
+ return UbuntuHardy;
+ else if (Lines[i] == "DISTRIB_CODENAME=intrepid")
+ return UbuntuIntrepid;
+@@ -1597,6 +1604,9 @@ Linux::GCCInstallationDetector::GCCInsta
+ GccInstallPath.append("/");
+ GccInstallPath.append(CXX_INCLUDE_ARCH);
+ GccInstallPath.append("/");
++ llvm::OwningPtr<llvm::MemoryBuffer> File;
++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + D.DefaultHostTriple, File))
++ Version = File.get()->getBuffer().rsplit('-').second.substr(0,5);
+ GccInstallPath.append(Version);
+ GccParentLibPath = GccInstallPath + "/../../..";
+ IsValid = true;