Skip to content

Commit

Permalink
backport sysroot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed May 17, 2023
1 parent 28f7809 commit 9cc4807
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 54 deletions.
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "14.0.6" %}
{% set major_version = version.split(".")[0] %}
{% set build_number = 0 %}
{% set build_number = 1 %}

{% set minor_aware_ext = major_version %}
{% if version.split(".")[1] | int > 0 %}
Expand Down
7 changes: 2 additions & 5 deletions recipe/patches/0001-Find-conda-gcc-installation.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From afbd83b67e456e1cd51dd0c8917b0cd3756bcab5 Mon Sep 17 00:00:00 2001
From e705a45fedcac4595772aa6f5bbb4b78bdfc17a0 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 8 Apr 2019 16:20:03 -0500
Subject: [PATCH 1/8] Find conda gcc installation
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 1/8] Find conda gcc installation
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7a9570a686f4..358d5d576a03 100644
index 7a9570a686..358d5d576a 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2073,7 +2073,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
Expand Down Expand Up @@ -39,6 +39,3 @@ index 7a9570a686f4..358d5d576a03 100644

static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
--
2.35.3.windows.1

11 changes: 4 additions & 7 deletions recipe/patches/0002-Fix-sysroot-detection-for-linux.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 41440b8f0b300ba79ab02661941a7ddb82bc6940 Mon Sep 17 00:00:00 2001
From 1ea114bff00937f75b07be640908c467eb46eb7d Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Mon, 8 Apr 2019 16:32:17 -0500
Subject: [PATCH 2/8] Fix sysroot detection for linux
Expand All @@ -8,10 +8,10 @@ Subject: [PATCH 2/8] Fix sysroot detection for linux
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index f85c04df4f6c..0614a06956b0 100644
index 83cb41159d..56f48775d6 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -361,7 +361,7 @@ std::string Linux::computeSysRoot() const {
@@ -355,7 +355,7 @@ std::string Linux::computeSysRoot() const {
return AndroidSysRootPath;
}

Expand All @@ -20,7 +20,7 @@ index f85c04df4f6c..0614a06956b0 100644
return std::string();

// Standalone MIPS toolchains use different names for sysroot folder
@@ -379,6 +379,14 @@ std::string Linux::computeSysRoot() const {
@@ -373,6 +373,14 @@ std::string Linux::computeSysRoot() const {
if (getVFS().exists(Path))
return Path;

Expand All @@ -35,6 +35,3 @@ index f85c04df4f6c..0614a06956b0 100644
Path = (InstallDir + "/../../../../sysroot" + Multilib.osSuffix()).str();

if (getVFS().exists(Path))
--
2.35.3.windows.1

Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
From 3ef3a30e7b28d29f8e33150111d49503192f6d3e Mon Sep 17 00:00:00 2001
From 5d879a09f242e95f95b30d647597ea1e28024918 Mon Sep 17 00:00:00 2001
From: Nehal J Wani <nehaljw.kkd1@gmail.com>
Date: Sat, 25 Aug 2018 09:20:04 -0500
Subject: [PATCH 3/8] 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 3bfddeefc7b2..6f06900ed18a 100644
index 3bfddeefc7..6078e2864c 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1208,8 +1208,13 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
@@ -1208,6 +1208,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;
+ } else {
+ if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
+ SysRoot = A->getValue();
+ }
+ // 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__dyld_prefix_EQ))
DyldPrefix = A->getValue();

diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index ec7b1505c7bf..2996c41af5f0 100644
index ec7b1505c7..2996c41af5 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -25,6 +25,7 @@
Expand All @@ -52,6 +48,3 @@ index ec7b1505c7bf..2996c41af5f0 100644
break;
}
}
--
2.35.3.windows.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d7bff48e59f188aa592eda3b4e3a89ba1165039f Mon Sep 17 00:00:00 2001
From 13cbbc1615c09991610ca8305bd64f90f2bd60db Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 30 Aug 2017 20:01:49 +0100
Subject: [PATCH 4/8] Fix normalizeProgramName()'s handling of dots outside of
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 d657d21bfcdb..581d59451040 100644
index d657d21bfc..581d594510 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -50,6 +50,7 @@ using namespace driver;
Expand Down Expand Up @@ -61,6 +61,3 @@ index d657d21bfcdb..581d59451040 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.35.3.windows.1

7 changes: 2 additions & 5 deletions recipe/patches/0005-Set-VERSION-in-osx-as-well.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From adbd7661047e4ce2d1a2ca1fa3cba755ec57d6cd Mon Sep 17 00:00:00 2001
From f82bccf998c5134653a33863551e699dabefc0b2 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Sat, 27 Jul 2019 11:55:23 -0500
Subject: [PATCH 5/8] Set VERSION in osx as well
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 5/8] Set VERSION in osx as well
1 file changed, 5 insertions(+)

diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 4e0647971ab4..d5f9c43d5d14 100644
index 4e0647971a..d5f9c43d5d 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -154,6 +154,11 @@ if(ENABLE_SHARED)
Expand All @@ -23,6 +23,3 @@ index 4e0647971ab4..d5f9c43d5d14 100644
else()
set_target_properties(libclang
PROPERTIES
--
2.35.3.windows.1

7 changes: 2 additions & 5 deletions recipe/patches/0006-Fix-crosscompiling-LLVM-tools.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From f921795451a491ba8fdd8d9d69ce61d727bdd259 Mon Sep 17 00:00:00 2001
From 82e886d49ae8abbbea4064f519c1556fbf7bb4ab Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Tue, 11 May 2021 15:08:13 +0200
Subject: [PATCH 6/8] Fix crosscompiling LLVM tools
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 6/8] Fix crosscompiling LLVM tools
1 file changed, 10 insertions(+)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 937a8467df1d..79e310c636b0 100644
index 937a8467df..79e310c636 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -114,6 +114,16 @@ if(CLANG_BUILT_STANDALONE)
Expand All @@ -28,6 +28,3 @@ index 937a8467df1d..79e310c636b0 100644
include(TableGen)
include(HandleLLVMOptions)
include(VersionFromVCS)
--
2.35.3.windows.1

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 94a04ead81e8ed877eb890b306a0e39947f5094d Mon Sep 17 00:00:00 2001
From cafb13648bd8cc98cc3204e09c4473126b8f8f03 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwe.korn@quantco.com>
Date: Tue, 11 May 2021 15:09:51 +0200
Subject: [PATCH 7/8] Only error on undefined TARGET_OS_OSX
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 7/8] Only error on undefined TARGET_OS_OSX
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index f7da3f187814..4efe81614f81 100644
index f7da3f1878..4efe81614f 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -1042,7 +1042,7 @@ DarwinClang::DarwinClang(const Driver &D, const llvm::Triple &Triple,
Expand All @@ -20,6 +20,3 @@ index f7da3f187814..4efe81614f81 100644
CC1Args.push_back("-Werror=undef-prefix");

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

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 227e38e9ba2d9b7ed9dc9b3b43d24d97cfbd1443 Mon Sep 17 00:00:00 2001
From 115dc0f0fff11234d8fac705a92fd7e127335df7 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Thu, 14 Apr 2022 11:57:00 +1100
Subject: [PATCH 8/8] set libclang SOVERSION unconditionally
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH 8/8] set libclang SOVERSION unconditionally
1 file changed, 6 insertions(+)

diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index d5f9c43d5d14..b448574d29e7 100644
index d5f9c43d5d..b448574d29 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -181,7 +181,13 @@ if(ENABLE_SHARED)
Expand All @@ -25,6 +25,3 @@ index d5f9c43d5d14..b448574d29e7 100644
set_target_properties(libclang PROPERTIES
VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}
SOVERSION ${CLANG_SONAME})
--
2.35.3.windows.1

0 comments on commit 9cc4807

Please sign in to comment.