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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cmake -G "Ninja" ^
-DLLVM_INCLUDE_DOCS=OFF ^
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON ^
-DLLVM_ENABLE_LIBXML2=OFF ^
-DPython3_EXECUTABLE=%BUILD_PREFIX%\python ^
%SRC_DIR%

if errorlevel 1 exit 1
Expand Down
3 changes: 2 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

if [[ "$CONDA_BUILD_CROSS_COMPILATION" == "1" ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_TABLEGEN_EXE=$BUILD_PREFIX/bin/llvm-tblgen -DNATIVE_LLVM_DIR=$BUILD_PREFIX/lib/cmake/llvm"
CMAKE_ARGS="${CMAKE_ARGS} -DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=$CC_FOR_BUILD;-DCMAKE_CXX_COMPILER=$CXX_FOR_BUILD;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2;-DCMAKE_EXE_LINKER_FLAGS=;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=;-DCMAKE_STATIC_LINKER_FLAGS=;"
CMAKE_ARGS="${CMAKE_ARGS} -DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=$CC_FOR_BUILD;-DCMAKE_CXX_COMPILER=$CXX_FOR_BUILD;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2;-DCMAKE_EXE_LINKER_FLAGS=;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=;-DCMAKE_STATIC_LINKER_FLAGS=;-DZLIB_ROOT=$BUILD_PREFIX"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILD_PREFIX? why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for the cross-compiled LLVM tools to detect the correct libz. Otherwise, they also pick up the one in $PREFIX.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is part of the very long CROSS_TOOLCHAIN_FLAGS_NATIVE variable value.

else
rm -rf $BUILD_PREFIX/bin/llvm-tblgen
fi
Expand All @@ -35,6 +35,7 @@ cmake \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DCMAKE_AR=$AR \
-DPython3_EXECUTABLE=${BUILD_PREFIX}/bin/python \
$CMAKE_ARGS \
..

Expand Down
20 changes: 11 additions & 9 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "11.1.0" %}
{% set version = "12.0.0" %}
{% set major_version = version.split(".")[0] %}
{% set build_number = 1 %}

Expand All @@ -14,24 +14,25 @@ package:

source:
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/clang-{{ version.replace(".rc", "rc") }}.src.tar.xz
sha256: 0a8288f065d1f57cb6d96da4d2965cbea32edc572aa972e466e954d17148558b
sha256: e26e452e91d4542da3ebbf404f024d3e1cbf103f4cd110c26bf0a19621cca9ed
patches:
- patches/0001-Find-conda-gcc-installation.patch
- patches/0002-Fix-sysroot-detection-for-linux.patch
- patches/0002-clang-add-conda-specific-env-var-CONDA_BUILD_SYSROOT.patch
- patches/0003-clang-Fix-normalizeProgramName-s-handling-of-dots-ou.patch
- patches/0004-clang-fix-sysroot-dupe-headers-a3a243.patch
- patches/0001-Set-VERSION-in-osx-as-well.patch
- patches/cross-compile.diff
- 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
# 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/disable-wundef-prefix.patch # [osx and x86_64]
- patches/0007-Only-error-on-undefined-TARGET_OS_OSX.patch # [osx and x86_64]
#- patches/amd-roc-2.7.0.diff # [variant != "hcc"]
#- patches/amd-roc-hcc-2.7.0.diff # [variant == "hcc"]
folder: .
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ version.replace(".rc", "-rc") }}/clang-tools-extra-{{ version.replace(".rc", "rc") }}.src.tar.xz
sha256: 76707c249de7a9cde3456b960c9a36ed9bbde8e3642c01f0ef61a43d61e0c1a2
sha256: ad41e0b527a65ade95c1ba690a5434cefaab4a2daa1be307caaa1e8541fe6d5c
folder: tools/extra
patches:
- patches/0001-Make-clangd-CompletionModel-not-depend-on-directory-.patch

build:
number: {{ build_number }}
Expand Down Expand Up @@ -359,3 +360,4 @@ extra:
- SylvainCorlay
- timsnyder
- chrisburr
- xhochy
24 changes: 12 additions & 12 deletions recipe/patches/0001-Find-conda-gcc-installation.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From e7a1fd56465717f1b8db4985fb88f6990aa567c2 Mon Sep 17 00:00:00 2001
From cd2fd6e355e40ba64267a5baa68f5678bb6b3382 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/2] Find conda gcc installation
Subject: [PATCH 1/7] Find conda gcc installation

---
lib/Driver/ToolChains/Gnu.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index 2ad45097..1ad905a4 100644
index 1d8a3cdc..7ba5e93d 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -1871,7 +1871,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
@@ -2075,7 +2075,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
Expand All @@ -20,7 +20,7 @@ index 2ad45097..1ad905a4 100644
static const char *const AArch64beLibDirs[] = {"/lib"};
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu"};
@@ -1896,7 +1896,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
@@ -2103,7 +2103,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
"x86_64-slackware-linux", "x86_64-unknown-linux",
Expand All @@ -30,15 +30,15 @@ index 2ad45097..1ad905a4 100644
static const char *const X32LibDirs[] = {"/libx32"};
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
@@ -1949,7 +1950,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
@@ -2164,7 +2165,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const PPC64LETriples[] = {
"powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
- "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+ "powerpc64le-suse-linux", "ppc64le-redhat-linux", "powerpc64le-conda_cos7-linux-gnu", "powerpc64le-conda-linux-gnu"};
"powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
- "ppc64le-redhat-linux"};
+ "ppc64le-redhat-linux", "powerpc64le-conda_cos7-linux-gnu", "powerpc64le-conda-linux-gnu"};

static const char *const RISCV32LibDirs[] = {"/lib", "/lib32"};
static const char *const RISCVTriples[] = {"riscv32-unknown-linux-gnu",
static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
--
2.17.1
2.30.1 (Apple Git-130)

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 5b69bd706085271321e4125f616927f2176da608 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwe.korn@quantco.com>
Date: Tue, 11 May 2021 22:12:48 +0200
Subject: [PATCH] Make clangd CompletionModel not depend on directory layout

---
clangd/quality/CompletionModel.cmake | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/clangd/quality/CompletionModel.cmake b/clangd/quality/CompletionModel.cmake
index 60c6d2a..dc0c0cd 100644
--- a/clangd/quality/CompletionModel.cmake
+++ b/clangd/quality/CompletionModel.cmake
@@ -4,9 +4,10 @@
# ${CMAKE_CURRENT_BINARY_DIR}. The generated header
# will define a C++ class called ${cpp_class} - which may be a
# namespace-qualified class name.
+set(CLANGD_COMPLETION_MODEL_COMPILER ${CMAKE_CURRENT_LIST_DIR}/CompletionModelCodegen.py)
function(gen_decision_forest model filename cpp_class)
- set(model_compiler ${CMAKE_SOURCE_DIR}/../clang-tools-extra/clangd/quality/CompletionModelCodegen.py)
-
+ set(model_compiler ${CLANGD_COMPLETION_MODEL_COMPILER})
+
set(output_dir ${CMAKE_CURRENT_BINARY_DIR})
set(header_file ${output_dir}/${filename}.h)
set(cpp_file ${output_dir}/${filename}.cpp)
--
2.30.2

12 changes: 6 additions & 6 deletions recipe/patches/0002-Fix-sysroot-detection-for-linux.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 662d7b8e96468596a67e4b8e917b5f776e1e745f Mon Sep 17 00:00:00 2001
From 879df15dc13b2863f31aa544631f443c04d1d929 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/2] Fix sysroot detection for linux
Subject: [PATCH 2/7] Fix sysroot detection for linux

---
lib/Driver/ToolChains/Linux.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 65ab9b2d..77e7b178 100644
index 9663a739..d8889f0f 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -478,7 +478,7 @@ std::string Linux::computeSysRoot() const {
@@ -388,7 +388,7 @@ std::string Linux::computeSysRoot() const {
return AndroidSysRootPath;
}

Expand All @@ -20,7 +20,7 @@ index 65ab9b2d..77e7b178 100644
return std::string();

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

Expand All @@ -36,5 +36,5 @@ index 65ab9b2d..77e7b178 100644

if (getVFS().exists(Path))
--
2.17.1
2.30.1 (Apple Git-130)

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
From 7565075efc6ba701dc5a6d0ba7667658dac5d3d9 Mon Sep 17 00:00:00 2001
From ab31defa0707928ce574033c80b20a44f34fdc6b 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 2/3] clang: add conda specific env var CONDA_BUILD_SYSROOT
Subject: [PATCH 3/7] clang: add conda specific env var CONDA_BUILD_SYSROOT

---
lib/Driver/Driver.cpp | 9 +++++++--
lib/Frontend/InitHeaderSearch.cpp | 6 +++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 952a716..67e4917 100644
index 418e1d3e..f3dab141 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -971,8 +971,13 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
A->claim();
PrefixDirs.push_back(A->getValue(0));
@@ -1114,8 +1114,13 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
CompilerPath = Split.second;
}
}
- if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ))
- SysRoot = A->getValue();
Expand All @@ -29,18 +29,18 @@ index 952a716..67e4917 100644
DyldPrefix = A->getValue();

diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 8a70404..b1c5f55 100644
index bc31445d..49a8ad66 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -27,6 +27,7 @@
@@ -26,6 +26,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"

using namespace clang;
@@ -228,7 +229,10 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
@@ -236,7 +237,10 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
LLVM_FALLTHROUGH;
default:
// FIXME: temporary hack: hard-coded paths.
Expand All @@ -53,5 +53,5 @@ index 8a70404..b1c5f55 100644
}
}
--
2.5.4 (Apple Git-61)
2.30.1 (Apple Git-130)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 810992794396fbd34349bf1dac9a9fe38a4d5020 Mon Sep 17 00:00:00 2001
From ae57784c2ec3ba24bc16551e695685a6924c2c9e 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 3/3] Fix normalizeProgramName()'s handling of dots outside of
Subject: [PATCH 4/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/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index b8c12fc9..e6eb95fa 100644
index b2ddef14..c8f2a567 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -50,6 +50,7 @@ using namespace driver;
Expand Down Expand Up @@ -61,3 +61,6 @@ index b8c12fc9..e6eb95fa 100644
#ifdef _WIN32
// Transform to lowercase for case insensitive file systems.
std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(), ::tolower);
--
2.30.1 (Apple Git-130)

Loading