Github messages for voidlinux
 help / color / mirror / Atom feed
From: Calandracas606 <Calandracas606@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [WIP] New package: llvm19-19.1.0
Date: Fri, 08 Nov 2024 04:36:46 +0100	[thread overview]
Message-ID: <20241108033646.6D3B823941@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-51527@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm19
https://github.com/void-linux/void-packages/pull/51527

[WIP] New package: llvm19-19.1.0
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **NO**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):

  - [x] x86_64 
  - [x] x86_64-musl
  - [x] i686
  - [x] aarch64 (cross)
  - [x] aarch64-musl (cross)
  - [x] armv7l (cross)
  - [x] armv7l-musl (cross)
  - [x] armv6l (cross)
  - [x] armv6l-musl (cross)

[ci skip]


A patch file from https://github.com/void-linux/void-packages/pull/51527.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm19-51527.patch --]
[-- Type: text/x-diff, Size: 77144 bytes --]

From 928d12dead450002d0f39b1a15180945c27afbf0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 29 Jul 2024 08:58:45 -0400
Subject: [PATCH 1/2] New package: llvm19-19.1.0

---
 common/shlibs                                 |    4 +
 srcpkgs/SPIRV-LLVM-Translator19               |    1 +
 srcpkgs/SPIRV-LLVM-Translator19-devel         |    1 +
 srcpkgs/clang-analyzer19                      |    1 +
 srcpkgs/clang-tools-extra19                   |    1 +
 srcpkgs/clang19                               |    1 +
 srcpkgs/clang19-devel                         |    1 +
 srcpkgs/clang19-headers                       |    1 +
 srcpkgs/compiler-rt19                         |    1 +
 srcpkgs/flang19                               |    1 +
 srcpkgs/flang19-devel                         |    1 +
 srcpkgs/libclang-cpp19                        |    1 +
 srcpkgs/libclang19                            |    1 +
 srcpkgs/libclc19                              |    1 +
 srcpkgs/libcxx                                |    2 +-
 srcpkgs/libcxx-devel                          |    2 +-
 srcpkgs/libcxxabi                             |    2 +-
 srcpkgs/libcxxabi-devel                       |    2 +-
 srcpkgs/liblldb19                             |    1 +
 srcpkgs/libllvm19                             |    1 +
 srcpkgs/libomp19                              |    1 +
 srcpkgs/libomp19-devel                        |    1 +
 srcpkgs/lld19                                 |    1 +
 srcpkgs/lld19-devel                           |    1 +
 srcpkgs/lldb-devel18                          |    1 -
 srcpkgs/lldb19                                |    1 +
 srcpkgs/lldb19-devel                          |    1 +
 srcpkgs/llvm-bolt19                           |    1 +
 srcpkgs/llvm-libunwind                        |    2 +-
 srcpkgs/llvm-libunwind-devel                  |    2 +-
 srcpkgs/llvm-libunwind-devel18                |    1 -
 srcpkgs/llvm-libunwind18                      |    1 -
 srcpkgs/llvm18/template                       |   57 +-
 srcpkgs/llvm19-cross-tools                    |    1 +
 srcpkgs/llvm19-devel                          |    1 +
 srcpkgs/llvm19-doc                            |    1 +
 .../llvm19/files/llvm-Config-llvm-config.h    |    9 +
 srcpkgs/llvm19/patches/SmallVector.patch      |   13 +
 ...s-set-a-larger-stack-size-explicitly.patch |   37 +
 ...clang-001-fix-unwind-chain-inclusion.patch |   44 +
 .../clang-003-ppc64-dynamic-linker-path.patch |   13 +
 .../compiler-rt-sanitizer-ppc64-musl.patch    |   37 +
 .../llvm19/patches/disable-lldb-docs.patch    |   18 +
 srcpkgs/llvm19/patches/flang-cross.patch      |   28 +
 .../llvm19/patches/flang-musl-bessel.patch    |   69 +
 srcpkgs/llvm19/patches/libcxx-armv67.patch    |   35 +
 srcpkgs/llvm19/patches/libcxx-musl.patch      |   26 +
 .../llvm19/patches/libcxx-ssp-nonshared.patch |   11 +
 srcpkgs/llvm19/patches/libcxxabi-dl.patch     |   25 +
 srcpkgs/llvm19/patches/llvm-001-musl.patch    |   32 +
 .../patches/llvm-004-override-opt.patch       |   18 +
 .../llvm19/patches/llvm-005-ppc-bigpic.patch  |   36 +
 .../patches/llvm-006-aarch64-mf_exec.patch    |   24 +
 srcpkgs/llvm19/template                       | 1110 +++++++++++++++++
 srcpkgs/llvm19/update                         |    3 +
 srcpkgs/mlir19                                |    1 +
 srcpkgs/mlir19-devel                          |    1 +
 57 files changed, 1658 insertions(+), 33 deletions(-)
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator19
 create mode 120000 srcpkgs/SPIRV-LLVM-Translator19-devel
 create mode 120000 srcpkgs/clang-analyzer19
 create mode 120000 srcpkgs/clang-tools-extra19
 create mode 120000 srcpkgs/clang19
 create mode 120000 srcpkgs/clang19-devel
 create mode 120000 srcpkgs/clang19-headers
 create mode 120000 srcpkgs/compiler-rt19
 create mode 120000 srcpkgs/flang19
 create mode 120000 srcpkgs/flang19-devel
 create mode 120000 srcpkgs/libclang-cpp19
 create mode 120000 srcpkgs/libclang19
 create mode 120000 srcpkgs/libclc19
 create mode 120000 srcpkgs/liblldb19
 create mode 120000 srcpkgs/libllvm19
 create mode 120000 srcpkgs/libomp19
 create mode 120000 srcpkgs/libomp19-devel
 create mode 120000 srcpkgs/lld19
 create mode 120000 srcpkgs/lld19-devel
 delete mode 120000 srcpkgs/lldb-devel18
 create mode 120000 srcpkgs/lldb19
 create mode 120000 srcpkgs/lldb19-devel
 create mode 120000 srcpkgs/llvm-bolt19
 delete mode 120000 srcpkgs/llvm-libunwind-devel18
 delete mode 120000 srcpkgs/llvm-libunwind18
 create mode 120000 srcpkgs/llvm19-cross-tools
 create mode 120000 srcpkgs/llvm19-devel
 create mode 120000 srcpkgs/llvm19-doc
 create mode 100644 srcpkgs/llvm19/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm19/patches/SmallVector.patch
 create mode 100644 srcpkgs/llvm19/patches/always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm19/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm19/patches/clang-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm19/patches/compiler-rt-sanitizer-ppc64-musl.patch
 create mode 100644 srcpkgs/llvm19/patches/disable-lldb-docs.patch
 create mode 100644 srcpkgs/llvm19/patches/flang-cross.patch
 create mode 100644 srcpkgs/llvm19/patches/flang-musl-bessel.patch
 create mode 100644 srcpkgs/llvm19/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm19/patches/libcxx-musl.patch
 create mode 100644 srcpkgs/llvm19/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm19/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm19/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm19/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm19/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm19/patches/llvm-006-aarch64-mf_exec.patch
 create mode 100644 srcpkgs/llvm19/template
 create mode 100644 srcpkgs/llvm19/update
 create mode 120000 srcpkgs/mlir19
 create mode 120000 srcpkgs/mlir19-devel

diff --git a/common/shlibs b/common/shlibs
index 9a42d7e0255fb1..d1779b907db91e 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -987,14 +987,18 @@ 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.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.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.19.1 libclang-cpp19-19.1.0_1
 libclang-cpp.so.18.1 libclang-cpp18-18.1.8_1
 libclang-cpp.so.17 libclang-cpp17-17.0.6_1
 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
 libLLVMSPIRVLib.so.18.1 SPIRV-LLVM-Translator-18.1.2_1
 libomp.so.5 libomp-17.0.6_1
 libomptarget.so.18.1 libomp-18.1.8_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator19 b/srcpkgs/SPIRV-LLVM-Translator19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator19-devel b/srcpkgs/SPIRV-LLVM-Translator19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer19 b/srcpkgs/clang-analyzer19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/clang-analyzer19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra19 b/srcpkgs/clang-tools-extra19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/clang-tools-extra19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/clang19 b/srcpkgs/clang19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/clang19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/clang19-devel b/srcpkgs/clang19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/clang19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/clang19-headers b/srcpkgs/clang19-headers
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/clang19-headers
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt19 b/srcpkgs/compiler-rt19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/compiler-rt19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/flang19 b/srcpkgs/flang19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/flang19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/flang19-devel b/srcpkgs/flang19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/flang19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp19 b/srcpkgs/libclang-cpp19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libclang-cpp19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libclang19 b/srcpkgs/libclang19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libclang19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libclc19 b/srcpkgs/libclc19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libclc19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/liblldb19 b/srcpkgs/liblldb19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/liblldb19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libllvm19 b/srcpkgs/libllvm19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libllvm19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libomp19 b/srcpkgs/libomp19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libomp19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/libomp19-devel b/srcpkgs/libomp19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/libomp19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/lld19 b/srcpkgs/lld19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/lld19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/lld19-devel b/srcpkgs/lld19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/lld19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel18 b/srcpkgs/lldb-devel18
deleted file mode 120000
index 1f418dc969a832..00000000000000
--- a/srcpkgs/lldb-devel18
+++ /dev/null
@@ -1 +0,0 @@
-llvm18
\ No newline at end of file
diff --git a/srcpkgs/lldb19 b/srcpkgs/lldb19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/lldb19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/lldb19-devel b/srcpkgs/lldb19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/lldb19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm-bolt19 b/srcpkgs/llvm-bolt19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/llvm-bolt19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index 1f418dc969a832..985027fe0a5c8d 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel18 b/srcpkgs/llvm-libunwind-devel18
deleted file mode 120000
index 1f418dc969a832..00000000000000
--- a/srcpkgs/llvm-libunwind-devel18
+++ /dev/null
@@ -1 +0,0 @@
-llvm18
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind18 b/srcpkgs/llvm-libunwind18
deleted file mode 120000
index 1f418dc969a832..00000000000000
--- a/srcpkgs/llvm-libunwind18
+++ /dev/null
@@ -1 +0,0 @@
-llvm18
\ No newline at end of file
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
index 1311ecf6fc60b9..c72b16151ae53a 100644
--- a/srcpkgs/llvm18/template
+++ b/srcpkgs/llvm18/template
@@ -47,8 +47,9 @@ conflicts="llvm17>=0 llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp lto graphviz"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb openmp"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt
+ openmp libcxx libunwind lto graphviz"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb openmp libcxx"
 
 if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
 	build_options_default+=" flang bolt"
@@ -128,13 +129,14 @@ if [ "$build_option_openmp" ]; then
 fi
 
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if [ "$build_option_libunwind" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+=";libunwind"
+fi
 
+if [ "$build_option_libcxx" ]; then
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+=";libcxxabi;libcxx"
-
 fi
 
 configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
@@ -281,31 +283,38 @@ post_install() {
 
 	rm -rf ${DESTDIR}/usr/share/gdb
 
-	# Install libcxxabi headers
-	vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
-	vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
+	if [ "$build_option_libcxx" ]; then
+		# Install libcxxabi headers
+		vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include
+		vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include
 
-	# Install libunwind headers
-	vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
-	vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
-		644 usr/include/mach-o
+		cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \
+			-P ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/cmake_install.cmake
 
-	# Install libcxx and libunwind docs
-	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/cmake_install.cmake
-	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/cmake_install.cmake
+		LIBCXX_DOCS=usr/share/doc/LLVM/libcxx
+		vmkdir ${LIBCXX_DOCS}
+		vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/html ${LIBCXX_DOCS}
+	fi
 
-	# Can this be disabled some other way?
-	rm -rf ${DESTDIR}/usr/lib64
 
-	LIBCXX_DOCS=usr/share/doc/LLVM/libcxx
-	vmkdir ${LIBCXX_DOCS}
-	vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/html ${LIBCXX_DOCS}
+	if [ "$build_option_libunwind" ]; then
+		# Install libunwind headers
+		vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include
+		vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include
+		vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include
+		vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \
+			644 usr/include/mach-o
 
-	LIBUNWIND_DOCS=usr/share/doc/LLVM/libunwind
-	vmkdir ${LIBUNWIND_DOCS}
-	vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/html ${LIBUNWIND_DOCS}
+		cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \
+			-P ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/cmake_install.cmake
+
+		LIBUNWIND_DOCS=usr/share/doc/LLVM/libunwind
+		vmkdir ${LIBUNWIND_DOCS}
+		vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/html ${LIBUNWIND_DOCS}
+	fi
+
+	# Can this be disabled some other way?
+	rm -rf ${DESTDIR}/usr/lib64
 }
 
 clang18_package() {
diff --git a/srcpkgs/llvm19-cross-tools b/srcpkgs/llvm19-cross-tools
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/llvm19-cross-tools
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm19-devel b/srcpkgs/llvm19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/llvm19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm19-doc b/srcpkgs/llvm19-doc
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/llvm19-doc
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/llvm19/files/llvm-Config-llvm-config.h b/srcpkgs/llvm19/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm19/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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/llvm19/patches/SmallVector.patch b/srcpkgs/llvm19/patches/SmallVector.patch
new file mode 100644
index 00000000000000..ac10d306c4346d
--- /dev/null
+++ b/srcpkgs/llvm19/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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
diff --git a/srcpkgs/llvm19/patches/always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm19/patches/always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 00000000000000..cb17121dea2021
--- /dev/null
+++ b/srcpkgs/llvm19/patches/always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,37 @@
+From 2354350bcc890c13016d67f4c060b32cb1cd693c Mon Sep 17 00:00:00 2001
+From: q66 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.42.0
diff --git a/srcpkgs/llvm19/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm19/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000000..e4eaa7783e7a6c
--- /dev/null
+++ b/srcpkgs/llvm19/patches/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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/llvm19/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm19/patches/clang-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000000..4ad6412d1e6c63
--- /dev/null
+++ b/srcpkgs/llvm19/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/llvm19/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm19/patches/compiler-rt-sanitizer-ppc64-musl.patch
new file mode 100644
index 00000000000000..3aed07b8569404
--- /dev/null
+++ b/srcpkgs/llvm19/patches/compiler-rt-sanitizer-ppc64-musl.patch
@@ -0,0 +1,37 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+@@ -74,6 +74,10 @@
+ #    include <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  endif
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -94,7 +94,7 @@
+ # include <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      ifdef __arm__
+ typedef struct user_fpregs elf_fpregset_t;
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
+@@ -31,7 +31,7 @@
+ #include <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // for NT_PRSTATUS
+-#if (defined(__aarch64__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \
+-     !SANITIZER_ANDROID
++#if (defined(__aarch64__) || defined(__powerpc__) ||SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \
++     !SANITIZER_ANDROID
+ // GLIBC 2.20+ sys/user does not include asm/ptrace.h
+ # include <asm/ptrace.h>
+ #endif
diff --git a/srcpkgs/llvm19/patches/disable-lldb-docs.patch b/srcpkgs/llvm19/patches/disable-lldb-docs.patch
new file mode 100644
index 00000000000000..6e7c774bea2f1b
--- /dev/null
+++ b/srcpkgs/llvm19/patches/disable-lldb-docs.patch
@@ -0,0 +1,18 @@
+commit 9af31d021e83dce4e98f06d8e732f4afb481cd08
+Author: Daniel Martinez <danielmartinez@cock.li>
+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/llvm19/patches/flang-cross.patch b/srcpkgs/llvm19/patches/flang-cross.patch
new file mode 100644
index 00000000000000..7f00e2a1df0571
--- /dev/null
+++ b/srcpkgs/llvm19/patches/flang-cross.patch
@@ -0,0 +1,28 @@
+commit 92984acc52fb95566d9387948c2655507328438b
+Author: Daniel Martinez <danielmartinez@cock.li>
+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
+@@ -498,7 +498,7 @@ if(build_runtimes)
+   if("openmp" 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-new")
+-      set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang-new")
++      set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang-new" 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-new is
diff --git a/srcpkgs/llvm19/patches/flang-musl-bessel.patch b/srcpkgs/llvm19/patches/flang-musl-bessel.patch
new file mode 100644
index 00000000000000..59f4e3e2d4be93
--- /dev/null
+++ b/srcpkgs/llvm19/patches/flang-musl-bessel.patch
@@ -0,0 +1,69 @@
+commit 8a0c2301664e7178b2c48a8cfb2a10151bdde462
+Author: Daniel Martinez <danielmartinez@cock.li>
+Date:   Wed Jul 31 14:28:29 2024 -0400
+
+    [flang][runtime] Use fallback bessel functions on musl
+    
+    Fixes compilation on linux when using musl as the libc.
+    
+    musl does not provide long double variants of the bessel functions.
+
+diff --git a/flang/runtime/Float128Math/CMakeLists.txt b/flang/runtime/Float128Math/CMakeLists.txt
+index a5f5bec1e7e4..b7d890df1f4a 100644
+--- a/flang/runtime/Float128Math/CMakeLists.txt
++++ b/flang/runtime/Float128Math/CMakeLists.txt
+@@ -108,6 +108,26 @@ elseif (HAVE_LDBL_MANT_DIG_113)
+   # We can use 'long double' versions from libc.
+   check_library_exists(m sinl "" FOUND_LIBM)
+   if (FOUND_LIBM)
++    check_cxx_source_compiles(
++      "#include <cmath>
++       int main() {
++         int n = 0;
++         long double x = 1;
++         long double Y0 = y0l(x);
++         long double Y1 = y1l(x);
++         long double Yn = ynl(n,x);
++         long double J0 = j0l(x);
++         long double J1 = j1l(x);
++         long double Jn = jnl(n,x);
++         return 0;
++       }
++      "
++    FOUND_LIBM_BESSEL)
++    if (FOUND_LIBM_BESSEL)
++     target_compile_definitions(FortranFloat128MathILib INTERFACE
++       HAS_LIBM_BESSEL
++       )
++    endif()
+     target_compile_definitions(FortranFloat128MathILib INTERFACE
+       HAS_LIBM
+       )
+diff --git a/flang/runtime/Float128Math/math-entries.h b/flang/runtime/Float128Math/math-entries.h
+index 13fdab264700..45ae40fdafa0 100644
+--- a/flang/runtime/Float128Math/math-entries.h
++++ b/flang/runtime/Float128Math/math-entries.h
+@@ -185,9 +185,11 @@ DEFINE_SIMPLE_ALIAS(Hypot, std::hypot)
+ DEFINE_SIMPLE_ALIAS(Ilogb, std::ilogb)
+ DEFINE_SIMPLE_ALIAS(Isinf, std::isinf)
+ DEFINE_SIMPLE_ALIAS(Isnan, std::isnan)
++#ifdef HAS_LIBM_BESSEL
+ DEFINE_SIMPLE_ALIAS(J0, j0l)
+ DEFINE_SIMPLE_ALIAS(J1, j1l)
+ DEFINE_SIMPLE_ALIAS(Jn, jnl)
++#endif
+ DEFINE_SIMPLE_ALIAS(Ldexp, std::ldexp)
+ DEFINE_SIMPLE_ALIAS(Lgamma, std::lgamma)
+ DEFINE_SIMPLE_ALIAS(Llround, std::llround)
+@@ -204,9 +206,11 @@ DEFINE_SIMPLE_ALIAS(Tan, std::tan)
+ DEFINE_SIMPLE_ALIAS(Tanh, std::tanh)
+ DEFINE_SIMPLE_ALIAS(Tgamma, std::tgamma)
+ DEFINE_SIMPLE_ALIAS(Trunc, std::trunc)
++#ifdef HAS_LIBM_BESSEL
+ DEFINE_SIMPLE_ALIAS(Y0, y0l)
+ DEFINE_SIMPLE_ALIAS(Y1, y1l)
+ DEFINE_SIMPLE_ALIAS(Yn, ynl)
++#endif
+ 
+ // Use numeric_limits to produce infinity of the right type.
+ #define F128_RT_INFINITY \
diff --git a/srcpkgs/llvm19/patches/libcxx-armv67.patch b/srcpkgs/llvm19/patches/libcxx-armv67.patch
new file mode 100644
index 00000000000000..700ab134790452
--- /dev/null
+++ b/srcpkgs/llvm19/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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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/llvm19/patches/libcxx-musl.patch b/srcpkgs/llvm19/patches/libcxx-musl.patch
new file mode 100644
index 00000000000000..0dd5f0e7eb8a8b
--- /dev/null
+++ b/srcpkgs/llvm19/patches/libcxx-musl.patch
@@ -0,0 +1,26 @@
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
+     __libcpp_remove_reference_t<decltype(errno)> __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<decltype(errno)> __current_errno = errno;
+     if (__current_errno == 0)
+       errno = __save_errno;
+@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
+     __libcpp_remove_reference_t<decltype(errno)> __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<decltype(errno)> __current_errno = errno;
+     if (__current_errno == 0)
+       errno = __save_errno;
diff --git a/srcpkgs/llvm19/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm19/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 00000000000000..70292beb2fcdbd
--- /dev/null
+++ b/srcpkgs/llvm19/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/llvm19/patches/libcxxabi-dl.patch b/srcpkgs/llvm19/patches/libcxxabi-dl.patch
new file mode 100644
index 00000000000000..e872d263de30f5
--- /dev/null
+++ b/srcpkgs/llvm19/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/llvm19/patches/llvm-001-musl.patch b/srcpkgs/llvm19/patches/llvm-001-musl.patch
new file mode 100644
index 00000000000000..8652e4af69f7c2
--- /dev/null
+++ b/srcpkgs/llvm19/patches/llvm-001-musl.patch
@@ -0,0 +1,32 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+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 <typename T> class ArrayRef;
+ class Triple;
diff --git a/srcpkgs/llvm19/patches/llvm-004-override-opt.patch b/srcpkgs/llvm19/patches/llvm-004-override-opt.patch
new file mode 100644
index 00000000000000..51d0e4b31b32c3
--- /dev/null
+++ b/srcpkgs/llvm19/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/llvm19/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm19/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 00000000000000..d332687b9d9295
--- /dev/null
+++ b/srcpkgs/llvm19/patches/llvm-005-ppc-bigpic.patch
@@ -0,0 +1,36 @@
+From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+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(-)
+
+diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
+index cce21f32..87ca5f9b 100644
+--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
+ 
+   // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI.
+   if (Kind == MCSymbolRefExpr::VK_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);
+diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp
+index 5cc180d7..a5b02565 100644
+--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
+   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/llvm19/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm19/patches/llvm-006-aarch64-mf_exec.patch
new file mode 100644
index 00000000000000..192b4824b8695c
--- /dev/null
+++ b/srcpkgs/llvm19/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/llvm19/template b/srcpkgs/llvm19/template
new file mode 100644
index 00000000000000..a10ab974e0e429
--- /dev/null
+++ b/srcpkgs/llvm19/template
@@ -0,0 +1,1110 @@
+# Template file for 'llvm19'
+pkgname=llvm19
+version=19.1.3
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+_llvm_prefix=lib/llvm/19
+_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
+ -DLLDB_USE_SYSTEM_SIX=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/clang19
+ -DLLVM_ENABLE_RTTI=YES
+ -DLLVM_ENABLE_FFI=YES
+ -DLLVM_BINUTILS_INCDIR=/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
+ -DLIBC_WNO_ERROR=YES
+ -DBASE_LLVM_VERSION=${version}
+ -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
+"
+hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
+ python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config
+ python3-mdit-py-plugins python3-MyST-Parser python3-markdown-it SPIRV-Headers SPIRV-Tools-devel
+ patchelf $(vopt_if graphviz graphviz)"
+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 19"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+_spirv_version=v19.1.0
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz
+ https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/${_spirv_version}.tar.gz"
+checksum="e5106e2bef341b3f5e41340e4b6c6a58259f4021ad801acf14e88f1a84567b05
+ 2e64231db8646d8c220d44136712549b5d4c4194c6ce0e57c4f5ab342beee9a2"
+skip_extraction=${_spirv_version}.tar.gz
+conflicts="llvm18>=0 llvm17>=0 llvm15>=0"
+lib32disabled=yes
+python_version=3
+
+CFLAGS="-Wno-unused-command-line-argument"
+CXXFLAGS="-Wno-unused-command-line-argument"
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt
+ openmp libc libcxx libunwind offload llvm_spirv lto graphviz full_debug"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb
+ libcxx libunwind"
+
+# fails to build with libquadmth on musl
+case "$XBPS_TARGET_MACHINE" in
+	x86_64|i686) makedepends+=" libquadmath-devel" ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|riscv64*)
+		build_options_default+=" flang bolt"
+		if [ -z "$CROSS_BUILD" ]; then
+			build_options_default+=" offload"
+		fi
+	;;
+	armv*)
+		nopie=yes
+		configure_args+=" -DLLVM_ENABLE_PIE=NO"
+		configure_args+=" -DLLDB_INCLUDE_TESTS=NO"
+	;;
+esac
+
+if [ -z "$CROSS_BUILD" ]; then
+	build_options_default+=" llvm_spirv"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
+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 "
+		configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
+		;;
+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
+
+subpackages="
+	libllvm19 llvm19-doc llvm19-devel compiler-rt19
+	$( vopt_if clang 'clang19 clang19-headers clang19-devel libclang19 libclang-cpp19 clang-analyzer19' )
+	$( vopt_if clang_tools_extra 'clang-tools-extra19' )
+	$( vopt_if bolt 'llvm-bolt19' )
+	$( vopt_if lldb 'lldb19 lldb19-devel liblldb19' )
+	$( vopt_if lld 'lld19 lld19-devel' )
+	$( vopt_if libclc 'libclc19' )
+	$( vopt_if mlir 'mlir19 mlir19-devel' )
+	$( vopt_if flang 'flang19 flang19-devel' )
+	$( vopt_if openmp 'libomp19 libomp19-devel' )
+	$( vopt_if libunwind 'llvm-libunwind llvm-libunwind-devel' )
+	$( vopt_if libcxx 'libcxx libcxxabi libcxxabi-devel libcxx-devel' )
+"
+
+_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 libclc 'libclc;')\
+$(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 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
+	hostmakedepends+=" llvm19-cross-tools "
+
+	configure_args+=" -DLLVM_TOOLS_BINAIRY_DIR=/${_llvm_bindir}"
+	configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/${_llvm_bindir}"
+	configure_args+=" -DLLVM_TABLEGEN=/${_llvm_bindir}/llvm-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+=" -DLIBOMP_FORTRAN_MODULES_COMPILER=/${_llvm_bindir}/flang-new"
+	configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/${_llvm_bindir}/clang-tidy-confusable-chars-gen"
+	configure_args+=" -DCLANG_PSEUDO_GEN=/${_llvm_bindir}/clang-pseudo-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"
+fi
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	if [ "$build_option_clang_tools_extra" ] && [ "$build_option_lldb" ] && [ "$build_option_flang" ] && [ "$build_option_mlir" ]; then
+		subpackages="llvm19-cross-tools ${subpackages}"
+	fi
+	# OCaml cross build is broken
+	hostmakedepends+=" ocaml ocaml-findlib "
+	# lldb cross build fails with lua
+	makedepends+=" lua53-devel "
+fi
+
+if [ ! "$build_option_full_debug" ]; then
+	# Vastly reduce size of debugging symbols:
+	CFLAGS=${CFLAGS/ -g/ -g1}
+	CXXFLAGS=${CXXFLAGS/ -g/ -g1}
+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_prefix}/lib/${_base} ${DESTDIR}/usr/lib
+		vmove ${_llvm_libdir}/${_base}
+		vmove usr/lib/${_base}
+	done
+}
+
+post_extract() {
+	if [ "$build_option_llvm_spirv" ]; then
+		vsrcextract -C llvm/projects/llvm-spirv ${_spirv_version}.tar.gz
+	fi
+}
+
+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++"
+
+		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"
+}
+
+pre_configure() {
+	if [ "$CROSS_BUILD" ]; then
+		_setup_cross_cflags
+	fi
+	if [ "$build_option_llvm_spirv" ]; then
+		configure_args+=" -DLLVM_SPIRV=${wrksrc}/llvm/build/bin/llvm-spirv"
+	else
+		configure_args+=" -DLLVM_SPIRV=/${_llvm_bindir}/llvm-spirv"
+	fi
+}
+
+post_build() {
+
+	if [ "$CROSS_BUILD" ]; then
+		CC="clang"
+		CXX="clang++"
+
+		CFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE} "
+		CFLAGS+=" --gcc-toolchain=/usr"
+		CFLAGS+=" -L/${_llvm_libdir}/${XBPS_CROSS_TRIPLET} "
+
+		CXXFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE} "
+		CXXFLAGS+=" --gcc-toolchain=/usr"
+		CXXFLAGS+=" -L/${_llvm_libdir}/${XBPS_CROSS_TRIPLET} "
+	else
+		export CC=${wrksrc}/llvm/build/bin/clang
+		export CXX=${wrksrc}/llvm/build/bin/clang++
+	fi
+
+	mkdir -p ${wrksrc}/${build_wrksrc}/builddir_runtimes
+	cmake -G Ninja ${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
+}
+
+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.
+	if [ "$CROSS_BUILD" ]; then
+		rm -f ${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 -f ${DESTDIR}/usr/lib64
+
+	vmkdir usr/lib/clang
+	ln -s ../llvm/19/lib/clang/19 ${DESTDIR}/usr/lib/clang/19
+}
+
+clang19_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt19>=${version}_${revision}"
+	conflicts="clang18>=0 clang17>=0 clang15>=0"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	local _clang19_files=(
+		bin/clang-19
+		bin/clang
+		bin/clang++
+		bin/clang-cl
+		bin/clang-cpp
+		bin/clang-check
+		bin/clang-extdef-mapping
+		bin/clang-format
+		bin/git-clang-format
+		bin/clang-linker-wrapper
+		bin/clang-offload-bundler
+		bin/clang-offload-packager
+		bin/clang-refactor
+		bin/clang-rename
+		bin/clang-repl
+		bin/clang-scan-deps
+		bin/clang-tblgen
+		bin/c-index-test
+		bin/diagtool
+		bin/amdgpu-arch
+		bin/nvptx-arch
+		bin/hmaptool
+		lib/LLVMgold.so
+		share/man/man1/clang.1
+		share/man/man1/diagtool.1
+		share/man/man1/clang-tblgen.1
+	)
+
+	for _alt in "${_clang19_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
+		for _bin in "${_clang19_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
+	}
+}
+
+clang19-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove ${_llvm_libdir}/clang/19/include
+		vmove ${_llvm_incdir}/c++
+		vmove ${_llvm_datadir}/libc++
+		vmove usr/lib/clang
+	}
+}
+
+clang19-devel_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 clang19>=${version}_${revision} clang-analyzer19>=${version}_${revision}
+	 llvm19>=${version}_${revision}"
+	conflicts="clang18-devel clang17-devel clang15-devel"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra19>=${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
+	}
+}
+
+libclang19_package() {
+	depends="clang19-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library"
+	pkg_install() {
+		_vlink_libs "${_llvm_libdir}/libclang.so.*"
+	}
+}
+
+libclang-cpp19_package() {
+	depends="clang19-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
+	pkg_install() {
+		_vlink_libs "${_llvm_libdir}/libclang-cpp.so.*"
+	}
+}
+
+clang-analyzer19_package() {
+	depends="clang19>=${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"
+	local _clang_analyzer19_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
+	)
+	for _alt in "${_clang_analyzer19_files[@]}"; do
+		alternatives+=" clang-analyzer:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		for _f in "${_clang_analyzer19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+	}
+}
+
+clang-tools-extra19_package() {
+	lib32disabled=yes
+	depends="clang19>=${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/"
+	local _clang_tools_extra19_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-pseudo
+		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
+	)
+
+	for _alt in "${_clang_tools_extra19_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_extra19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+	}
+}
+
+# "bolt" package name is already used
+llvm-bolt19_package() {
+	lib32disabled=yes
+	depends="clang19>=${version}_${revision}"
+	conflicts="llvm-bolt18>=0 llvm-bolt17>=0"
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	local _llvm_bolt19_files=(
+		bin/llvm-bolt
+		bin/perf2bolt
+		bin/llvm-boltdiff
+		bin/merge-fdata
+		bin/llvm-bolt-heatmap
+	)
+	for _alt in "${_llvm_bolt19_files[@]}"; do
+		alternatives+=" llvm-bolt:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		vlicense ${wrksrc}/bolt/LICENSE.TXT
+		for _f in "${_llvm_bolt19_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
+	}
+}
+
+lldb19_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	conflicts="lldb18>=0 lldb17>=0 lldb15>=0"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	local _lldb19_files=(
+		bin/lldb
+		bin/lldb-argdumper
+		bin/lldb-instr
+		bin/lldb-server
+		bin/lldb-dap
+		lib/python${py3_ver}/site-packages/lldb
+	)
+	if [ -z "$CROSS_BUILD" ]; then
+		_lldb19_files+=("lib/lua/5.3/lldb.so")
+	fi
+	for _alt in "${_lldb19_files[@]}"; do
+		alternatives+=" lldb:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		vlicense ${wrksrc}/lldb/LICENSE.TXT
+		for _f in "${_lldb19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+	}
+}
+
+lldb19-devel_package() {
+	lib32disabled=yes
+	depends="lldb19>=${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"
+	}
+}
+
+liblldb19_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		_vlink_libs "${_llvm_libdir}/liblldb*.so.*"
+	}
+}
+
+lld19_package() {
+	lib32disabled=yes
+	conflicts="lld18>=0 lld17>=0 lld15>=0"
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	local _lld19_files=(
+		bin/lld
+		bin/lld-link
+		bin/ld.lld
+		bin/ld64.lld
+		bin/wasm-ld
+	)
+	for _alt in "${_lld19_files[@]}"; do
+		alternatives+=" lld:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		vlicense ${wrksrc}/lld/LICENSE.TXT
+		for _f in "${_lld19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+	}
+}
+
+lld19-devel_package() {
+	lib32disabled=yes
+	depends="lld19>=${version}_${revision} llvm19>=${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"
+	}
+}
+
+mlir19_package() {
+	lib32disabled=yes
+	short_desc+=" - multi-level IR compiler framework"
+	homepage="https://mlir.llvm.org/"
+	local _mlir19_files=(
+		bin/mlir-cat
+		bin/mlir-cpu-runner
+		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-tblgen
+		bin/mlir-transform-opt
+		bin/mlir-translate
+		bin/tblgen-lsp-server
+		share/man/man1/mlir-tblgen.1
+	)
+	for _alt in "${_mlir19_files[@]}"; do
+		alternatives+=" mlir:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		for _f in "${_mlir19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+		_vlink_libs "${_llvm_libdir}/libMLIR*.so.*"
+		_vlink_libs "${_llvm_libdir}/libmlir*.so.*"
+	}
+}
+
+mlir19-devel_package() {
+	lib32disabled=yes
+	depends="mlir19>=${version}_${revision} llvm19>=${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}/objects-Release/obj.MLIR*"
+		vmove "${_llvm_libdir}/libmlir*"
+	}
+}
+
+flang19_package() {
+	lib32disabled=yes
+	depends="mlir19>=${version}_${revision}"
+	conflicts="flang18>=0 flang17>=0"
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	local _flang19_files=(
+		bin/flang-new
+		bin/bbc
+		bin/f18-parse-demo
+		bin/fir-opt
+		bin/tco
+	)
+	for _alt in "${_flang19_files[@]}"; do
+		alternatives+=" flang:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		for _f in "${_flang19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+		vmove "${_llvm_libdir}/libflang*.a"
+		vmove "${_llvm_libdir}/libFortran*.a"
+		vmove "${_llvm_incdir}/flang/*.mod"
+	}
+}
+
+flang19-devel_package() {
+	lib32disabled=yes
+	depends="flang19>=${version}_${revision} llvm19>=${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"
+	}
+}
+
+libomp19_package() {
+	short_desc+=" - Clang OpenMP support library"
+	conflicts="libomp18>=0 libomp17>=0"
+	_libomp19_files=(
+		lib/libomp.so
+	)
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*|riscv64*)
+			_libomp19_files+=("lib/libompd.so")
+		;;
+	esac
+	if [ "$build_option_offload" ]; then
+		_libomp19_files+=("bin/llvm-omp-device-info")
+		_libomp19_files+=("bin/llvm-omp-kernel-replay")
+		_libomp19_files+=("lib/libomptarget.so")
+	fi
+	for _alt in "${_libomp19_files[@]}"; do
+		alternatives+=" libomp:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		for _f in "${_libomp19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+		if [ "$build_option_offload" ]; then
+			_vlink_libs "${_llvm_libdir}/libomp*.so*"
+		fi
+	}
+}
+
+libomp19-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp19>=${version}_${revision}"
+	conflicts="libomp18-devel>=0 libomp17-devel>=0"
+	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_libdir}/libomptarget*.bc"
+			vmove "${_llvm_libdir}/libomp*.a"
+		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/mach-o
+		vmove "usr/include/*unwind*"
+		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.h
+		vmove usr/include/c++/v1/__cxxabi_config.h
+		vmove usr/lib/libc++abi.so
+		vmove usr/lib/libc++abi.a
+	}
+}
+
+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/lib/libc++.modules.json
+		vmove usr/include/c++
+		vmove usr/share/libc++
+		vmove "usr/lib/libc++.so"
+		vmove "usr/lib/libc++.a"
+		vmove "usr/lib/libc++experimental.a"
+	}
+}
+
+compiler-rt19_package() {
+	short_desc+=" - runtime libraries"
+	depends="clang19-headers>=${version}_${revision}"
+	noshlibprovides=yes
+	noverifyrdeps=yes
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove ${_llvm_libdir}/clang/19/lib
+		if [ -d "${DESTDIR}/${_llvm_libdir}/clang/19/bin" ]; then
+			vmove ${_llvm_libdir}/clang/19/bin
+		fi
+		if [ -d "${DESTDIR}/${_llvm_libdir}/clang/19/share" ]; then
+			vmove ${_llvm_libdir}/clang/19/share
+		fi
+	}
+}
+
+libllvm19_package() {
+	short_desc+=" - library"
+	pkg_install() {
+		_vlink_libs "${_llvm_libdir}/libLLVM-*.so"
+		_vlink_libs "${_llvm_libdir}/libLLVM.so.*"
+	}
+}
+
+llvm19-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove ${_llvm_datadir}/doc
+	}
+}
+
+llvm19-devel_package() {
+	depends="llvm19>=${version}_${revision}"
+	conflicts="llvm18-devel>=0 llvm17-devel>=0 llvm15-devel>=0"
+	short_desc+=" - development files"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp19-devel>=${version}_${revision} "
+	fi
+	if [ "$build_option_mlir" ]; then
+		depends+=" mlir19-devel>=${version}_${revision} "
+	fi
+	if [ "$build_option_clang" ]; then
+		depends+=" clang19-devel>=${version}_${revision} "
+	fi
+	alternatives+=" llvm-devel:/usr/lib/cmake/llvm:/usr/${_llvm_libdir}/cmake/llvm"
+	pkg_install() {
+		vmove ${_llvm_libdir}/libLLVM.so
+		vmove ${_llvm_libdir}/libLTO.so
+		vmove ${_llvm_libdir}/libRemarks.so
+		vmove ${_llvm_incdir}/llvm
+		vmove ${_llvm_incdir}/llvm-c
+		vmove "${_llvm_libdir}/libLLVM*.a"
+		vmove ${_llvm_libdir}/cmake/llvm
+	}
+}
+
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm19-cross-tools_package() {
+	conflicts="llvm18-cross-tools>=0 llvm17-cross-tools>=0"
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb19-devel>=${version}_${revision} llvm19-devel>=${version}_${revision}
+	 lld19-devel>=${version}_${revision} flang19-devel>=${version}_${revision}"
+	pkg_install() {
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir ${_llvm_bindir}
+		vcopy build/bin/lldb-tblgen ${_llvm_bindir}
+		vcopy build/bin/clang-tidy-confusable-chars-gen ${_llvm_bindir}
+		vcopy build/bin/clang-pseudo-gen ${_llvm_bindir}
+		vcopy build/bin/mlir-src-sharder ${_llvm_bindir}
+
+		if [ "$build_option_llvm_spirv" ]; then
+			patchelf --add-rpath '$ORIGIN/../lib' ${DESTDIR}/${_llvm_bindir}/llvm-spirv
+			vmove ${_llvm_bindir}/llvm-spirv
+			vmove ${_llvm_incdir}/LLVMSPIRVLib
+			vmove ${_llvm_libdir}/pkgconfig/LLVMSPIRVLib.pc
+			vmove "${_llvm_libdir}/libLLVMSPIRV*.a"
+		fi
+	}
+}
+
+libclc19_package() {
+	short_desc+=" - Open implementation of the OpenCL C programming language"
+	replaces="libclc-git>=0"
+	_libclc19_files=(
+		share/clc
+		include/clc
+		share/pkgconfig/libclc.pc
+	)
+	for _alt in "${_libclc19_files[@]}"; do
+		alternatives+=" libclc:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
+	pkg_install() {
+		for _f in "${_libclc19_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+	}
+}
+
+_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-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
diff --git a/srcpkgs/llvm19/update b/srcpkgs/llvm19/update
new file mode 100644
index 00000000000000..21c281eb186761
--- /dev/null
+++ b/srcpkgs/llvm19/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/mlir19 b/srcpkgs/mlir19
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/mlir19
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file
diff --git a/srcpkgs/mlir19-devel b/srcpkgs/mlir19-devel
new file mode 120000
index 00000000000000..985027fe0a5c8d
--- /dev/null
+++ b/srcpkgs/mlir19-devel
@@ -0,0 +1 @@
+llvm19
\ No newline at end of file

From 79fa20925df61a70350ac786fcf9f82940af5830 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 28 Sep 2024 21:56:42 -0400
Subject: [PATCH 2/2] libclc: setup alternatives

---
 srcpkgs/libclc/template | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index da85a23c785549..5bf88b564d9a89 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -1,10 +1,10 @@
 # Template file for 'libclc'
 pkgname=libclc
 version=18.1.8
-revision=1
+revision=2
 build_style=cmake
 # disable clspv (failing tests, we don't ship it)
-configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
+configure_args="-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm/18/ -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="llvm18-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
@@ -16,6 +16,12 @@ distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${vers
 checksum=905bd59e9f810d6bd0ae6874725a8f8a3c91cb416199c03f2b98b57437cfb32e
 replaces="libclc-git>=0"
 
+alternatives="
+ clc:/usr/share/clc:/usr/lib/llvm/18/share/clc
+ clc:/usr/include/clc:/usr/lib/llvm/18/include/clc
+ clc:/usr/share/pkgconfig/libclc.pc:/usr/lib/llvm/18/share/pkgconfig/libclc.pc
+"
+
 do_configure() {
 	# We really do a native build.
 	# The outcome is just header files.

  parent reply	other threads:[~2024-11-08  3:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 13:04 [PR PATCH] " Calandracas606
2024-07-29 13:07 ` [PR PATCH] [Updated] " Calandracas606
2024-07-29 23:42 ` Calandracas606
2024-07-29 23:43 ` Calandracas606
2024-07-30 11:35 ` Calandracas606
2024-07-30 12:04 ` Calandracas606
2024-07-30 13:45 ` [PR PATCH] [Updated] " Calandracas606
2024-07-30 13:46 ` Calandracas606
2024-07-30 13:48 ` [PR PATCH] [Updated] " Calandracas606
2024-07-30 13:49 ` Calandracas606
2024-08-06 17:40 ` Calandracas606
2024-08-06 17:50 ` Calandracas606
2024-08-06 17:51 ` Calandracas606
2024-08-06 17:53 ` Calandracas606
2024-08-06 18:01 ` Calandracas606
2024-09-29  1:49 ` [PR PATCH] [Updated] " Calandracas606
2024-09-29  1:57 ` Calandracas606
2024-09-29  2:10 ` Calandracas606
2024-09-29 12:24 ` [PR PATCH] [Updated] " Calandracas606
2024-11-08  3:36 ` Calandracas606 [this message]
2024-11-08  4:48 ` Calandracas606
2024-11-09 15:41 ` New package: llvm19-19.1.3 Calandracas606
2024-11-09 18:23 ` [PR PATCH] [Updated] " Calandracas606
2024-11-09 18:31 ` [PR REVIEW] " classabbyamp
2024-11-11 22:55 ` [PR PATCH] [Updated] " Calandracas606
2024-11-12 19:04 ` [PR PATCH] [Closed]: " classabbyamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241108033646.6D3B823941@inbox.vuxu.org \
    --to=calandracas606@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).