Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ source:
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/llvm-project-{{ version.replace(".rc", "rc") }}.src.tar.xz
sha256: ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e
patches:
- patches/0002-Fix-sysroot-detection-for-linux.patch
- patches/0003-clang-add-conda-specific-env-var-CONDA_BUILD_SYSROOT.patch
- patches/0004-Fix-normalizeProgramName-s-handling-of-dots-outside-.patch
- patches/0005-Set-VERSION-in-osx-as-well.patch
- patches/0006-Fix-crosscompiling-LLVM-tools.patch
- patches/0001-Fix-sysroot-detection-for-linux.patch
- patches/0002-clang-add-conda-specific-env-var-CONDA_BUILD_SYSROOT.patch
- patches/0003-Fix-normalizeProgramName-s-handling-of-dots-outside-.patch
- patches/0004-Set-VERSION-in-osx-as-well.patch
- patches/0005-Fix-crosscompiling-LLVM-tools.patch
# Disable -Werror,-Wundef-prefix=TARGET_OS as they are not yet defined in the 10.9 SDK used for osx-64
# Only enable it for TARGET_OS_OSX.
- patches/0007-Only-error-on-undefined-TARGET_OS_OSX.patch # [osx and x86_64]
- patches/0008-set-libclang-SOVERSION-unconditionally.patch
- patches/0006-Only-error-on-undefined-TARGET_OS_OSX.patch # [osx and x86_64]
- patches/0007-set-libclang-SOVERSION-unconditionally.patch
# check out git history before LLVM 16 for these patches
# - patches/amd-roc-2.7.0.diff # [variant != "hcc"]
# - patches/amd-roc-hcc-2.7.0.diff # [variant == "hcc"]
Expand Down
48 changes: 48 additions & 0 deletions recipe/patches/0001-Fix-sysroot-detection-for-linux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From e46d9dd8f6701270b5243348ffb4b8c3430c4229 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Mon, 8 Apr 2019 16:32:17 -0500
Subject: [PATCH 1/7] Fix sysroot detection for linux

---
clang/lib/Driver/ToolChains/Linux.cpp | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index c6fb290ffdb..b817620a8bb 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -370,18 +370,30 @@ std::string Linux::computeSysRoot() const {
return std::string();
}

- if (!GCCInstallation.isValid() || !getTriple().isMIPS())
+ if (!GCCInstallation.isValid())
+ return std::string();
+
+ // Check for conda layout
+ const StringRef InstallDir = GCCInstallation.getInstallPath();
+ const StringRef TripleStr = GCCInstallation.getTriple().str();
+
+ std::string Path =
+ (InstallDir + "/../../../../" + TripleStr + "/sysroot")
+ .str();
+
+ if (getVFS().exists(Path))
+ return Path;
+
+ if (!getTriple().isMIPS())
return std::string();

// Standalone MIPS toolchains use different names for sysroot folder
// and put it into different places. Here we try to check some known
// variants.

- const StringRef InstallDir = GCCInstallation.getInstallPath();
- const StringRef TripleStr = GCCInstallation.getTriple().str();
const Multilib &Multilib = GCCInstallation.getMultilib();

- std::string Path =
+ Path =
(InstallDir + "/../../../../" + TripleStr + "/libc" + Multilib.osSuffix())
.str();

65 changes: 0 additions & 65 deletions recipe/patches/0002-Fix-sysroot-detection-for-linux.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
From c2c32b2cd1c88f88d150ff502d5f1e0fd4d99512 Mon Sep 17 00:00:00 2001
From c17bbdb9087baecccf7e06e55ac380ae71ee280c Mon Sep 17 00:00:00 2001
From: Nehal J Wani <[email protected]>
Date: Sat, 25 Aug 2018 09:20:04 -0500
Subject: [PATCH 3/8] clang: add conda specific env var CONDA_BUILD_SYSROOT
Subject: [PATCH 2/7] clang: add conda specific env var CONDA_BUILD_SYSROOT

---
clang/lib/Driver/Driver.cpp | 9 +++++++--
clang/lib/Driver/Driver.cpp | 5 +++++
clang/lib/Lex/InitHeaderSearch.cpp | 6 +++++-
2 files changed, 12 insertions(+), 3 deletions(-)
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 661d9977fb..f5a75515ed 100644
index a268f2fa8fc..baf84d4d1ad 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1327,8 +1327,13 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
@@ -1327,6 +1327,11 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
CompilerPath = Split.second;
}
}
- if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
- SysRoot = A->getValue();
+ if (Optional<std::string> CondaBuildSysrootValue =
+ llvm::sys::Process::GetEnv("CONDA_BUILD_SYSROOT")) {
+ SysRoot = *CondaBuildSysrootValue;
+ }
+ // Override CONDA_BUILD_SYSROOT and consume sysroot option
+ if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
+ SysRoot = A->getValue();
if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
SysRoot = A->getValue();
if (const Arg *A = Args.getLastArg(options::OPT__dyld_prefix_EQ))
DyldPrefix = A->getValue();

diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index d446556571..8354362d1f 100644
index d4465565718..8354362d1ff 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -25,6 +25,7 @@
Expand All @@ -52,6 +48,3 @@ index d446556571..8354362d1f 100644
break;
}
}
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d4dffafebae289d10cffcdd8cb41956d53e2fadc Mon Sep 17 00:00:00 2001
From 3e7e229e2da4008946ba9b5cf15f3a9606a835ee Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Wed, 30 Aug 2017 20:01:49 +0100
Subject: [PATCH 4/8] Fix normalizeProgramName()'s handling of dots outside of
Subject: [PATCH 3/7] Fix normalizeProgramName()'s handling of dots outside of
.exe

It used to strip everything after the last dot, turning:
Expand All @@ -18,7 +18,7 @@ x86_64-apple-darwin13.4
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index bc70205a6c..3a7948509a 100644
index bc70205a6c0..3a7948509a6 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -51,6 +51,7 @@ using namespace driver;
Expand Down Expand Up @@ -61,6 +61,3 @@ index bc70205a6c..3a7948509a 100644
if (is_style_windows(llvm::sys::path::Style::native)) {
// Transform to lowercase for case insensitive file systems.
std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(),
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From 736992bda48c9a10db659b402991590af76e8922 Mon Sep 17 00:00:00 2001
From 53451239fa132559547b7dd8022d74526fba102a Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Sat, 27 Jul 2019 11:55:23 -0500
Subject: [PATCH 5/8] Set VERSION in osx as well
Subject: [PATCH 4/7] Set VERSION in osx as well

---
clang/tools/libclang/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 4f23065a24..da8a9740fa 100644
index 4f23065a247..da8a9740fab 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -172,6 +172,11 @@ if(ENABLE_SHARED)
Expand All @@ -23,6 +23,3 @@ index 4f23065a24..da8a9740fa 100644
else()
set_target_properties(libclang
PROPERTIES
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From d3f9de592fb29a1e7f6870e3738778cec01a61e7 Mon Sep 17 00:00:00 2001
From bcde5c3f996bf4f2e4abe17a697ee8fc675dbcee Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Tue, 11 May 2021 15:08:13 +0200
Subject: [PATCH 6/8] Fix crosscompiling LLVM tools
Subject: [PATCH 5/7] Fix crosscompiling LLVM tools

---
clang/CMakeLists.txt | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 090cfa3520..3f617c6024 100644
index 090cfa35207..3f617c60244 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -67,6 +67,16 @@ if(CLANG_BUILT_STANDALONE)
Expand All @@ -28,6 +28,3 @@ index 090cfa3520..3f617c6024 100644
include(TableGen)
include(HandleLLVMOptions)
include(VersionFromVCS)
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From b11a745c54966f9f48cff368a2d46cb0e265597d Mon Sep 17 00:00:00 2001
From ced5907cd03b4c84c0cb0d9d8a9bd07324852b2d Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Tue, 11 May 2021 15:09:51 +0200
Subject: [PATCH 7/8] Only error on undefined TARGET_OS_OSX
Subject: [PATCH 6/7] Only error on undefined TARGET_OS_OSX

---
clang/lib/Driver/ToolChains/Darwin.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 9f95c962ee..fb3f8f16d0 100644
index 9f95c962ee9..fb3f8f16d04 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1099,7 +1099,7 @@ DarwinClang::DarwinClang(const Driver &D, const llvm::Triple &Triple,
Expand All @@ -20,6 +20,3 @@ index 9f95c962ee..fb3f8f16d0 100644
CC1Args.push_back("-Werror=undef-prefix");

// For modern targets, promote certain warnings to errors.
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From 3be041186eb565edd232229bfb2a4b6201c5b636 Mon Sep 17 00:00:00 2001
From ad4c79a522f9888398020dbf1df75f4c2f9f4ca6 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Thu, 14 Apr 2022 11:57:00 +1100
Subject: [PATCH 8/8] set libclang SOVERSION unconditionally
Subject: [PATCH 7/7] set libclang SOVERSION unconditionally

and avoid creating libclang with full version suffix
---
clang/tools/libclang/CMakeLists.txt | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index da8a9740fa..dd4d43c56b 100644
index da8a9740fab..dd4d43c56b4 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -9,10 +9,7 @@
Expand Down Expand Up @@ -44,6 +44,3 @@ index da8a9740fa..dd4d43c56b 100644
endif()
endif()

--
2.38.1.windows.1