From d305a4af3b906732d60115554bab8c9b22ae29fe Mon Sep 17 00:00:00 2001 From: Dave Johansen Date: Thu, 29 Jan 2015 21:02:44 -0700 Subject: [PATCH] Fix for RHEL detection --- 0007-rhel-detection.patch | 65 +++++++++++++++++++++++++++++++++++++++ llvm.spec | 7 ++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 0007-rhel-detection.patch diff --git a/0007-rhel-detection.patch b/0007-rhel-detection.patch new file mode 100644 index 0000000..6f40dab --- /dev/null +++ b/0007-rhel-detection.patch @@ -0,0 +1,65 @@ +--- a/tools/clang/lib/Driver/ToolChains.cpp 2014-04-26 01:38:13.000000000 +0200 ++++ b/tools/clang/lib/Driver/ToolChains.cpp 2014-12-08 23:57:22.467764790 +0100 +@@ -2175,6 +2180,7 @@ + RHEL4, + RHEL5, + RHEL6, ++ RHEL7, + Fedora, + OpenSUSE, + UbuntuHardy, +@@ -2194,7 +2200,7 @@ + }; + + static bool IsRedhat(enum Distro Distro) { +- return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL6); ++ return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL7); + } + + static bool IsOpenSUSE(enum Distro Distro) { +@@ -2233,22 +2239,32 @@ + .Case("saucy", UbuntuSaucy) + .Case("trusty", UbuntuTrusty) + .Default(UnknownDistro); +- return Version; ++ if (Version != UnknownDistro) ++ return Version; + } + + if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) { + StringRef Data = File.get()->getBuffer(); + if (Data.startswith("Fedora release")) + return Fedora; +- else if (Data.startswith("Red Hat Enterprise Linux") && ++ else if ((Data.startswith("Red Hat Enterprise Linux") || ++ Data.startswith("CentOS") || ++ Data.startswith("Scientific Linux")) && ++ Data.find("release 7") != StringRef::npos) ++ return RHEL7; ++ else if ((Data.startswith("Red Hat Enterprise Linux") || ++ Data.startswith("CentOS") || ++ Data.startswith("Scientific Linux")) && + Data.find("release 6") != StringRef::npos) + return RHEL6; + else if ((Data.startswith("Red Hat Enterprise Linux") || +- Data.startswith("CentOS")) && ++ Data.startswith("CentOS") || ++ Data.startswith("Scientific Linux")) && + Data.find("release 5") != StringRef::npos) + return RHEL5; + else if ((Data.startswith("Red Hat Enterprise Linux") || +- Data.startswith("CentOS")) && ++ Data.startswith("CentOS") || ++ Data.startswith("Scientific Linux")) && + Data.find("release 4") != StringRef::npos) + return RHEL4; + return UnknownDistro; +@@ -2424,7 +2440,7 @@ + ExtraOpts.push_back("--hash-style=both"); + } + +- if (IsRedhat(Distro)) ++ if (Distro == Fedora || Distro == RHEL7) + ExtraOpts.push_back("--no-add-needed"); + + if (Distro == DebianSqueeze || Distro == DebianWheezy || diff --git a/llvm.spec b/llvm.spec index 3f1a9b3..c9766f3 100644 --- a/llvm.spec +++ b/llvm.spec @@ -49,7 +49,7 @@ Obsoletes: pure <= 0.55 Name: llvm Version: %{version_base}.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: The Low Level Virtual Machine Group: Development/Languages @@ -75,6 +75,7 @@ Patch3: 0003-amazon-triples.patch Patch4: 0004-devtoolset.patch Patch5: 0005-scan-build-dir.patch Patch6: 0006-fix-python-package-installation.patch +Patch7: 0007-rhel-detection.patch BuildRequires: bison BuildRequires: chrpath @@ -307,6 +308,7 @@ mv lldb-%{version_base} tools/lldb %if %{with lldb} %patch6 -p1 %endif +%patch7 -p1 # fix library paths sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' ./configure @@ -676,6 +678,9 @@ exit 0 %endif %changelog +* Thu Jan 29 2015 Dave Johansen 3.4.2-6 +- Fix for RHEL detection + * Fri Jan 02 2015 Dave Johansen 3.4.2-5 - Fix for LLDB