Fix for RHEL detection

This commit is contained in:
Dave Johansen 2015-01-29 21:02:44 -07:00
parent 2ad2879a2b
commit d305a4af3b
2 changed files with 71 additions and 1 deletions

65
0007-rhel-detection.patch Normal file
View File

@ -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 ||

View File

@ -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 <davejohansen@gmail.com> 3.4.2-6
- Fix for RHEL detection
* Fri Jan 02 2015 Dave Johansen <davejohansen@gmail.com> 3.4.2-5
- Fix for LLDB