From 75e787bdcf585705f05749cd4a45a6216e12352e Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 19 Mar 2026 23:55:50 +0100 Subject: [PATCH 1/5] New package: llvm22-22.1.1 --- common/shlibs | 4 + srcpkgs/clang-analyzer22 | 1 + srcpkgs/clang-tools-extra22 | 1 + srcpkgs/clang22 | 1 + srcpkgs/clang22-devel | 1 + srcpkgs/clang22-headers | 1 + srcpkgs/compiler-rt22 | 1 + srcpkgs/flang22 | 1 + srcpkgs/flang22-devel | 1 + srcpkgs/libclang-cpp22 | 1 + srcpkgs/libclang22 | 1 + srcpkgs/libclc22 | 1 + srcpkgs/libcxx | 2 +- srcpkgs/libcxx-devel | 2 +- srcpkgs/libcxxabi | 2 +- srcpkgs/libcxxabi-devel | 2 +- srcpkgs/liblldb22 | 1 + srcpkgs/libllvm22 | 1 + srcpkgs/libomp22 | 1 + srcpkgs/libomp22-devel | 1 + srcpkgs/lld22 | 1 + srcpkgs/lld22-devel | 1 + srcpkgs/lldb22 | 1 + srcpkgs/lldb22-devel | 1 + srcpkgs/llvm-bolt22 | 1 + srcpkgs/llvm-libunwind | 2 +- srcpkgs/llvm-libunwind-devel | 2 +- srcpkgs/llvm22-cross-tools | 1 + srcpkgs/llvm22-devel | 1 + srcpkgs/llvm22-doc | 1 + .../llvm22/files/llvm-Config-llvm-config.h | 9 + srcpkgs/llvm22/patches/SmallVector.patch | 13 + ...s-set-a-larger-stack-size-explicitly.patch | 37 + srcpkgs/llvm22/patches/armv7l-is-armhf.patch | 29 + ...clang-001-fix-unwind-chain-inclusion.patch | 44 + .../clang-003-ppc64-dynamic-linker-path.patch | 13 + ...compiler-rt-sanitizer-supported-arch.patch | 22 + .../cross-compiler-as-configured.patch | 12 + .../llvm22/patches/disable-lldb-docs.patch | 18 + .../patches/fix-runtimes-cross-build.patch | 12 + srcpkgs/llvm22/patches/flang-cross.patch | 28 + .../patches/install-llvm-min-tblgen.patch | 11 + srcpkgs/llvm22/patches/libcxx-armv67.patch | 35 + srcpkgs/llvm22/patches/libcxx-musl.patch | 26 + .../llvm22/patches/libcxx-ssp-nonshared.patch | 11 + srcpkgs/llvm22/patches/libcxxabi-dl.patch | 25 + .../patches/lldb-tblgen-build-cross.patch | 32 + srcpkgs/llvm22/patches/llvm-001-musl.patch | 32 + .../patches/llvm-004-override-opt.patch | 18 + .../llvm22/patches/llvm-005-ppc-bigpic.patch | 32 + .../patches/llvm-006-aarch64-mf_exec.patch | 24 + .../patches/openmp-target-libdirs.patch | 20 + srcpkgs/llvm22/patches/z3-libs.patch | 21 + srcpkgs/llvm22/template | 1215 +++++++++++++++++ srcpkgs/llvm22/update | 3 + srcpkgs/mlir22 | 1 + srcpkgs/mlir22-devel | 1 + 57 files changed, 1777 insertions(+), 6 deletions(-) create mode 120000 srcpkgs/clang-analyzer22 create mode 120000 srcpkgs/clang-tools-extra22 create mode 120000 srcpkgs/clang22 create mode 120000 srcpkgs/clang22-devel create mode 120000 srcpkgs/clang22-headers create mode 120000 srcpkgs/compiler-rt22 create mode 120000 srcpkgs/flang22 create mode 120000 srcpkgs/flang22-devel create mode 120000 srcpkgs/libclang-cpp22 create mode 120000 srcpkgs/libclang22 create mode 120000 srcpkgs/libclc22 create mode 120000 srcpkgs/liblldb22 create mode 120000 srcpkgs/libllvm22 create mode 120000 srcpkgs/libomp22 create mode 120000 srcpkgs/libomp22-devel create mode 120000 srcpkgs/lld22 create mode 120000 srcpkgs/lld22-devel create mode 120000 srcpkgs/lldb22 create mode 120000 srcpkgs/lldb22-devel create mode 120000 srcpkgs/llvm-bolt22 create mode 120000 srcpkgs/llvm22-cross-tools create mode 120000 srcpkgs/llvm22-devel create mode 120000 srcpkgs/llvm22-doc create mode 100644 srcpkgs/llvm22/files/llvm-Config-llvm-config.h create mode 100644 srcpkgs/llvm22/patches/SmallVector.patch create mode 100644 srcpkgs/llvm22/patches/always-set-a-larger-stack-size-explicitly.patch create mode 100644 srcpkgs/llvm22/patches/armv7l-is-armhf.patch create mode 100644 srcpkgs/llvm22/patches/clang-001-fix-unwind-chain-inclusion.patch create mode 100644 srcpkgs/llvm22/patches/clang-003-ppc64-dynamic-linker-path.patch create mode 100644 srcpkgs/llvm22/patches/compiler-rt-sanitizer-supported-arch.patch create mode 100644 srcpkgs/llvm22/patches/cross-compiler-as-configured.patch create mode 100644 srcpkgs/llvm22/patches/disable-lldb-docs.patch create mode 100644 srcpkgs/llvm22/patches/fix-runtimes-cross-build.patch create mode 100644 srcpkgs/llvm22/patches/flang-cross.patch create mode 100644 srcpkgs/llvm22/patches/install-llvm-min-tblgen.patch create mode 100644 srcpkgs/llvm22/patches/libcxx-armv67.patch create mode 100644 srcpkgs/llvm22/patches/libcxx-musl.patch create mode 100644 srcpkgs/llvm22/patches/libcxx-ssp-nonshared.patch create mode 100644 srcpkgs/llvm22/patches/libcxxabi-dl.patch create mode 100644 srcpkgs/llvm22/patches/lldb-tblgen-build-cross.patch create mode 100644 srcpkgs/llvm22/patches/llvm-001-musl.patch create mode 100644 srcpkgs/llvm22/patches/llvm-004-override-opt.patch create mode 100644 srcpkgs/llvm22/patches/llvm-005-ppc-bigpic.patch create mode 100644 srcpkgs/llvm22/patches/llvm-006-aarch64-mf_exec.patch create mode 100644 srcpkgs/llvm22/patches/openmp-target-libdirs.patch create mode 100644 srcpkgs/llvm22/patches/z3-libs.patch create mode 100644 srcpkgs/llvm22/template create mode 100644 srcpkgs/llvm22/update create mode 120000 srcpkgs/mlir22 create mode 120000 srcpkgs/mlir22-devel diff --git a/common/shlibs b/common/shlibs index 95e1e6bfacaaf2..f568b9097b8c65 100644 --- a/common/shlibs +++ b/common/shlibs @@ -940,14 +940,17 @@ libuchardet.so.0 uchardet-0.0.6_1 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1 libyajl.so.2 yajl-2.0.1_1 libconfuse.so.2 confuse-3.2.1_1 +liblldb.so.22.1 liblldb22-22.1.1_1 liblldb.so.21.1 liblldb21-21.1.4_1 liblldb.so.19.1 liblldb19-19.1.0_1 liblldb.so.18.1 liblldb18-18.1.8_1 liblldb.so.17 liblldb17-17.0.6_3 +libclang.so.22.1 libclang22-22.1.1_1 libclang.so.21.1 libclang21-21.1.4_1 libclang.so.19.1 libclang19-19.1.0_1 libclang.so.18.1 libclang18-18.1.8_1 libclang.so.17 libclang17-17.0.6_1 +libclang-cpp.so.22.1 libclang-cpp22-22.1.1_1 libclang-cpp.so.21.1 libclang-cpp21-21.1.4_1 libclang-cpp.so.19.1 libclang-cpp19-19.1.0_1 libclang-cpp.so.18.1 libclang-cpp18-18.1.8_1 @@ -956,6 +959,7 @@ libLLVM-17.so libllvm17-17.0.6_1 libLLVM.so.18.1 libllvm18-18.1.8_1 libLLVM.so.19.1 libllvm19-19.1.0_1 libLLVM.so.21.1 libllvm21-21.1.4_1 +libLLVM.so.22.1 libllvm22-22.1.1_1 libLLVMSPIRVLib.so.18.1 SPIRV-LLVM-Translator-18.1.2_1 libLLVMSPIRVLib.so.19.1 SPIRV-LLVM-Translator19-19.1.1_1 libLLVMSPIRVLib.so.21.1 SPIRV-LLVM-Translator21-21.1.1_1 diff --git a/srcpkgs/clang-analyzer22 b/srcpkgs/clang-analyzer22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/clang-analyzer22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/clang-tools-extra22 b/srcpkgs/clang-tools-extra22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/clang-tools-extra22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/clang22 b/srcpkgs/clang22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/clang22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/clang22-devel b/srcpkgs/clang22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/clang22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/clang22-headers b/srcpkgs/clang22-headers new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/clang22-headers @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/compiler-rt22 b/srcpkgs/compiler-rt22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/compiler-rt22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/flang22 b/srcpkgs/flang22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/flang22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/flang22-devel b/srcpkgs/flang22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/flang22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libclang-cpp22 b/srcpkgs/libclang-cpp22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libclang-cpp22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libclang22 b/srcpkgs/libclang22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libclang22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libclc22 b/srcpkgs/libclc22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libclc22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/libcxx +++ b/srcpkgs/libcxx @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/libcxx-devel +++ b/srcpkgs/libcxx-devel @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/libcxxabi +++ b/srcpkgs/libcxxabi @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/libcxxabi-devel +++ b/srcpkgs/libcxxabi-devel @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/liblldb22 b/srcpkgs/liblldb22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/liblldb22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libllvm22 b/srcpkgs/libllvm22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libllvm22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libomp22 b/srcpkgs/libomp22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libomp22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/libomp22-devel b/srcpkgs/libomp22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/libomp22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/lld22 b/srcpkgs/lld22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/lld22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/lld22-devel b/srcpkgs/lld22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/lld22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/lldb22 b/srcpkgs/lldb22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/lldb22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/lldb22-devel b/srcpkgs/lldb22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/lldb22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm-bolt22 b/srcpkgs/llvm-bolt22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/llvm-bolt22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/llvm-libunwind +++ b/srcpkgs/llvm-libunwind @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel index 39080ddd1ff022..0a2a1ce95a3d91 120000 --- a/srcpkgs/llvm-libunwind-devel +++ b/srcpkgs/llvm-libunwind-devel @@ -1 +1 @@ -llvm21 \ No newline at end of file +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm22-cross-tools b/srcpkgs/llvm22-cross-tools new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/llvm22-cross-tools @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm22-devel b/srcpkgs/llvm22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/llvm22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm22-doc b/srcpkgs/llvm22-doc new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/llvm22-doc @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/llvm22/files/llvm-Config-llvm-config.h b/srcpkgs/llvm22/files/llvm-Config-llvm-config.h new file mode 100644 index 00000000000000..2fa08c9be69621 --- /dev/null +++ b/srcpkgs/llvm22/files/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm22/patches/SmallVector.patch b/srcpkgs/llvm22/patches/SmallVector.patch new file mode 100644 index 00000000000000..ac10d306c4346d --- /dev/null +++ b/srcpkgs/llvm22/patches/SmallVector.patch @@ -0,0 +1,13 @@ +diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h +index 2e6d2dc6ce90..be2cf6cc1fee 100644 +--- a/llvm/include/llvm/ADT/SmallVector.h ++++ b/llvm/include/llvm/ADT/SmallVector.h +@@ -1163,7 +1163,7 @@ template struct CalculateSmallVectorDefaultInlinedElements { + // happens on a 32-bit host and then fails due to sizeof(T) *increasing* on a + // 64-bit host, is expected to be very rare. + static_assert( +- sizeof(T) <= 256, ++ sizeof(T) <= 288, + "You are trying to use a default number of inlined elements for " + "`SmallVector` but `sizeof(T)` is really big! Please use an " + "explicit number of inlined elements with `SmallVector` to make " diff --git a/srcpkgs/llvm22/patches/always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm22/patches/always-set-a-larger-stack-size-explicitly.patch new file mode 100644 index 00000000000000..cb17121dea2021 --- /dev/null +++ b/srcpkgs/llvm22/patches/always-set-a-larger-stack-size-explicitly.patch @@ -0,0 +1,37 @@ +From 2354350bcc890c13016d67f4c060b32cb1cd693c Mon Sep 17 00:00:00 2001 +From: q66 +Date: Sat, 4 Nov 2023 08:44:01 +0100 +Subject: [PATCH 01/25] llvm: always set a larger stack size explicitly + +--- + llvm/lib/Support/Threading.cpp | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp +index 7cc7ba44c..b91b8f4bb 100644 +--- a/llvm/lib/Support/Threading.cpp ++++ b/llvm/lib/Support/Threading.cpp +@@ -77,21 +77,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const { + // keyword. + #include "llvm/Support/thread.h" + +-#if defined(__APPLE__) +- // Darwin's default stack size for threads except the main one is only 512KB, +- // which is not enough for some/many normal LLVM compilations. This implements +- // the same interface as std::thread but requests the same stack size as the +- // main thread (8MB) before creation. + const std::optional llvm::thread::DefaultStackSize = 8 * 1024 * 1024; +-#elif defined(_AIX) +- // On AIX, the default pthread stack size limit is ~192k for 64-bit programs. +- // This limit is easily reached when doing link-time thinLTO. AIX library +- // developers have used 4MB, so we'll do the same. +-const std::optional llvm::thread::DefaultStackSize = 4 * 1024 * 1024; +-#else +-const std::optional llvm::thread::DefaultStackSize; +-#endif +- + + #endif + +-- +2.42.0 diff --git a/srcpkgs/llvm22/patches/armv7l-is-armhf.patch b/srcpkgs/llvm22/patches/armv7l-is-armhf.patch new file mode 100644 index 00000000000000..14d197d9304263 --- /dev/null +++ b/srcpkgs/llvm22/patches/armv7l-is-armhf.patch @@ -0,0 +1,29 @@ +armv7l is referred to as armhf in LLVM. While compiler-rt/CMakeLists.txt +already performs this replacement, it does not seem to be applied in all +places where it is needed. + +In compiler-rt/lib/builtins/CMakeLists.txt, the incorrect value is used, +which prevents creation of the clang_rt.builtins-${arch}.sources.txt file +for the target architecture, because armv7l is not included in the +BUILTIN_SUPPORTED_ARCH list. + +As a result, compiler-rt/test/builtins/CMakeLists.txt is unable to read the +clang_rt.builtins-armhf.sources.txt file. + +CMake Error at /builddir/llvm22-22.1.1/compiler-rt/test/builtins/CMakeLists.txt:110 (file): + file failed to open for reading (No such file or directory): + /builddir/llvm22-22.1.1/llvm/build/./lib/../lib/clang/22/lib/linux/clang_rt.builtins-armhf.sources.txt + +--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake ++++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +@@ -413,6 +413,10 @@ + set(COMPILER_RT_DEFAULT_TARGET_ARCH "i386") + endif() + ++ if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^armv7l$") ++ set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf") ++ endif() ++ + # If we are directly targeting a GPU we need to check that the compiler is + # compatible and pass some default arguments. + if(COMPILER_RT_DEFAULT_TARGET_ONLY) diff --git a/srcpkgs/llvm22/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm22/patches/clang-001-fix-unwind-chain-inclusion.patch new file mode 100644 index 00000000000000..e4eaa7783e7a6c --- /dev/null +++ b/srcpkgs/llvm22/patches/clang-001-fix-unwind-chain-inclusion.patch @@ -0,0 +1,44 @@ +From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:57 +0200 +Subject: [PATCH 2/7] fix unwind chain inclusion + +--- + lib/Headers/unwind.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h +index 303d792..44e10cc 100644 +--- a/clang/lib/Headers/unwind.h ++++ b/clang/lib/Headers/unwind.h +@@ -9,9 +9,6 @@ + + /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ + +-#ifndef __CLANG_UNWIND_H +-#define __CLANG_UNWIND_H +- + #if defined(__APPLE__) && __has_include_next() + /* Darwin (from 11.x on) provide an unwind.h. If that's available, + * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE, +@@ -39,6 +36,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include + + #ifdef __cplusplus +@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ +-- +2.5.1 diff --git a/srcpkgs/llvm22/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm22/patches/clang-003-ppc64-dynamic-linker-path.patch new file mode 100644 index 00000000000000..4ad6412d1e6c63 --- /dev/null +++ b/srcpkgs/llvm22/patches/clang-003-ppc64-dynamic-linker-path.patch @@ -0,0 +1,13 @@ +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + Loader = "ld.so.1"; + break; + case llvm::Triple::ppc64: +- LibDir = "lib64"; +- Loader = +- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; +- break; + case llvm::Triple::ppc64le: + LibDir = "lib64"; + Loader = diff --git a/srcpkgs/llvm22/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm22/patches/compiler-rt-sanitizer-supported-arch.patch new file mode 100644 index 00000000000000..45f5c6da2ecf10 --- /dev/null +++ b/srcpkgs/llvm22/patches/compiler-rt-sanitizer-supported-arch.patch @@ -0,0 +1,22 @@ +Based on patch from Alpine: +https://gitlab.alpinelinux.org/alpine/aports/-/blob/693203c42aa1cde88cb547173ef67a98824973fd/main/llvm-runtimes/compiler-rt-sanitizer-supported-arch.patch + +Sanitizer code is broken on armhf, armv7, s390x, x86, and probably riscv64 on musl, +i.e. enable it only on x86_64, aarch64, and ppc64le. + +--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake ++++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +@@ -28,9 +28,13 @@ + set(ARM32 ${ARM32} armv7) + endif() + ++if (LIBCXX_HAS_MUSL_LIBC) ++set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86_64} ${ARM64} ${PPC64}) ++else() + set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64} + ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} + ${HEXAGON} ${LOONGARCH64}) ++endif() + set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64} + ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} + ${LOONGARCH64}) diff --git a/srcpkgs/llvm22/patches/cross-compiler-as-configured.patch b/srcpkgs/llvm22/patches/cross-compiler-as-configured.patch new file mode 100644 index 00000000000000..6f60301fe7b7d3 --- /dev/null +++ b/srcpkgs/llvm22/patches/cross-compiler-as-configured.patch @@ -0,0 +1,12 @@ +We want to always use clang and not rely on cmake to choose a gcc cross compiler. +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -23,7 +23,7 @@ + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\") +- elseif (NOT CMAKE_CROSSCOMPILING) ++ else() + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} diff --git a/srcpkgs/llvm22/patches/disable-lldb-docs.patch b/srcpkgs/llvm22/patches/disable-lldb-docs.patch new file mode 100644 index 00000000000000..6e7c774bea2f1b --- /dev/null +++ b/srcpkgs/llvm22/patches/disable-lldb-docs.patch @@ -0,0 +1,18 @@ +commit 9af31d021e83dce4e98f06d8e732f4afb481cd08 +Author: Daniel Martinez +Date: Sat Aug 3 18:04:04 2024 -0400 + + disable lldb docs as they depend on some sphinx packages we don't have + +diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt +index 59cdc4593463..e7c2c38b50a9 100644 +--- a/lldb/CMakeLists.txt ++++ b/lldb/CMakeLists.txt +@@ -124,7 +124,6 @@ add_subdirectory(utils/TableGen) + + add_subdirectory(source) + add_subdirectory(tools) +-add_subdirectory(docs) + + if (LLDB_ENABLE_PYTHON) + if(LLDB_BUILD_FRAMEWORK) diff --git a/srcpkgs/llvm22/patches/fix-runtimes-cross-build.patch b/srcpkgs/llvm22/patches/fix-runtimes-cross-build.patch new file mode 100644 index 00000000000000..baef0876e05860 --- /dev/null +++ b/srcpkgs/llvm22/patches/fix-runtimes-cross-build.patch @@ -0,0 +1,12 @@ +This is needed to make the get_host_tool_path calls in libclc use the +host/native binaries when cross compiling. +--- a/llvm/runtimes/CMakeLists.txt ++++ b/llvm/runtimes/CMakeLists.txt +@@ -270,6 +270,7 @@ + -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED} + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR} + -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS} ++ -DLLVM_NATIVE_TOOL_DIR=${LLVM_NATIVE_TOOL_DIR} + -DCMAKE_C_COMPILER_WORKS=ON + -DCMAKE_CXX_COMPILER_WORKS=ON + -DCMAKE_Fortran_COMPILER_WORKS=ON diff --git a/srcpkgs/llvm22/patches/flang-cross.patch b/srcpkgs/llvm22/patches/flang-cross.patch new file mode 100644 index 00000000000000..6ca4df89113b44 --- /dev/null +++ b/srcpkgs/llvm22/patches/flang-cross.patch @@ -0,0 +1,28 @@ +commit 92984acc52fb95566d9387948c2655507328438b +Author: Daniel Martinez +Date: Wed Jul 31 21:14:52 2024 -0400 + + Allow flang-new binary to be specified for omp modules + + This allows the path of the flang-new binary to be specified as a + cmake configuration. + + This is useful when cross compiling, as flang-new may exist + on the build machine, which should be used instead of the host. + + For example, by passing "-DFLANG_NEW_NATIVE_EXE=/usr/bin/flang-new", + that binary will be used instead of just built host compiler. + +diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt +index 42b1b86ebaad..41921aaeaeb2 100644 +--- a/llvm/runtimes/CMakeLists.txt ++++ b/llvm/runtimes/CMakeLists.txt +@@ -522,7 +522,7 @@ + if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES) + if (${LLVM_TOOL_FLANG_BUILD}) + message(STATUS "Configuring build of omp_lib.mod and omp_lib_kinds.mod via flang") +- set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang") ++ set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang" CACHE INTERNAL "") + set(LIBOMP_MODULES_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/flang") + # TODO: This is a workaround until flang becomes a first-class project + # in llvm/CMakeList.txt. Until then, this line ensures that flang is diff --git a/srcpkgs/llvm22/patches/install-llvm-min-tblgen.patch b/srcpkgs/llvm22/patches/install-llvm-min-tblgen.patch new file mode 100644 index 00000000000000..d262104d77c97a --- /dev/null +++ b/srcpkgs/llvm22/patches/install-llvm-min-tblgen.patch @@ -0,0 +1,11 @@ +--- a/llvm/utils/TableGen/CMakeLists.txt ++++ b/llvm/utils/TableGen/CMakeLists.txt +@@ -17,6 +17,8 @@ + # At least one source file must be included directly to avoid CMake problems. + # E.g. CMake derives which linker to use from the types of sources added. + add_tablegen(llvm-min-tblgen LLVM_HEADERS ++ DESTINATION "${LLVM_TOOLS_INSTALL_DIR}" ++ EXPORT LLVM + llvm-min-tblgen.cpp + $ + diff --git a/srcpkgs/llvm22/patches/libcxx-armv67.patch b/srcpkgs/llvm22/patches/libcxx-armv67.patch new file mode 100644 index 00000000000000..700ab134790452 --- /dev/null +++ b/srcpkgs/llvm22/patches/libcxx-armv67.patch @@ -0,0 +1,35 @@ +See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109180 +Avoid the following undefined reference: + +/usr/lib/gcc/armv7l-linux-gnueabihf/12.2.0/../../../../armv7l-linux-gnueabihf/bin/ld: projects/libcxx/src/CMakeFiles/cxx_shared.dir/locale.cpp.o: in function `std::__1::__time_get_c_storage::__x() const [clone .localalias]': +locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string, std::__1::allocator >::~basic_string()' +/usr/lib/gcc/armv7l-linux-gnueabihf/12.2.0/../../../../armv7l-linux-gnueabihf/bin/ld: projects/libcxx/src/CMakeFiles/cxx_shared.dir/locale.cpp.o: in function `std::__1::__time_get_c_storage::__X() const [clone .localalias]': + +diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt +index b8ac536588d3..65e5a1365634 100644 +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -308,6 +308,8 @@ endif() + option(LIBCXX_HERMETIC_STATIC_LIBRARY + "Do not export any symbols from the static library." ${LIBCXX_HERMETIC_STATIC_LIBRARY_DEFAULT}) + ++option(LIBCXX_VOID_GCC_BUG_109180_WORKAROUND OFF) ++ + #=============================================================================== + # Check option configurations + #=============================================================================== +diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt +index 35b466527096..5b0efa171616 100644 +--- a/libcxx/src/CMakeLists.txt ++++ b/libcxx/src/CMakeLists.txt +@@ -155,6 +155,10 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY) + endif() + add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") + ++if (LIBCXX_VOID_GCC_BUG_109180_WORKAROUND) ++ set_source_files_properties(string.cpp PROPERTIES COMPILE_FLAGS -fno-inline) ++endif() ++ + if (APPLE AND LLVM_USE_SANITIZER) + if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR + ("${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined") OR diff --git a/srcpkgs/llvm22/patches/libcxx-musl.patch b/srcpkgs/llvm22/patches/libcxx-musl.patch new file mode 100644 index 00000000000000..51badc35bf0c79 --- /dev/null +++ b/srcpkgs/llvm22/patches/libcxx-musl.patch @@ -0,0 +1,26 @@ +--- a/libcxx/include/__cxx03/locale ++++ b/libcxx/include/__cxx03/locale +@@ -727,7 +727,11 @@ + __libcpp_remove_reference_t __save_errno = errno; + errno = 0; + char* __p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ long long __ll = strtoll(__a, &__p2, __base); ++#else + long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + __libcpp_remove_reference_t __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; +@@ -759,7 +763,11 @@ + __libcpp_remove_reference_t __save_errno = errno; + errno = 0; + char* __p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ unsigned long long __ll = strtoull(__a, &__p2, __base); ++#else + unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + __libcpp_remove_reference_t __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; diff --git a/srcpkgs/llvm22/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm22/patches/libcxx-ssp-nonshared.patch new file mode 100644 index 00000000000000..70292beb2fcdbd --- /dev/null +++ b/srcpkgs/llvm22/patches/libcxx-ssp-nonshared.patch @@ -0,0 +1,11 @@ +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target) + target_link_libraries(${target} PRIVATE atomic) + endif() + ++#ssp target_link_libraries(${target} PRIVATE ssp_nonshared) ++ + if (MINGW) + target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}") + endif() diff --git a/srcpkgs/llvm22/patches/libcxxabi-dl.patch b/srcpkgs/llvm22/patches/libcxxabi-dl.patch new file mode 100644 index 00000000000000..e872d263de30f5 --- /dev/null +++ b/srcpkgs/llvm22/patches/libcxxabi-dl.patch @@ -0,0 +1,25 @@ +Also link to -ldl to prevent undefined references. + +--- a/libcxxabi/src/CMakeLists.txt ++++ b/libcxxabi/src/CMakeLists.txt +@@ -73,6 +73,7 @@ + endif() + + add_library_flags_if(LIBCXXABI_HAS_C_LIB c) ++ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl) + endif() + + if (LIBCXXABI_USE_LLVM_UNWINDER) +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -745,6 +745,10 @@ + if (LIBCXX_HAS_PTHREAD_LIB) + target_compile_definitions(${target} PRIVATE -D_LIBCPP_LINK_PTHREAD_LIB) + endif() ++ if (LIBCXX_HAS_C_LIB) ++ target_link_libraries(${target} PRIVATE dl) ++ endif() ++ + if (LIBCXX_HAS_RT_LIB) + target_compile_definitions(${target} PRIVATE -D_LIBCPP_LINK_RT_LIB) + endif() diff --git a/srcpkgs/llvm22/patches/lldb-tblgen-build-cross.patch b/srcpkgs/llvm22/patches/lldb-tblgen-build-cross.patch new file mode 100644 index 00000000000000..9c171d6b228083 --- /dev/null +++ b/srcpkgs/llvm22/patches/lldb-tblgen-build-cross.patch @@ -0,0 +1,32 @@ +Since lldb-tblgen is now being installed, it needs to be build during cross +builds, even if its not directly used. +--- a/lldb/utils/TableGen/CMakeLists.txt ++++ b/lldb/utils/TableGen/CMakeLists.txt +@@ -1,18 +1,10 @@ +-# tablegen targets get exported via llvm for LLVMConfig.cmake. So standalone +-# builds of lldb can potentially import this via LLVMConfig and also attempt to +-# build it in tree. So only build it if it doesn't exist. +-if (NOT DEFINED LLDB_TABLEGEN_EXE) +- if (TARGET lldb-tblgen) +- set(LLDB_TABLEGEN_EXE $ CACHE STRING "") +- else() +- set(LLVM_LINK_COMPONENTS Support) ++set(LLVM_LINK_COMPONENTS Support) + +- add_tablegen(lldb-tblgen LLDB +- DESTINATION "${CMAKE_INSTALL_BINDIR}" +- LLDBOptionDefEmitter.cpp +- LLDBPropertyDefEmitter.cpp +- LLDBTableGen.cpp +- LLDBTableGenUtils.cpp +- ) +- endif() +-endif() ++add_tablegen(lldb-tblgen LLDB ++ DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ EXPORT LLDB ++ LLDBOptionDefEmitter.cpp ++ LLDBPropertyDefEmitter.cpp ++ LLDBTableGen.cpp ++ LLDBTableGenUtils.cpp ++ ) diff --git a/srcpkgs/llvm22/patches/llvm-001-musl.patch b/srcpkgs/llvm22/patches/llvm-001-musl.patch new file mode 100644 index 00000000000000..8652e4af69f7c2 --- /dev/null +++ b/srcpkgs/llvm22/patches/llvm-001-musl.patch @@ -0,0 +1,32 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:03:02 +0200 +Subject: [PATCH 3/3] musl + +--- + include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ + lib/Support/DynamicLibrary.cpp | 2 +- + lib/Support/Unix/Signals.inc | 6 +++--- + utils/unittest/googletest/src/gtest.cc | 1 + + 5 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h +index 34a8a1e3..1214ece5 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +@@ -18,6 +18,15 @@ + #include "llvm/IR/PassManager.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + template class ArrayRef; + class Triple; diff --git a/srcpkgs/llvm22/patches/llvm-004-override-opt.patch b/srcpkgs/llvm22/patches/llvm-004-override-opt.patch new file mode 100644 index 00000000000000..51d0e4b31b32c3 --- /dev/null +++ b/srcpkgs/llvm22/patches/llvm-004-override-opt.patch @@ -0,0 +1,18 @@ +This allows us to override the optimization level as not all platforms can +deal with -O3. + +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") + endif() + ++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use") ++ ++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "") ++ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}") ++endif() ++ + # Put this before tblgen. Else we have a circular dependence. + add_subdirectory(lib/Demangle) + add_subdirectory(lib/Support) diff --git a/srcpkgs/llvm22/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm22/patches/llvm-005-ppc-bigpic.patch new file mode 100644 index 00000000000000..b278cb10b34de7 --- /dev/null +++ b/srcpkgs/llvm22/patches/llvm-005-ppc-bigpic.patch @@ -0,0 +1,32 @@ +From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 3 Nov 2019 10:57:27 -0600 +Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified + +--- + llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +- + llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp ++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +@@ -736,7 +736,7 @@ + + // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI. + if (Kind == PPC::S_PLT && Subtarget->isSecurePlt() && +- M->getPICLevel() == PICLevel::BigPIC) ++ M->getPICLevel() != PICLevel::SmallPIC) + TlsRef = MCBinaryExpr::createAdd( + TlsRef, MCConstantExpr::create(32768, OutContext), OutContext); + const MachineOperand &MO = MI->getOperand(2); +--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp ++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +@@ -139,7 +139,7 @@ + const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx); + // If -msecure-plt -fPIC, add 32768 to symbol. + if (Subtarget->isSecurePlt() && TM.isPositionIndependent() && +- M->getPICLevel() == PICLevel::BigPIC && ++ M->getPICLevel() != PICLevel::SmallPIC && + MO.getTargetFlags() == PPCII::MO_PLT) + Expr = + MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx); diff --git a/srcpkgs/llvm22/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm22/patches/llvm-006-aarch64-mf_exec.patch new file mode 100644 index 00000000000000..192b4824b8695c --- /dev/null +++ b/srcpkgs/llvm22/patches/llvm-006-aarch64-mf_exec.patch @@ -0,0 +1,24 @@ +Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: + + Failing Tests (8): + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3 + +Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 + +--- a/llvm/lib/Support/Unix/Memory.inc ++++ b/llvm/lib/Support/Unix/Memory.inc +@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) { + return PROT_READ | PROT_WRITE | PROT_EXEC; + case llvm::sys::Memory::MF_EXEC: +-#if defined(__FreeBSD__) || defined(__powerpc__) ++#if defined(__FreeBSD__) || defined(__powerpc__) || (defined(__linux__) && defined(__aarch64__)) + // On PowerPC, having an executable page that has no read permission + // can have unintended consequences. The function InvalidateInstruction- + // Cache uses instructions dcbf and icbi, both of which are treated by diff --git a/srcpkgs/llvm22/patches/openmp-target-libdirs.patch b/srcpkgs/llvm22/patches/openmp-target-libdirs.patch new file mode 100644 index 00000000000000..eba5a1542f32cc --- /dev/null +++ b/srcpkgs/llvm22/patches/openmp-target-libdirs.patch @@ -0,0 +1,20 @@ +--- a/openmp/CMakeLists.txt ++++ b/openmp/CMakeLists.txt +@@ -35,7 +35,7 @@ + set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING + "Suffix of lib installation directory, e.g. 64 => lib64") + # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR. +- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}" CACHE STRING ++ set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING + "Path where built OpenMP libraries should be installed.") + + # Group test settings. +@@ -67,7 +67,7 @@ + set(OPENMP_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING + "Path where built openmp libraries should be installed.") + else() +- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING ++ set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING + "Path where built OpenMP libraries should be installed.") + endif() + diff --git a/srcpkgs/llvm22/patches/z3-libs.patch b/srcpkgs/llvm22/patches/z3-libs.patch new file mode 100644 index 00000000000000..9e61804f4b7ea6 --- /dev/null +++ b/srcpkgs/llvm22/patches/z3-libs.patch @@ -0,0 +1,21 @@ +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -583,6 +583,7 @@ if (LLVM_ENABLE_Z3_SOLVER) + if (NOT Z3_FOUND) + message(FATAL_ERROR "LLVM_ENABLE_Z3_SOLVER cannot be enabled when Z3 is not available.") + endif() ++ set(Z3_LIBRARIES z3) + + set(LLVM_WITH_Z3 1) + endif() +--- a/llvm/lib/Support/CMakeLists.txt ++++ b/llvm/lib/Support/CMakeLists.txt +@@ -86,7 +86,7 @@ endif() + + # Link Z3 if the user wants to build it. + if(LLVM_WITH_Z3) +- set(system_libs ${system_libs} ${Z3_LIBRARIES}) ++ set(system_libs ${system_libs} z3) + endif() + + # Override the C runtime allocator on Windows and embed it into LLVM tools & libraries diff --git a/srcpkgs/llvm22/template b/srcpkgs/llvm22/template new file mode 100644 index 00000000000000..3714dfc2f6819f --- /dev/null +++ b/srcpkgs/llvm22/template @@ -0,0 +1,1215 @@ +# Template file for 'llvm22' +pkgname=llvm22 +version=22.1.1 +revision=1 +build_wrksrc=llvm +build_style=cmake +_major="${version%%.*}" +_llvm_prefix=lib/llvm/${_major} +_llvm_mandir=usr/${_llvm_prefix}/share/man +_llvm_bindir=usr/${_llvm_prefix}/bin +_llvm_datadir=usr/${_llvm_prefix}/share +_llvm_incdir=usr/${_llvm_prefix}/include +_llvm_libdir=usr/${_llvm_prefix}/lib +_llvm_libexecdir=usr/${_llvm_prefix}/libexec +_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so" +configure_args=" + -DCMAKE_BUILD_TYPE=Release -Wno-dev + -DCMAKE_INSTALL_PREFIX=/usr/${_llvm_prefix} + -DENABLE_LINKER_BUILD_ID=YES + -DCOMPILER_RT_DEFAULT_TARGET_ONLY=YES + -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES + -DLIBCXXABI_USE_COMPILER_RT=YES + -DLIBCXXABI_USE_LLVM_UNWINDER=YES + -DLIBCXX_CXX_ABI=libcxxabi + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES + -DLIBCXX_USE_COMPILER_RT=YES + -DLIBOMP_ENABLE_SHARED=YES + -DLIBOMP_INSTALL_ALIASES=NO + -DOPENMP_INSTALL_LIBDIR=lib + -DOFFLOAD_INSTALL_LIBDIR=lib + -DLLVM_BUILD_DOCS=YES + -DLLVM_INCLUDE_DOCS=YES + -DLLVM_ENABLE_SPHINX=YES + -DLLVM_ENABLE_Z3_SOLVER=YES + -DSPHINX_WARNINGS_AS_ERRORS=NO + -DLLVM_INSTALL_UTILS=YES + -DLLVM_BUILD_LLVM_DYLIB=YES + -DLLVM_LINK_LLVM_DYLIB=YES + -DCLANG_LINK_CLANG_DYLIB=YES + -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang${_major} + -DLLVM_ENABLE_RTTI=YES + -DLLVM_ENABLE_FFI=YES + -DLLVM_BINUTILS_INCDIR=${XBPS_CROSS_BASE}/usr/include + -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages + -DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python${py3_ver} + -DLLDB_PYTHON_EXT_SUFFIX=$_ext_suffix + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO + -DLLVM_SPIRV=/usr/bin/llvm-spirv +" +hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx + python3-sphinx-automodapi python3-sphinx-markdown-tables python3-yaml pkg-config + python3-mdit-py-plugins python3-MyST-Parser python3-markdown-it + patchelf $(vopt_if graphviz graphviz)" +makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel + libxml2-devel binutils-devel z3-devel lua53-devel" +short_desc="LLVM Compiler Infrastructure Project - Version ${_major}" +maintainer="Duncaen " +license="Apache-2.0 AND NCSA AND custom:Apache-2.0-with-llvm-exception" +homepage="https://www.llvm.org" +distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version/rc/-rc}.tar.gz" +checksum=c48878550911a8a8993a749e6118446082656768e62b26456ac7d39c4422b409 +conflicts="llvm18>=0 llvm17>=0 llvm15>=0" +lib32disabled=yes +python_version=3 + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" llvm${_major}-cross-tools SPIRV-LLVM-Translator${_major}" +else + hostmakedepends+=" llvm${_major}-bootstrap" + # OCaml cross build is broken + hostmakedepends+=" ocaml ocaml-findlib" +fi + +build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt + openmp libc libcxx libunwind offload lto graphviz full_debug" +build_options_default="clang clang_tools_extra lld libclc polly lldb + libcxx libunwind mlir" + +case "$XBPS_TARGET_MACHINE" in + x86_64*|aarch64*|riscv64*) + build_options_default+=" bolt flang" + if [ -z "$CROSS_BUILD" ]; then + build_options_default+=" offload" + fi + ;; + armv*) + nopie=yes + configure_args+=" + -DLLVM_ENABLE_PIE=NO + -DLLDB_INCLUDE_TESTS=NO" + ;; +esac + +case "$XBPS_TARGET_MACHINE" in + armv6*) + # Don't enable openmp on armv6* + #/builddir/llvm19-19.1.0/openmp/runtime/src/kmp_platform.h:263:2: + #error Unknown or unsupported architecture + ;; + *) + build_options_default+=" openmp " + ;; +esac + +if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + _is_musl="YES" + configure_args+=" + -DLIBCXX_HAS_MUSL_LIBC=YES + -DCOMPILER_RT_BUILD_GWP_ASAN=OFF" +else + _is_musl="NO" +fi + +if [ "$build_option_lto" ]; then + configure_args+=" -DLLVM_ENABLE_LTO=ON" +fi + +if [ "$build_option_offload" ]; then + configure_args+=" + -DLLVM_RUNTIME_TARGETS=default;amdgcn-amd-amdhsa;nvptx64-nvidia-cuda + -DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=openmp + -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=openmp" +fi + +subpackages="libllvm${_major} llvm${_major}-doc llvm${_major}-devel + compiler-rt${_major}" + +if [ "$build_option_clang" ]; then + subpackages+=" clang${_major} clang${_major}-headers clang${_major}-devel + libclang${_major} libclang-cpp${_major} clang-analyzer${_major}" +fi +if [ "$build_option_clang_tools_extra" ]; then + subpackages+=" clang-tools-extra${_major}" +fi +if [ "$build_option_bolt" ]; then + subpackages+=" llvm-bolt${_major}" +fi +if [ "$build_option_lldb" ]; then + subpackages+=" lldb${_major} lldb${_major}-devel liblldb${_major}" +fi +if [ "$build_option_lld" ]; then + subpackages+=" lld${_major} lld${_major}-devel" +fi +if [ "$build_option_libclc" ]; then + subpackages+=" libclc${_major}" +fi +if [ "$build_option_mlir" ]; then + subpackages+=" mlir${_major} mlir${_major}-devel" +fi +if [ "$build_option_flang" ]; then + subpackages+=" flang${_major} flang${_major}-devel" +fi +if [ "$build_option_openmp" ]; then + subpackages+=" libomp${_major} libomp${_major}-devel" +fi +if [ "$build_option_libunwind" ]; then + subpackages+=" llvm-libunwind llvm-libunwind-devel" +fi +if [ "$build_option_libcxx" ]; then + subpackages+=" libcxx libcxxabi libcxxabi-devel libcxx-devel" +fi + +_enabled_projects="$(vopt_if clang 'clang;')\ +$(vopt_if clang_tools_extra 'clang-tools-extra;')\ +$(vopt_if bolt 'bolt;')\ +$(vopt_if polly 'polly;')\ +$(vopt_if lldb 'lldb;')\ +$(vopt_if lld 'lld;')\ +$(vopt_if mlir 'mlir;')\ +$(vopt_if flang 'flang;')" + +_enabled_runtimes="compiler-rt\ +$(vopt_if openmp ';openmp')\ +$(vopt_if offload ';offload')\ +$(vopt_if libc ';libc')\ +$(vopt_if libclc ';libclc')\ +$(vopt_if libunwind ';libunwind')\ +$(vopt_if libcxx ';libcxxabi;libcxx')" + +configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}" +configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}" + +if [ "$CROSS_BUILD" ]; then + + configure_args+=" -DLLVM_TOOLS_BINARY_DIR=/${_llvm_bindir}" + configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/${_llvm_bindir}" + + configure_args+=" -DLLVM_TABLEGEN=/${_llvm_bindir}/llvm-tblgen" + configure_args+=" -DLLVM_HEADERS_TABLEGEN=/${_llvm_bindir}/llvm-min-tblgen" + configure_args+=" -DCLANG_TABLEGEN=/${_llvm_bindir}/clang-tblgen" + configure_args+=" -DMLIR_TABLEGEN=/${_llvm_bindir}/mlir-tblgen" + configure_args+=" -DMLIR_PDLL_TABLEGEN=/${_llvm_bindir}/mlir-pdll" + configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/${_llvm_bindir}/mlir-linalg-ods-yaml-gen" + # configure_args+=" -DMLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE=/${_llvm_bindir}/mlir-src-sharder" + configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/${_llvm_bindir}/clang-tidy-confusable-chars-gen" + configure_args+=" -DLLVM_CONFIG_PATH=/${_llvm_bindir}/llvm-config" + # configure_args+=" -DLLDB_TABLEGEN_EXE=/${_llvm_bindir}/lldb-tblgen" + + # configure_args+=" -DLIBOMP_OMPD_GDB_SUPPORT=NO" + + if [ "$build_option_flang" ]; then + configure_args+=" -DLIBOMP_FORTRAN_MODULES_COMPILER=/${_llvm_bindir}/flang" + configure_args+=" -DCMAKE_Fortran_COMPILER=/${_llvm_bindir}/flang" + fi +else + # Needs lld on the target machine + configure_args+=" -DLLVM_USE_LINKER=lld" +fi + +if [ -z "$CROSS_BUILD" ]; then + subpackages+=" llvm${_major}-cross-tools" +fi + +case "$XBPS_TARGET_MACHINE" in +arm*-musl|i686-musl) + # sanitizer code is broken since it duplicates some libc bits + configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF" + configure_args+=" -DCOMPILER_RT_BUILD_XRAY=OFF" + configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=OFF" + ;; +esac + +case "$XBPS_TARGET_MACHINE" in + i686*) _arch="X86";; + x86_64*) _arch="X86";; + armv5*) _arch="Armv5te";; + armv6*) _arch="Armv6";; + armv7*) _arch="Armv7";; + aarch64*) _arch="AArch64";; + mips*) _arch="Mips";; + ppc*) _arch="PowerPC";; + riscv64*) _arch="RISCV64";; +esac + +_triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET} + +configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" +configure_args+=" -DLLVM_HOST_TRIPLE=${_triplet}" +configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${_triplet}" + +_vlink_libs() { + local _files="$1" + local _f + for _f in $DESTDIR/$_files; do + local _base=$(basename "${_f}") + ln -s "llvm/${_major}/lib/${_base}" "${DESTDIR}/usr/lib" + vmove "${_llvm_libdir}/${_base}" + vmove "usr/lib/${_base}" + done +} + +post_patch() { + # need libssp_nonshared on some musl platforms (because of nodefaultlibs) + case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + ppc*-musl|i686-musl|mips*-musl) + vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ + ${wrksrc}/libunwind/src/CMakeLists.txt + vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ + ${wrksrc}/libcxxabi/src/CMakeLists.txt + vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt + ;; + esac +} + +_setup_cross_cflags() { + CC="clang" + CXX="clang++" + + # since we use clang as target compiler and none of the + # -march flags in our cross compilers are supported by clang, + # remove them. + CFLAGS=${CFLAGS/-march=* /} + CXXFLAGS=${CXXFLAGS/-march=* /} + + CFLAGS+=" -Wno-gnu-include-next -Wno-unused-command-line-argument" + CXXFLAGS+=" -Wno-gnu-include-next -Wno-unused-command-line-argument" + + local gcc_version=$(gcc -dumpversion) + + CFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}" + CFLAGS+=" --gcc-toolchain=/usr" + # CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include" + + CXXFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}" + CXXFLAGS+=" --gcc-toolchain=/usr" + # CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}" + # CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}" + # CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward" + # CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include" +} + +_setup_build_env() { + CC="clang" + CXX="clang++" + + if [ "$CROSS_BUILD" ]; then + _setup_cross_cflags + fi + + # remove FFLAGS set by xbps-src which are not supported by flang + FFLAGS=${FFLAGS/-fstack-clash-protection/} + FFLAGS=${FFLAGS/-pipe/} + + if [ ! "$build_option_full_debug" ]; then + # Vastly reduce size of debugging symbols: + CFLAGS=${CFLAGS/ -g/ -gline-tables-only} + CXXFLAGS=${CXXFLAGS/ -g/ -gline-tables-only} + fi + + PATH="/usr/libexec/chroot-git:$PATH" +} + +pre_configure() { + if [ "$CROSS_BUILD" ]; then + cat <<-EOF >toolchain-native.cmake + set(CMAKE_C_COMPILER clang) + set(CMAKE_C_FLAGS "${XBPS_CFLAGS}" CACHE STRING "CFLAGS") + set(CMAKE_C_LINK_FLAGS "${XBPS_LDFLAGS}" CACHE STRING "LDFLAGS") + set(CMAKE_CXX_COMPILER clang++) + set(CMAKE_CXX_FLAGS "${XBPS_CXXFLAGS}" CACHE STRING "CXXFLAGS") + set(CMAKE_CXX_LINK_FLAGS "${XBPS_LDFLAGS}" CACHE STRING "LDFLAGS") + set(CMAKE_ASM_COMPILER clang) + set(CMAKE_ASM_FLAGS "${XBPS_CFLAGS}" CACHE STRING "ASM FLAGS") + set(CMAKE_EXE_LINKER_FLAGS "${XBPS_LDFLAGS}" CACHE STRING "LDFLAGS") + EOF + configure_args+=" -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${wrksrc}/${build_wrksrc}/toolchain-native.cmake'" + # configure_args+=" -DRUNTIMES_CMAKE_ARGS='-DPREPARE_BUILTINS=${wrksrc}/${build_wrksrc}/builddir_libclc_native/prepare_builtins'" + fi + _setup_build_env +} + +pre_build() { + _setup_build_env + + # if [ "$CROSS_BUILD" ]; then + # # build libclc's prepare_builtins as the cross-compilation stuff for + # # runtimes is still missing. + # cmake --fresh -G Ninja -S "${wrksrc}/libclc" -B "${wrksrc}/${build_wrksrc}/builddir_libclc_native" \ + # -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${wrksrc}/${build_wrksrc}/toolchain-native.cmake \ + # -DLLVM_CMAKE_DIR:PATH="/${_llvm_libdir}/cmake/llvm" \ + # -DLIBCLC_TARGETS_TO_BUILD="" + # ninja "${makejobs}" -C "${wrksrc}/${build_wrksrc}/builddir_libclc_native" prepare_builtins + # configure_args+=" " + # fi +} + +post_build() { + mkdir -p "${wrksrc}/${build_wrksrc}/builddir_runtimes" + cmake -G Ninja -S "${wrksrc}/runtimes" -B "${wrksrc}/${build_wrksrc}/builddir_runtimes" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_ASM_COMPILER_TARGET="${_triplet}" \ + -DCMAKE_C_COMPILER="$CC" \ + -DCMAKE_C_COMPILER_TARGET="${_triplet}" \ + -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_CXX_COMPILER_TARGET="${_triplet}" \ + -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ + -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES \ + -DLIBCXXABI_USE_COMPILER_RT=YES \ + -DLIBCXXABI_USE_LLVM_UNWINDER=YES \ + -DLIBCXX_CXX_ABI=libcxxabi \ + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES \ + -DLIBCXX_USE_COMPILER_RT=YES \ + -DLLVM_ENABLE_SPHINX=ON \ + -DLLVM_TARGET_ARCH="${_arch}" \ + -DLLVM_HOST_TRIPLE="${_triplet}" \ + -DLLVM_DEFAULT_TARGET_TRIPLE="${_triplet}" \ + -DLIBCXX_HAS_MUSL_LIBC="${_is_musl}" \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF + ninja ${makejobs} -C "${wrksrc}/${build_wrksrc}/builddir_runtimes" + ninja ${makejobs} -C "${wrksrc}/${build_wrksrc}/builddir_runtimes" docs-libcxx-html docs-libunwind-html +} + +pre_install() { + _setup_build_env +} + +post_install() { + # Required for multilib. + if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + for _header in llvm-config; do + mv ${DESTDIR}/${_llvm_incdir}/llvm/Config/${_header}{,-64}.h + vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \ + ${_llvm_incdir}/llvm/Config ${_header}.h + done + fi + + # Remove llvm-config-host in cross builds. + # XXX: needed? + if [ "$CROSS_BUILD" ]; then + rm -vf ${DESTDIR}/${_llvm_bindir}/llvm-config-host + fi + + # rm -rf ${DESTDIR}/usr/share/gdb + + if [ "$build_option_libcxx" ]; then + + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \ + -P ${wrksrc}/${build_wrksrc}/builddir_runtimes/libcxx/docs/cmake_install.cmake + + LIBCXX_DOCS=${_llvm_datadir}/doc/LLVM/libcxx + vmkdir ${LIBCXX_DOCS} + vcopy ${wrksrc}/${build_wrksrc}/builddir_runtimes/libcxx/docs/html ${LIBCXX_DOCS} + fi + + if [ "$build_option_libunwind" ]; then + + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \ + -P ${wrksrc}/${build_wrksrc}/builddir_runtimes/libunwind/docs/cmake_install.cmake + + LIBUNWIND_DOCS=${_llvm_datadir}/doc/LLVM/libunwind + vmkdir ${LIBUNWIND_DOCS} + vcopy ${wrksrc}/${build_wrksrc}/builddir_runtimes/libunwind/docs/html ${LIBUNWIND_DOCS} + fi + + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \ + -P ${wrksrc}/${build_wrksrc}/builddir_runtimes/cmake_install.cmake + + # Can this be disabled some other way? + rm -vf ${DESTDIR}/usr/lib64 + + vmkdir usr/lib/clang + ln -s "../llvm/${_major}/lib/clang/${_major}" "${DESTDIR}/usr/lib/clang/${_major}" +} + +_llvm_alts=( + bin/FileCheck share/man/man1/FileCheck.1 + bin/UnicodeNameMappingGenerator + bin/bugpoint share/man/man1/bugpoint.1 + bin/clang-installapi + bin/clang-nvlink-wrapper + bin/count + bin/dsymutil share/man/man1/dsymutil.1 + bin/intercept-build + bin/llc + bin/lli + bin/lli-child-target + bin/llvm-PerfectShuffle + bin/llvm-addr2line + bin/llvm-ar + bin/llvm-as + bin/llvm-bcanalyzer + bin/llvm-bitcode-strip + bin/llvm-c-test + bin/llvm-cat + bin/llvm-cfi-verify + bin/llvm-cgdata + bin/llvm-config + bin/llvm-cov + bin/llvm-cvtres + bin/llvm-cxxdump + bin/llvm-cxxfilt + bin/llvm-cxxmap + bin/llvm-debuginfo-analyzer + bin/llvm-debuginfod + bin/llvm-debuginfod-find + bin/llvm-diff + bin/llvm-dis + bin/llvm-dlltool + bin/llvm-dwarfdump + bin/llvm-dwarfutil + bin/llvm-dwp + bin/llvm-exegesis + bin/llvm-extract + bin/llvm-gsymutil + bin/llvm-ifs + bin/llvm-install-name-tool + bin/llvm-jitlink + bin/llvm-jitlink-executor + bin/llvm-lib + bin/llvm-libtool-darwin + bin/llvm-link + bin/llvm-lipo + bin/llvm-lto + bin/llvm-lto2 + bin/llvm-mc + bin/llvm-mca + bin/llvm-min-tblgen + bin/llvm-ml + bin/llvm-modextract + bin/llvm-mt + bin/llvm-nm + bin/llvm-objcopy + bin/llvm-objdump + bin/llvm-opt-report share/man/man1/llvm-opt-report.1 + bin/llvm-otool + bin/llvm-pdbutil + bin/llvm-profdata share/man/man1/llvm-profdata.1 + bin/llvm-profgen share/man/man1/llvm-profgen.1 + bin/llvm-ranlib share/man/man1/llvm-ranlib.1 + bin/llvm-rc + bin/llvm-readelf share/man/man1/llvm-readelf.1 + bin/llvm-readobj share/man/man1/llvm-readobj.1 + bin/llvm-readtapi + bin/llvm-reduce share/man/man1/llvm-reduce.1 + bin/llvm-remarkutil share/man/man1/llvm-remarkutil.1 + bin/llvm-rtdyld + bin/llvm-sim + bin/llvm-size share/man/man1/llvm-size.1 + bin/llvm-split + bin/llvm-stress share/man/man1/llvm-stress.1 + bin/llvm-strings share/man/man1/llvm-strings.1 + bin/llvm-strip share/man/man1/llvm-strip.1 + bin/llvm-symbolizer share/man/man1/llvm-symbolizer.1 + bin/llvm-tblgen share/man/man1/llvm-tblgen.1 + bin/llvm-tli-checker share/man/man1/llvm-tli-checker.1 + bin/llvm-undname + bin/llvm-windres + bin/llvm-xray + bin/not + bin/obj2yaml + bin/opt share/man/man1/opt.1 + bin/prepare_builtins + bin/reduce-chunk-list + bin/sancov + bin/sanstats + bin/split-file + bin/tblgen-to-irdl + bin/verify-uselistorder + bin/yaml-bench + bin/yaml2obj + share/man/man1/lit.1 + share/man/man1/llc.1 + share/man/man1/lldb-tblgen.1 + share/man/man1/lli.1 + share/man/man1/llvm-addr2line.1 + share/man/man1/llvm-ar.1 + share/man/man1/llvm-as.1 + share/man/man1/llvm-bcanalyzer.1 + share/man/man1/llvm-config.1 + share/man/man1/llvm-cov.1 + share/man/man1/llvm-cxxfilt.1 + share/man/man1/llvm-cxxmap.1 + share/man/man1/llvm-debuginfo-analyzer.1 + share/man/man1/llvm-diff.1 + share/man/man1/llvm-dis.1 + share/man/man1/llvm-dwarfdump.1 + share/man/man1/llvm-dwarfutil.1 + share/man/man1/llvm-exegesis.1 + share/man/man1/llvm-extract.1 + share/man/man1/llvm-ifs.1 + share/man/man1/llvm-install-name-tool.1 + share/man/man1/llvm-lib.1 + share/man/man1/llvm-libtool-darwin.1 + share/man/man1/llvm-link.1 + share/man/man1/llvm-lipo.1 + share/man/man1/llvm-locstats.1 + share/man/man1/llvm-mc.1 + share/man/man1/llvm-mca.1 + share/man/man1/llvm-nm.1 + share/man/man1/llvm-objcopy.1 + share/man/man1/llvm-objdump.1 + share/man/man1/llvm-otool.1 + share/man/man1/llvm-pdbutil.1 + share/man/man1/tblgen.1 +) + +alternatives=$(:) +for _alt in "${_llvm_alts[@]}"; do + alternatives+=" llvm:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" +done + +clang22_package() { + lib32disabled=yes + depends="libstdc++-devel libgcc-devel binutils + compiler-rt${_major}>=${version}_${revision}" + case "${XBPS_TARGET_MACHINE}" in + armv[67]l-musl) depends+=" musl1.1-devel" ;; + *) depends+=" ${XBPS_TARGET_LIBC}-devel" ;; + esac + conflicts="clang18>=0 clang17>=0 clang15>=0" + short_desc+=" - C language family frontend" + homepage="https://clang.llvm.org/" + _clang_files=( + bin/amdgpu-arch + bin/c-index-test + bin/clang + bin/clang++ + bin/clang-check + bin/clang-cl + bin/clang-cpp + bin/clang-extdef-mapping + bin/clang-format + bin/clang-linker-wrapper + bin/clang-offload-bundler + bin/clang-offload-packager + bin/clang-refactor + bin/clang-repl + bin/clang-scan-deps + bin/clang-sycl-linker + bin/clang-tblgen + bin/diagtool + bin/git-clang-format + bin/hmaptool + bin/nvptx-arch + bin/offload-arch + lib/LLVMgold.so + share/man/man1/clang-tblgen.1 + share/man/man1/clang.1 + share/man/man1/diagtool.1 + ) + + alternatives=$(:) + for _alt in "${_clang_files[@]}"; do + alternatives+=" clang:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + + if [ "$build_option_polly" ]; then + alternatives+=" + clang:/usr/lib/LLVMPolly.so:/${_llvm_libdir}/LLVMPolly.so + clang:/usr/share/man/man1/polly.1:/${_llvm_mandir}/man1/polly1.1 + " + fi + pkg_install() { + vlicense "${wrksrc}/clang/LICENSE.TXT" + + vmove "usr/${_llvm_prefix}/bin/clang-${_major}" + + vmkdir usr/bin + for _bin in clang clang++ clang-cpp clang-cl clang-scan-deps; do + ln -rs "${PKGDESTDIR}/usr/${_llvm_prefix}/bin/${_bin}" "${PKGDESTDIR}/usr/bin/${_bin}-${_major}" + done + + for _bin in "${_clang_files[@]}"; do + vmove usr/${_llvm_prefix}/${_bin} + done + + if [ "$build_option_polly" ]; then + vmove ${_llvm_libdir}/LLVMPolly.so + vmove ${_llvm_mandir}/man1/polly.1 + fi + } +} + +clang22-headers_package() { + lib32disabled=yes + short_desc+=" - C language family frontend - Headers" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove "${_llvm_libdir}/clang/${_major}/include" + vmove "${_llvm_incdir}/c++" + vmove "${_llvm_datadir}/libc++" + vmove usr/lib/clang + } +} + +clang22-devel_package() { + lib32disabled=yes + depends="libstdc++-devel libgcc-devel binutils + clang${_major}>=${version}_${revision} + clang-analyzer${_major}>=${version}_${revision} + llvm${_major}>=${version}_${revision}" + case "${XBPS_TARGET_MACHINE}" in + armv[67]l-musl) depends+=" musl1.1-devel" ;; + *) depends+=" ${XBPS_TARGET_LIBC}-devel" ;; + esac + conflicts="clang18-devel clang17-devel clang15-devel" + if [ "$build_option_clang_tools_extra" ]; then + depends+=" clang-tools-extra${_major}>=${version}_${revision}" + fi + short_desc+=" - C language family frontend - development Files" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove ${_llvm_incdir}/clang + vmove ${_llvm_incdir}/clang-c + vmove ${_llvm_libdir}/libear + vmove ${_llvm_libdir}/cmake/clang + vmove "${_llvm_libdir}/libclang*.a" + vmove "${_llvm_libdir}/libclang*.so" + vmove ${_llvm_datadir}/clang + if [ "$build_option_clang_tools_extra" ]; then + vmove ${_llvm_incdir}/clang-tidy + vmove ${_llvm_libdir}/libfindAllSymbols.a + fi + if [ "$build_option_polly" ]; then + vmove ${_llvm_incdir}/polly + vmove ${_llvm_libdir}/cmake/polly + vmove "${_llvm_libdir}/libPolly*.a" + fi + } +} + +libclang22_package() { + depends="clang${_major}-headers>=${version}_${revision}" + short_desc+=" - C frontend library" + pkg_install() { + _vlink_libs "${_llvm_libdir}/libclang.so.*" + } +} + +libclang-cpp22_package() { + depends="clang${_major}-headers>=${version}_${revision}" + short_desc+=" - C frontend library (C++ interface)" + pkg_install() { + _vlink_libs "${_llvm_libdir}/libclang-cpp.so.*" + } +} + +clang-analyzer22_package() { + depends="clang${_major}>=${version}_${revision} python3 perl" + conflicts="clang-analyzer18>=0 clang-analyzer17>=0 clang-analyzer15>=0" + short_desc+=" - A source code analysis framework" + homepage="https://clang-analyzer.llvm.org/" + pycompile_dirs="${_llvm_datadir}/scan-view" + _clang_analyzer_files=( + share/scan-view + share/scan-build + lib/libscanbuild + libexec/analyze-c++ + libexec/analyze-cc + libexec/intercept-c++ + libexec/intercept-cc + libexec/c++-analyzer + libexec/ccc-analyzer + share/man/man1/scan-build.1 + bin/analyze-build + bin/scan-build + bin/scan-build-py + bin/scan-view + ) + alternatives=$(:) + for _alt in "${_clang_analyzer_files[@]}"; do + alternatives+=" clang-analyzer:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + for _f in "${_clang_analyzer_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + } +} + +clang-tools-extra22_package() { + lib32disabled=yes + depends="clang${_major}>=${version}_${revision} python3" + conflicts="clang-tools-extra18>=0 clang-tools-extra17>=0 clang-tools-extra15>=0" + short_desc+=" - Extra Clang tools" + homepage="https://clang.llvm.org/extra/" + _clang_tools_extra_files=( + bin/clang-apply-replacements + bin/clang-change-namespace + bin/clang-doc + bin/clang-include-cleaner + bin/clang-include-fixer + bin/clang-move + bin/clang-query + bin/clang-reorder-fields + bin/clang-tidy + bin/clangd + bin/find-all-symbols + bin/modularize + bin/pp-trace + bin/run-clang-tidy + share/man/man1/extraclangtools.1 + ) + + alternatives=$(:) + for _alt in "${_clang_tools_extra_files[@]}"; do + alternatives+=" clang-tools-extra:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + vlicense ${wrksrc}/clang-tools-extra/LICENSE.TXT + for _f in "${_clang_tools_extra_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + } +} + +# "bolt" package name is already used +llvm-bolt22_package() { + lib32disabled=yes + depends="clang${_major}>=${version}_${revision}" + conflicts="llvm-bolt18>=0 llvm-bolt17>=0" + short_desc+=" - post-link optimizer" + homepage="https://github.com/llvm/llvm-project/tree/main/bolt" + _llvm_bolt_files=( + bin/llvm-bolt + bin/llvm-bolt-binary-analysis + bin/llvm-bolt-heatmap + bin/llvm-boltdiff + bin/merge-fdata + bin/perf2bolt + ) + alternatives=$(:) + for _alt in "${_llvm_bolt_files[@]}"; do + alternatives+=" llvm-bolt:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + vlicense ${wrksrc}/bolt/LICENSE.TXT + for _f in "${_llvm_bolt_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + if [ -z "$CROSS_BUILD" ]; then + vmove ${_llvm_libdir}/libbolt_rt_instr.a + vmove ${_llvm_libdir}/libbolt_rt_hugify.a + fi + } +} + +lldb22_package() { + lib32disabled=yes + depends+=" python3-six" + conflicts="lldb18>=0 lldb17>=0 lldb15>=0" + short_desc+=" - LLDB debugger" + homepage="https://lldb.llvm.org/" + _lldb_files=( + bin/lldb + bin/lldb-argdumper + bin/lldb-dap + bin/lldb-instr + bin/lldb-mcp + bin/lldb-server + lib/python${py3_ver}/site-packages/lldb + ) + if [ -z "$CROSS_BUILD" ]; then + _lldb_files+=("lib/lua/5.3/lldb.so") + fi + alternatives=$(:) + for _alt in "${_lldb_files[@]}"; do + alternatives+=" lldb:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + vlicense "${wrksrc}/lldb/LICENSE.TXT" + for _f in "${_lldb_files[@]}"; do + vmove "usr/${_llvm_prefix}/${_f}" + done + } +} + +lldb22-devel_package() { + lib32disabled=yes + depends="lldb${_major}>=${version}_${revision}" + conflicts="lldb18-devel>=0 lldb17-devel>=0 lldb15-devel>=0" + short_desc+=" - LLDB debugger - development files" + pkg_install() { + vmove "${_llvm_incdir}/lldb" + vmove "${_llvm_libdir}/liblldb*.so" + } +} + +liblldb22_package() { + lib32disabled=yes + short_desc+=" - LLDB debugger - runtime library" + pkg_install() { + _vlink_libs "${_llvm_libdir}/liblldb*.so.*" + } +} + +lld22_package() { + lib32disabled=yes + conflicts="lld18>=0 lld17>=0 lld15>=0" + short_desc+=" - linker" + homepage="https://lld.llvm.org" + _lld_files=( + bin/lld + bin/lld-link + bin/ld.lld + bin/ld64.lld + bin/wasm-ld + ) + alternatives=$(:) + for _alt in "${_lld_files[@]}"; do + alternatives+=" lld:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + vlicense ${wrksrc}/lld/LICENSE.TXT + vmkdir usr/bin + for _bin in ld.lld ld64.lld lld lld-link wasm-ld; do + ln -rs "${PKGDESTDIR}/usr/${_llvm_prefix}/bin/${_bin}" "${PKGDESTDIR}/usr/bin/${_bin}-${_major}" + done + for _f in "${_lld_files[@]}"; do + vmove "usr/${_llvm_prefix}/${_f}" + done + } +} + +lld22-devel_package() { + lib32disabled=yes + depends="lld${_major}>=${version}_${revision} llvm${_major}>=${version}_${revision}" + conflicts="lld18-devel>=0 lld17-devel>=0 lld15-devel>=0" + short_desc+=" - linker - development files" + homepage="https://lld.llvm.org" + pkg_install() { + vmove "${_llvm_incdir}/lld" + vmove "${_llvm_libdir}/cmake/lld" + vmove "${_llvm_libdir}/liblld*.a" + } +} + +mlir22_package() { + lib32disabled=yes + short_desc+=" - multi-level IR compiler framework" + homepage="https://mlir.llvm.org/" + _mlir_files=( + bin/mlir-cat + bin/mlir-linalg-ods-yaml-gen + bin/mlir-lsp-server + bin/mlir-minimal-opt + bin/mlir-minimal-opt-canonicalize + bin/mlir-opt + bin/mlir-pdll + bin/mlir-pdll-lsp-server + bin/mlir-query + bin/mlir-reduce + bin/mlir-rewrite + bin/mlir-runner + bin/mlir-tblgen + bin/mlir-transform-opt + bin/mlir-translate + bin/tblgen-lsp-server + share/man/man1/mlir-tblgen.1 + ) + alternatives=$(:) + for _alt in "${_mlir_files[@]}"; do + alternatives+=" mlir:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + for _f in "${_mlir_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + _vlink_libs "${_llvm_libdir}/libMLIR*.so.*" + _vlink_libs "${_llvm_libdir}/libmlir*.so.*" + } +} + +mlir22-devel_package() { + lib32disabled=yes + depends="mlir${_major}>=${version}_${revision} llvm${_major}>=${version}_${revision}" + conflicts="mlir18-devel>=0 mlir17-devel>=0" + short_desc+=" - multi-level IR compiler framework - development files" + homepage="https://mlir.llvm.org/" + pkg_install() { + vmove "${_llvm_incdir}/mlir" + vmove "${_llvm_incdir}/mlir-c" + vmove "${_llvm_libdir}/cmake/mlir" + vmove "${_llvm_libdir}/libMLIR*" + vmove "${_llvm_libdir}/libmlir*" + vmove "${_llvm_libdir}/objects-Release/obj.MLIR*" + } +} + +flang22_package() { + lib32disabled=yes + depends="mlir${_major}>=${version}_${revision}" + conflicts="flang18>=0 flang17>=0" + short_desc+=" - Fortran language frontend" + homepage="https://flang.llvm.org/" + _flang_files=( + bin/bbc + bin/f18-parse-demo + bin/fir-lsp-server + bin/fir-opt + bin/flang + bin/flang-new + bin/tco + ) + alternatives=$(:) + for _alt in "${_flang_files[@]}"; do + alternatives+=" flang:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + vmove "usr/${_llvm_prefix}/bin/flang-${_major}" + + vmkdir usr/bin + for _bin in flang bbc tco fir-opt f18-parse-demo; do + ln -rs "${PKGDESTDIR}/usr/${_llvm_prefix}/bin/${_bin}" "${PKGDESTDIR}/usr/bin/${_bin}-${_major}" + done + + for _f in "${_flang_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + vmove "${_llvm_libdir}/libflang*.a" + vmove "${_llvm_libdir}/libFortran*.a" + vmove "${_llvm_incdir}/flang/*.mod" + vmove "${_llvm_incdir}/flang-rt" + } +} + +flang22-devel_package() { + lib32disabled=yes + depends="flang${_major}>=${version}_${revision} llvm${_major}>=${version}_${revision}" + conflicts="flang18-devel>=0 flang17-devel>=0" + short_desc+=" - Fortran language frontend - development files" + homepage="https://flang.llvm.org/" + pkg_install() { + vmove "${_llvm_incdir}/flang" + vmove "${_llvm_libdir}/cmake/flang" + vmove "${_llvm_libdir}/libFIR*.a" + vmove "${_llvm_libdir}/libHLFIR*.a" + vmove "${_llvm_libdir}/libCUF*.a" + } +} + +libomp22_package() { + short_desc+=" - Clang OpenMP support library" + conflicts="libomp18>=0 libomp17>=0" + _libomp_files=( + lib/libomp.so + ) + case "$XBPS_TARGET_MACHINE" in + x86_64*|aarch64*|riscv64*) + _libomp_files+=("lib/libompd.so") + ;; + esac + if [ "$build_option_offload" ]; then + _libomp_files+=("bin/llvm-offload-device-info") + _libomp_files+=("bin/llvm-omp-kernel-replay") + _libomp_files+=("lib/libomptarget.so") + fi + alternatives=$(:) + for _alt in "${_libomp_files[@]}"; do + alternatives+=" libomp:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + for _f in "${_libomp_files[@]}"; do + vmove usr/${_llvm_prefix}/${_f} + done + if [ "$build_option_offload" ]; then + _vlink_libs "${_llvm_libdir}/libomp*.so*" + vmove "${_llvm_libdir}/libLLVMOffload.so.*" + fi + } +} + +libomp22-devel_package() { + short_desc+=" - Clang OpenMP support library - development files" + depends="libomp${_major}>=${version}_${revision}" + conflicts="libomp18-devel>=0 libomp17-devel>=0" + nostrip_files=" + /${_llvm_libdir}/amdgcn-amd-amdhsa/libompdevice.a + /${_llvm_libdir}/nvptx64-nvidia-cuda/libompdevice.a" + pkg_install() { + if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher.so" ]; then + vmove "${_llvm_libdir}/libarcher*.so" + fi + if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher_static.a" ]; then + vmove "${_llvm_libdir}/libarcher*.a" + fi + vmove "${_llvm_libdir}/cmake/openmp" + if [ "$build_option_offload" ]; then + vmove "${_llvm_incdir}/offload" + vmove "${_llvm_libdir}/amdgcn-amd-amdhsa/libompdevice.a" + vmove "${_llvm_libdir}/amdgcn-amd-amdhsa/libomptarget-amdgpu.bc" + vmove "${_llvm_libdir}/libLLVMOffload.so" + vmove "${_llvm_libdir}/nvptx64-nvidia-cuda/libompdevice.a" + vmove "${_llvm_libdir}/nvptx64-nvidia-cuda/libomptarget-nvptx.bc" + vmove "${_llvm_datadir}/gdb/python/ompd" + fi + } +} + +llvm-libunwind_package() { + short_desc+=" - libunwind" + pkg_install() { + vmove "usr/lib/libunwind.so.*" + } +} + +llvm-libunwind-devel_package() { + short_desc+=" - libunwind - development files" + depends="llvm-libunwind>=${version}_${revision}" + conflicts="libunwind-devel>=0" + pkg_install() { + vmove "usr/include/__libunwind_config.h" + vmove "usr/include/libunwind.h" + vmove "usr/include/libunwind.modulemap" + vmove "usr/include/mach-o/compact_unwind_encoding.h" + vmove "usr/include/unwind*.h" + vmove "usr/lib/libunwind.a" + vmove "usr/lib/libunwind.so" + } +} + +libcxxabi_package() { + short_desc+=" - low level support for libc++" + pkg_install() { + vmove "usr/lib/libc++abi.so.*" + } +} + +libcxxabi-devel_package() { + short_desc+=" - low level support for libc++ - development files" + depends="libcxxabi>=${version}_${revision}" + pkg_install() { + vmove "usr/include/c++/v1/__cxxabi_config.h" + vmove "usr/include/c++/v1/cxxabi.h" + vmove "usr/lib/libc++abi.a" + vmove "usr/lib/libc++abi.so" + } +} + +libcxx_package() { + short_desc+=" - C++ standard library" + pkg_install() { + vmove "usr/lib/libc++.so.*" + } +} + +libcxx-devel_package() { + short_desc+=" - C++ standard library - development files" + depends="libcxx>=${version}_${revision}" + pkg_install() { + vmove "usr/include/c++" + vmove "usr/lib/libc++.a" + vmove "usr/lib/libc++.modules.json" + vmove "usr/lib/libc++.so" + vmove "usr/lib/libc++experimental.a" + vmove "usr/share/libc++" + } +} + +compiler-rt22_package() { + short_desc+=" - runtime libraries" + depends="clang${_major}-headers>=${version}_${revision}" + noshlibprovides=yes + noverifyrdeps=yes + homepage="https://compiler-rt.llvm.org/" + pkg_install() { + vmove "${_llvm_libdir}/clang/${_major}/lib/linux" + if [ "$build_option_flang" ]; then + vmove "${_llvm_libdir}/clang/${_major}/lib/*-linux-*/libflang_rt.runtime.a" + fi + # the following files are only available for architectures that + # support sanitizers. + if [ -d "${DESTDIR}/${_llvm_libdir}/clang/${_major}/bin" ]; then + vmove "${_llvm_libdir}/clang/${_major}/bin" + fi + if [ -d "${DESTDIR}/${_llvm_libdir}/clang/${_major}/share" ]; then + vmove "${_llvm_libdir}/clang/${_major}/share" + fi + } +} + +libllvm22_package() { + short_desc+=" - library" + pkg_install() { + _vlink_libs "${_llvm_libdir}/libLLVM-*.so" + _vlink_libs "${_llvm_libdir}/libLLVM.so.*" + vmove "${_llvm_libdir}/libLTO.so.*" + vmove "${_llvm_libdir}/libRemarks.so.*" + } +} + +llvm22-devel_package() { + depends="llvm${_major}>=${version}_${revision}" + conflicts="llvm18-devel>=0 llvm17-devel>=0 llvm15-devel>=0" + short_desc+=" - development files" + if [ "$build_option_openmp" ]; then + depends+=" libomp${_major}-devel>=${version}_${revision} " + fi + if [ "$build_option_mlir" ]; then + depends+=" mlir${_major}-devel>=${version}_${revision} " + fi + if [ "$build_option_clang" ]; then + depends+=" clang${_major}-devel>=${version}_${revision} " + fi + pkg_install() { + vmove "${_llvm_incdir}/llvm" + vmove "${_llvm_incdir}/llvm-c" + vmove "${_llvm_libdir}/cmake/llvm" + vmove "${_llvm_libdir}/libLLVM*.a" + vmove "${_llvm_libdir}/libLLVM.so" + vmove "${_llvm_libdir}/libLTO.so" + vmove "${_llvm_libdir}/libRemarks.so" + } +} + +llvm22-doc_package() { + short_desc+=" - documentation" + pkg_install() { + vmove "${_llvm_datadir}/doc" + vmove "${_llvm_datadir}/clang-doc" + } +} + +# These binaries are ONLY used when building llvm, they aren't normally installed +llvm22-cross-tools_package() { + conflicts="llvm18-cross-tools>=0 llvm17-cross-tools>=0" + short_desc+=" - build tools for cross compiling LLVM" + depends="llvm${_major}-devel>=${version}_${revision}" + if [ "$build_option_lldb" ]; then + depends+=" lldb${_major}-devel>=${version}_${revision}" + fi + if [ "$build_option_lld" ]; then + depends+=" lld${_major}-devel>=${version}_${revision}" + fi + if [ "$build_option_flang" ]; then + depends+=" flang${_major}-devel>=${version}_${revision}" + fi + pkg_install() { + # Binaries ONLY used during the process of building llvm, and aren't usually installed + vmkdir "${_llvm_bindir}" + vcopy build/bin/clang-tidy-confusable-chars-gen "${_llvm_bindir}" + if [ "$build_option_mlir" ]; then + vcopy build/bin/mlir-src-sharder "${_llvm_bindir}" + fi + } +} + +libclc22_package() { + short_desc+=" - Open implementation of the OpenCL C programming language" + replaces="libclc-git>=0" + _libclc_files=( + lib/clang/${_major}/lib/libclc + share/pkgconfig/libclc.pc + ) + alternatives=$(:) + for _alt in "${_libclc_files[@]}"; do + alternatives+=" libclc:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}" + done + pkg_install() { + for _f in "${_libclc_files[@]}"; do + vmove "usr/${_llvm_prefix}/${_f}" + done + } +} diff --git a/srcpkgs/llvm22/update b/srcpkgs/llvm22/update new file mode 100644 index 00000000000000..21c281eb186761 --- /dev/null +++ b/srcpkgs/llvm22/update @@ -0,0 +1,3 @@ +site="https://github.com/llvm/llvm-project/releases" +pattern="llvmorg-\K(19)\.(\d+)\.+\d+(-rc\d+)?" +ignore="*-rc*" diff --git a/srcpkgs/mlir22 b/srcpkgs/mlir22 new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/mlir22 @@ -0,0 +1 @@ +llvm22 \ No newline at end of file diff --git a/srcpkgs/mlir22-devel b/srcpkgs/mlir22-devel new file mode 120000 index 00000000000000..0a2a1ce95a3d91 --- /dev/null +++ b/srcpkgs/mlir22-devel @@ -0,0 +1 @@ +llvm22 \ No newline at end of file From 36d2826581db4dae014b317b9cdf81f4c3a017d6 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 19 Mar 2026 23:55:59 +0100 Subject: [PATCH 2/5] New package: llvm22-bootstrap-22.1.1 --- srcpkgs/llvm22-bootstrap/patches | 1 + srcpkgs/llvm22-bootstrap/template | 76 +++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 120000 srcpkgs/llvm22-bootstrap/patches create mode 100644 srcpkgs/llvm22-bootstrap/template diff --git a/srcpkgs/llvm22-bootstrap/patches b/srcpkgs/llvm22-bootstrap/patches new file mode 120000 index 00000000000000..59ca5c3d99e2c0 --- /dev/null +++ b/srcpkgs/llvm22-bootstrap/patches @@ -0,0 +1 @@ +../llvm21/patches \ No newline at end of file diff --git a/srcpkgs/llvm22-bootstrap/template b/srcpkgs/llvm22-bootstrap/template new file mode 100644 index 00000000000000..af406e41555f50 --- /dev/null +++ b/srcpkgs/llvm22-bootstrap/template @@ -0,0 +1,76 @@ +# Template file for 'llvm22-bootstrap' +pkgname=llvm22-bootstrap +version=22.1.1 +revision=1 +_spirv_version=v22.1.0 +build_wrksrc=llvm +build_style=cmake +configure_args=" + -DCMAKE_BUILD_TYPE=Release -Wno-dev + -DENABLE_LINKER_BUILD_ID=YES + -DLLVM_INSTALL_UTILS=YES + -DLLVM_BINUTILS_INCDIR=/usr/include + -DBASE_LLVM_VERSION=${version} + -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO + -DLLVM_TARGETS_TO_BUILD=Native + -DLLVM_ENABLE_PROJECTS=clang;lld +" +hostmakedepends="perl python3 pkg-config" +makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel + libxml2-devel binutils-devel z3-devel SPIRV-Headers SPIRV-Tools-devel" +short_desc="LLVM Compiler Infrastructure Project - Version ${_major}" +maintainer="Duncaen " +license="Apache-2.0 AND NCSA AND custom:Apache-2.0-with-llvm-exception" +homepage="https://www.llvm.org" +distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version/rc/-rc}.tar.gz + https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/${_spirv_version}.tar.gz" +checksum="c48878550911a8a8993a749e6118446082656768e62b26456ac7d39c4422b409 + a5d476404ab88ac0d148211da50428178c89caef8af8042a3ca8e71e58ed9427" + +skip_extraction=${_spirv_version}.tar.gz + +conflicts="llvm22>=0 llvm21>=0 llvm19>=0 llvm18>=0 llvm17>=0 llvm15>=0" + +lib32disabled=yes +python_version=3 +nodebug=yes +repository=bootstrap +nocross="bootstrap package" + +# fails to build with libquadmth on musl +case "$XBPS_TARGET_MACHINE" in + x86_64|i686) makedepends+=" libquadmath-devel" ;; +esac + +if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES + -DCOMPILER_RT_BUILD_GWP_ASAN=OFF" +fi + +case "$XBPS_TARGET_MACHINE" in + i686*) _arch="X86";; + x86_64*) _arch="X86";; + armv5*) _arch="Armv5te";; + armv6*) _arch="Armv6";; + armv7*) _arch="Armv7";; + aarch64*) _arch="AArch64";; + mips*) _arch="Mips";; + ppc*) _arch="PowerPC";; + riscv64*) _arch="RISCV64";; +esac + +configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" + +pre_configure() { + configure_args+=" -DLLVM_HOST_TRIPLE=$($CC -dumpmachine)" + configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=$($CXX -dumpmachine)" +} + +post_extract() { + vsrcextract -C llvm/projects/llvm-spirv "${_spirv_version}.tar.gz" +} + +post_install() { + vlicense "${wrksrc}/LICENSE.TXT" +} From 3c8020d873cb87b1df21b981293fa7cc6a4f8e00 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 19 Mar 2026 23:56:23 +0100 Subject: [PATCH 3/5] New package: SPIRV-LLVM-Translator22-22.1.0 --- srcpkgs/SPIRV-LLVM-Translator22-devel | 1 + srcpkgs/SPIRV-LLVM-Translator22/template | 40 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 120000 srcpkgs/SPIRV-LLVM-Translator22-devel create mode 100644 srcpkgs/SPIRV-LLVM-Translator22/template diff --git a/srcpkgs/SPIRV-LLVM-Translator22-devel b/srcpkgs/SPIRV-LLVM-Translator22-devel new file mode 120000 index 00000000000000..98524dcb4ff479 --- /dev/null +++ b/srcpkgs/SPIRV-LLVM-Translator22-devel @@ -0,0 +1 @@ +SPIRV-LLVM-Translator22 \ No newline at end of file diff --git a/srcpkgs/SPIRV-LLVM-Translator22/template b/srcpkgs/SPIRV-LLVM-Translator22/template new file mode 100644 index 00000000000000..c55dc9e4aec710 --- /dev/null +++ b/srcpkgs/SPIRV-LLVM-Translator22/template @@ -0,0 +1,40 @@ +# Template file for 'SPIRV-LLVM-Translator22' +pkgname=SPIRV-LLVM-Translator22 +version=22.1.0 +revision=1 +_llvm_ver=${version%%.*} +build_style=cmake +configure_args=" + -DBUILD_SHARED_LIBS=ON + -DCMAKE_PREFIX_PATH=${XBPS_CROSS_BASE}/usr/lib/llvm/${_llvm_ver} + -DCMAKE_SKIP_RPATH=ON + -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_SPIRV_INCLUDE_TESTS=OFF +" +hostmakedepends="clang${_llvm_ver} llvm${_llvm_ver} pkg-config" +makedepends="llvm${_llvm_ver}-devel SPIRV-Headers SPIRV-Tools-devel" +short_desc="API and commands for processing SPIR-V modules - LLVM ${_llvm_ver}" +maintainer="Duncaen " +license="NCSA" +homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator" +distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz" +checksum=a5d476404ab88ac0d148211da50428178c89caef8af8042a3ca8e71e58ed9427 + +alternatives="llvm-spirv:llvm-spirv:/usr/bin/llvm-spirv-${_llvm_ver}" + +post_install() { + mv ${DESTDIR}/usr/bin/llvm-spirv ${DESTDIR}/usr/bin/llvm-spirv-${_llvm_ver} + vlicense LICENSE.TXT +} + +SPIRV-LLVM-Translator22-devel_package() { + depends="SPIRV-LLVM-Translator${_llvm_ver}-${version}_${revision}" + conflicts="SPIRV-LLVM-Translator-devel>=0" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/lib/pkgconfig + vmove "usr/lib/*.so" + } +} From e415333fd1df75b36aa4f1283cc3bcad2a793961 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 19 Mar 2026 23:56:29 +0100 Subject: [PATCH 4/5] SPIRV-Tools: update to 2026.1. --- srcpkgs/SPIRV-Tools/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template index d722ac2a53fa99..9c0bc273a56ec0 100644 --- a/srcpkgs/SPIRV-Tools/template +++ b/srcpkgs/SPIRV-Tools/template @@ -1,6 +1,6 @@ # Template file for 'SPIRV-Tools' pkgname=SPIRV-Tools -version=2025.4 +version=2026.1 revision=1 build_style=cmake configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF @@ -13,7 +13,7 @@ license="Apache-2.0" homepage="https://github.com/KhronosGroup/SPIRV-Tools" changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES" distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v${version}.rc1.tar.gz" -checksum=721b29e33729f220bb8deffa23681e32304a1ef3f4b057d004ef49ac6a473559 +checksum=41337dbdd090bc4b38bda41dbe6d0b569ad3f7b1d63e173c2ce0639cda58be80 LDFLAGS="-Wl,--no-undefined" SPIRV-Tools-devel_package() { From d6a720697f0980de0120ff83136352eda304e515 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 19 Mar 2026 23:56:32 +0100 Subject: [PATCH 5/5] SPIRV-Headers: update to 1.4.341.0. --- srcpkgs/SPIRV-Headers/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template index 30b7624ea86827..d1eed53738ad4a 100644 --- a/srcpkgs/SPIRV-Headers/template +++ b/srcpkgs/SPIRV-Headers/template @@ -1,7 +1,7 @@ # Template file for 'SPIRV-Headers' pkgname=SPIRV-Headers reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1" -version=1.4.328.1 +version=1.4.341.0 revision=1 build_style=cmake short_desc="Machine-readable files for the SPIR-V Registry" @@ -9,7 +9,7 @@ maintainer="Daniel Martinez " license="MIT" homepage="https://github.com/KhronosGroup/SPIRV-Headers" distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/vulkan-sdk-${version}.tar.gz" -checksum=602364ab7bf404a7f352df7da5c645f1c4558a9c92616f8ee33422b04d5e35b7 +checksum=cab0a654c4917e16367483296b44cdb1d614e3120c721beafcd37e3a8580486c post_install() { vlicense LICENSE