Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] llvm17: fixup and refactor
@ 2024-02-09 14:22 Calandracas606
  2024-02-09 14:24 ` [PR PATCH] [Updated] " Calandracas606
                   ` (49 more replies)
  0 siblings, 50 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 14:22 UTC (permalink / raw)
  To: ml

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

There is a new pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci-skip]


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

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

From 0d0d6f7421ed540308f839cf53b16b6fb3f3d929 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 28 ++++++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..59e93de3c5f53 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-devel clang17-headers libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -280,7 +280,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,10 +313,20 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+	usr/lib/clang/17/include
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17-${version}_${revision}"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -343,6 +353,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +361,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +649,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +659,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
@ 2024-02-09 14:24 ` Calandracas606
  2024-02-09 14:25 ` Calandracas606
                   ` (48 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 14:24 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From e58a93aaf41ff0f54c36826a9b94fcf7a6b7efe6 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 30 +++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..2e4f922f94f6b 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
-# Template file for 'llvm17'
+# Template file for 'llvm17'.
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-devel clang17-headers libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -280,7 +280,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,10 +313,20 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+	usr/lib/clang/17/include
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17-${version}_${revision}"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -343,6 +353,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +361,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +649,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +659,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
  2024-02-09 14:24 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-02-09 14:25 ` Calandracas606
  2024-02-09 14:46 ` Calandracas606
                   ` (47 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 14:25 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 19f8a7d633468d9ec7c01618b9cb35c5534eca54 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 28 ++++++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..a713d6cd487f7 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -280,7 +280,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,10 +313,20 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+	usr/lib/clang/17/include
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17-${version}_${revision}"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -343,6 +353,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +361,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +649,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +659,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
  2024-02-09 14:24 ` [PR PATCH] [Updated] " Calandracas606
  2024-02-09 14:25 ` Calandracas606
@ 2024-02-09 14:46 ` Calandracas606
  2024-02-09 14:58 ` Calandracas606
                   ` (46 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 14:46 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 5169cd008bf345470daa58e4019606d3513840f0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 29 ++++++++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..22cd9cf875dd1 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -280,7 +280,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +313,25 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+	usr/lib/clang/17/include
+		vmove usr/lib/clang
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17-${version}_${revision}"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,6 +352,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +360,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +648,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +658,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (2 preceding siblings ...)
  2024-02-09 14:46 ` Calandracas606
@ 2024-02-09 14:58 ` Calandracas606
  2024-02-09 16:37 ` Calandracas606
                   ` (45 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 14:58 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From bee364538c9f622c552138e4890c1f9eca7c7297 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 28 +++++++++++++++++++---------
 2 files changed, 20 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..07378f896b203 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -280,7 +280,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +313,24 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17-${version}_${revision}"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,6 +351,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +359,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +647,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +657,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (3 preceding siblings ...)
  2024-02-09 14:58 ` Calandracas606
@ 2024-02-09 16:37 ` Calandracas606
  2024-02-09 18:01 ` Calandracas606
                   ` (44 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 16:37 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From c9a190eeecb49e3d28a847bd4b7802d3bb1fbb46 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers |  1 +
 srcpkgs/llvm17/template | 81 +++++++++++++++++++++--------------------
 2 files changed, 42 insertions(+), 40 deletions(-)
 create mode 120000 srcpkgs/clang17-headers

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..548ddee126dd2 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -105,6 +105,7 @@ subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-devel lldb17-devel "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -170,37 +171,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +218,11 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	vmkdir usr/bin
+	vcopy build/bin/lldb-tblgen usr/bin
+	vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+	vcopy build/bin/clang-pseudo-gen usr/bin
 }
 
 post_install() {
@@ -280,7 +265,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +298,29 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,6 +341,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +349,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -447,6 +447,7 @@ lldb17-devel_package() {
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
+		vmove usr/bin/lldb-tblgen
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
@@ -637,7 +638,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +648,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (4 preceding siblings ...)
  2024-02-09 16:37 ` Calandracas606
@ 2024-02-09 18:01 ` Calandracas606
  2024-02-09 18:27 ` Calandracas606
                   ` (43 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 18:01 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 7cdc230154c504379f0da304901ce2795bf3de46 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |  1 +
 srcpkgs/llvm17-cross-tools |  1 +
 srcpkgs/llvm17/template    | 93 +++++++++++++++++++++-----------------
 3 files changed, 54 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..a14f6302f9c04 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -64,7 +64,7 @@ fi
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +100,12 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel"
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +114,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +172,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +219,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +268,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +301,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,6 +342,7 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
@@ -350,6 +350,7 @@ libclang17_package() {
 }
 
 libclang-cpp17_package() {
+	depends="clang17-headers-${version}_${revision}"
 	short_desc+=" - C frontend runtime library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
@@ -637,7 +638,7 @@ libllvm17_package() {
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +648,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +667,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (5 preceding siblings ...)
  2024-02-09 18:01 ` Calandracas606
@ 2024-02-09 18:27 ` Calandracas606
  2024-02-09 18:30 ` Calandracas606
                   ` (42 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 18:27 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (6 preceding siblings ...)
  2024-02-09 18:27 ` Calandracas606
@ 2024-02-09 18:30 ` Calandracas606
  2024-02-09 18:48 ` Calandracas606
                   ` (41 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 18:30 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/2] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 2/2] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (7 preceding siblings ...)
  2024-02-09 18:30 ` Calandracas606
@ 2024-02-09 18:48 ` Calandracas606
  2024-02-09 20:55 ` Calandracas606
                   ` (40 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 18:48 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/3] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 2/3] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

From 9309b6d70acfd42153a8badc74f1b19319277039 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:46:27 -0500
Subject: [PATCH 3/3] fixup set vars to empty

---
 srcpkgs/llvm17/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index d7dce2fe72c0d..7de3dcde71b32 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-#_enabled_projects=""
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,7 +103,7 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-#_enabled_runtimes=
+_enabled_runtimes=
 if [ 1 ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (8 preceding siblings ...)
  2024-02-09 18:48 ` Calandracas606
@ 2024-02-09 20:55 ` Calandracas606
  2024-02-09 21:59 ` Calandracas606
                   ` (39 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 20:55 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/4] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 2/4] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

From 9309b6d70acfd42153a8badc74f1b19319277039 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:46:27 -0500
Subject: [PATCH 3/4] fixup set vars to empty

---
 srcpkgs/llvm17/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index d7dce2fe72c0d..7de3dcde71b32 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-#_enabled_projects=""
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,7 +103,7 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-#_enabled_runtimes=
+_enabled_runtimes=
 if [ 1 ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"

From 40b974f89a2afbf41d50809ed048d263ac52933d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 15:55:07 -0500
Subject: [PATCH 4/4] fixup clang config file system

---
 srcpkgs/llvm17/template | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7de3dcde71b32..316b5b1c5c9b8 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -24,6 +24,7 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
  -DLLVM_BINUTILS_INCDIR=/usr/include
@@ -35,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -45,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -61,9 +62,10 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
 
-_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,16 +105,13 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
-if [ 1 ]; then
+if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
-fi
-if [ 1 ]; then
+
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-fi
-if [ 1 ]; then
+
 	subpackages+=" compiler-rt "
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (9 preceding siblings ...)
  2024-02-09 20:55 ` Calandracas606
@ 2024-02-09 21:59 ` Calandracas606
  2024-02-09 22:01 ` Calandracas606
                   ` (38 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 21:59 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/6] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 2/6] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

From 9309b6d70acfd42153a8badc74f1b19319277039 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:46:27 -0500
Subject: [PATCH 3/6] fixup set vars to empty

---
 srcpkgs/llvm17/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index d7dce2fe72c0d..7de3dcde71b32 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-#_enabled_projects=""
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,7 +103,7 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-#_enabled_runtimes=
+_enabled_runtimes=
 if [ 1 ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"

From 40b974f89a2afbf41d50809ed048d263ac52933d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 15:55:07 -0500
Subject: [PATCH 4/6] fixup clang config file system

---
 srcpkgs/llvm17/template | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7de3dcde71b32..316b5b1c5c9b8 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -24,6 +24,7 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
  -DLLVM_BINUTILS_INCDIR=/usr/include
@@ -35,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -45,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -61,9 +62,10 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
 
-_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,16 +105,13 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
-if [ 1 ]; then
+if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
-fi
-if [ 1 ]; then
+
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-fi
-if [ 1 ]; then
+
 	subpackages+=" compiler-rt "
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi

From b07a653f5e408001e1fb89f0b13c25b6276798cc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:32:26 -0500
Subject: [PATCH 5/6] fixup openmp

---
 srcpkgs/llvm17/template | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 316b5b1c5c9b8..4843822aeb628 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -100,10 +100,6 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
-fi
 
 if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
@@ -116,11 +112,20 @@ if [ "$build_option_runtimes" ]; then
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
+if [ "$build_option_openmp" ]; then
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
+	subpackages+=" libomp libomp-devel "
+fi
+
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" llvm17-cross-tools "
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -236,6 +241,7 @@ post_build() {
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
 
 	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
 		vmkdir usr/bin
 		vcopy build/bin/lldb-tblgen usr/bin
 		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
@@ -574,7 +580,6 @@ libomp-devel_package() {
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -692,6 +697,7 @@ llvm17-devel_package() {
 	}
 }
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
 llvm17-cross-tools_package() {
 	short_desc+=" - build tools for cross compiling LLVM"
 	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"

From 25b45f5f0681d7e05229a09db56144940604bcbc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:59:18 -0500
Subject: [PATCH 6/6] fixup add llvm17-config

---
 srcpkgs/llvm17-config   |  1 +
 srcpkgs/llvm17/template | 30 +++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/llvm17-config

diff --git a/srcpkgs/llvm17-config b/srcpkgs/llvm17-config
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-config
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 4843822aeb628..525a656ef0f45 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -62,7 +62,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages="libllvm17 llvm17-doc llvm17-devel"
+subpackages="libllvm17 llvm17-config llvm17-doc llvm17-devel"
 _enabled_projects=
 _enabled_runtimes=
 
@@ -334,7 +334,8 @@ clang17-headers_package() {
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-config-${version}_${revision}"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17-${version}_${revision}"
 	fi
@@ -491,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -513,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -549,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -573,7 +575,7 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
@@ -597,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -620,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -637,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -666,6 +668,16 @@ libllvm17_package() {
 	}
 }
 
+llvm17-config_package() {
+	short_desc+=" - config tool and cmake files"
+	depends="llvm17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-config
+		vmove usr/lib/cmake/llvm
+
+	}
+}
+
 llvm17-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
@@ -675,7 +687,7 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-config>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (10 preceding siblings ...)
  2024-02-09 21:59 ` Calandracas606
@ 2024-02-09 22:01 ` Calandracas606
  2024-02-10  0:51 ` Calandracas606
                   ` (37 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-09 22:01 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/7] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 2/7] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

From 9309b6d70acfd42153a8badc74f1b19319277039 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:46:27 -0500
Subject: [PATCH 3/7] fixup set vars to empty

---
 srcpkgs/llvm17/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index d7dce2fe72c0d..7de3dcde71b32 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-#_enabled_projects=""
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,7 +103,7 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-#_enabled_runtimes=
+_enabled_runtimes=
 if [ 1 ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"

From 40b974f89a2afbf41d50809ed048d263ac52933d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 15:55:07 -0500
Subject: [PATCH 4/7] fixup clang config file system

---
 srcpkgs/llvm17/template | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7de3dcde71b32..316b5b1c5c9b8 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -24,6 +24,7 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
  -DLLVM_BINUTILS_INCDIR=/usr/include
@@ -35,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -45,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -61,9 +62,10 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
 
-_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,16 +105,13 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
-if [ 1 ]; then
+if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
-fi
-if [ 1 ]; then
+
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-fi
-if [ 1 ]; then
+
 	subpackages+=" compiler-rt "
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi

From b07a653f5e408001e1fb89f0b13c25b6276798cc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:32:26 -0500
Subject: [PATCH 5/7] fixup openmp

---
 srcpkgs/llvm17/template | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 316b5b1c5c9b8..4843822aeb628 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -100,10 +100,6 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
-fi
 
 if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
@@ -116,11 +112,20 @@ if [ "$build_option_runtimes" ]; then
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
+if [ "$build_option_openmp" ]; then
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
+	subpackages+=" libomp libomp-devel "
+fi
+
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" llvm17-cross-tools "
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -236,6 +241,7 @@ post_build() {
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
 
 	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
 		vmkdir usr/bin
 		vcopy build/bin/lldb-tblgen usr/bin
 		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
@@ -574,7 +580,6 @@ libomp-devel_package() {
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -692,6 +697,7 @@ llvm17-devel_package() {
 	}
 }
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
 llvm17-cross-tools_package() {
 	short_desc+=" - build tools for cross compiling LLVM"
 	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"

From 25b45f5f0681d7e05229a09db56144940604bcbc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:59:18 -0500
Subject: [PATCH 6/7] fixup add llvm17-config

---
 srcpkgs/llvm17-config   |  1 +
 srcpkgs/llvm17/template | 30 +++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/llvm17-config

diff --git a/srcpkgs/llvm17-config b/srcpkgs/llvm17-config
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-config
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 4843822aeb628..525a656ef0f45 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -62,7 +62,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages="libllvm17 llvm17-doc llvm17-devel"
+subpackages="libllvm17 llvm17-config llvm17-doc llvm17-devel"
 _enabled_projects=
 _enabled_runtimes=
 
@@ -334,7 +334,8 @@ clang17-headers_package() {
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-config-${version}_${revision}"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17-${version}_${revision}"
 	fi
@@ -491,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -513,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -549,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -573,7 +575,7 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
@@ -597,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -620,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -637,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -666,6 +668,16 @@ libllvm17_package() {
 	}
 }
 
+llvm17-config_package() {
+	short_desc+=" - config tool and cmake files"
+	depends="llvm17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-config
+		vmove usr/lib/cmake/llvm
+
+	}
+}
+
 llvm17-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
@@ -675,7 +687,7 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-config>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi

From 130f5c56173307d8d781202c828a950e22158d38 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 17:01:28 -0500
Subject: [PATCH 7/7] fixup add llvm17-devel

---
 srcpkgs/llvm17/template | 2 --
 1 file changed, 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 525a656ef0f45..5ac1d3650cdef 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -704,8 +704,6 @@ llvm17-devel_package() {
 		vmove usr/include/llvm
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
-		vmove usr/lib/cmake/llvm
-
 	}
 }
 

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (11 preceding siblings ...)
  2024-02-09 22:01 ` Calandracas606
@ 2024-02-10  0:51 ` Calandracas606
  2024-02-10  2:11 ` Calandracas606
                   ` (36 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  0:51 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From d6368cbf5bd0b650c5e83bd3802a3108e4d531db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 01/12] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 126 ++++++++++++++++++++++++-------------
 4 files changed, 84 insertions(+), 45 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..743c9e58ecb99 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -26,7 +26,6 @@ configure_args="
  -DCLANG_LINK_CLANG_DYLIB=YES
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -62,9 +61,12 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -100,11 +102,26 @@ if [ "$build_option_openmp" ]; then
 	_enabled_projects+="openmp;"
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
+
+_enabled_runtimes=
+if [ 1 ]; then
+       subpackages+=" llvm-libunwind llvm-libunwind-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+fi
+if [ 1 ]; then
+       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+fi
+if [ 1 ]; then
+       subpackages+=" compiler-rt "
+       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools "
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,13 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +284,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +317,27 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +358,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -629,15 +646,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +673,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -666,3 +692,13 @@ llvm17-devel_package() {
 
 	}
 }
+
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
+	}
+}

From e9ad79717f85ef34d757f2758a12e50c28e07a0a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:30:09 -0500
Subject: [PATCH 02/12] fixup

---
 srcpkgs/llvm17/template | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 743c9e58ecb99..d7dce2fe72c0d 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-_enabled_projects=""
+#_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,18 +103,18 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
+#_enabled_runtimes=
 if [ 1 ]; then
-       subpackages+=" llvm-libunwind llvm-libunwind-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 fi
 if [ 1 ]; then
-       subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-       _enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 fi
 if [ 1 ]; then
-       subpackages+=" compiler-rt "
-       _enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"

From 9309b6d70acfd42153a8badc74f1b19319277039 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 13:46:27 -0500
Subject: [PATCH 03/12] fixup set vars to empty

---
 srcpkgs/llvm17/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index d7dce2fe72c0d..7de3dcde71b32 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -63,7 +63,7 @@ fi
 
 subpackages+="  libllvm17 llvm17-doc llvm17-devel "
 
-#_enabled_projects=""
+_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,7 +103,7 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-#_enabled_runtimes=
+_enabled_runtimes=
 if [ 1 ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"

From 40b974f89a2afbf41d50809ed048d263ac52933d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 15:55:07 -0500
Subject: [PATCH 04/12] fixup clang config file system

---
 srcpkgs/llvm17/template | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7de3dcde71b32..316b5b1c5c9b8 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -24,6 +24,7 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
  -DLLVM_BINUTILS_INCDIR=/usr/include
@@ -35,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -45,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -61,9 +62,10 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages+="  libllvm17 llvm17-doc llvm17-devel "
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
 
-_enabled_projects=""
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
 	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
@@ -103,16 +105,13 @@ if [ "$build_option_openmp" ]; then
 	subpackages+=" libomp libomp-devel "
 fi
 
-_enabled_runtimes=
-if [ 1 ]; then
+if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
-fi
-if [ 1 ]; then
+
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-fi
-if [ 1 ]; then
+
 	subpackages+=" compiler-rt "
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi

From b07a653f5e408001e1fb89f0b13c25b6276798cc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:32:26 -0500
Subject: [PATCH 05/12] fixup openmp

---
 srcpkgs/llvm17/template | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 316b5b1c5c9b8..4843822aeb628 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -100,10 +100,6 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
-fi
 
 if [ "$build_option_runtimes" ]; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
@@ -116,11 +112,20 @@ if [ "$build_option_runtimes" ]; then
 	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
 fi
 
+if [ "$build_option_openmp" ]; then
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
+	subpackages+=" libomp libomp-devel "
+fi
+
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" llvm17-cross-tools "
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -236,6 +241,7 @@ post_build() {
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
 
 	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
 		vmkdir usr/bin
 		vcopy build/bin/lldb-tblgen usr/bin
 		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
@@ -574,7 +580,6 @@ libomp-devel_package() {
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -692,6 +697,7 @@ llvm17-devel_package() {
 	}
 }
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
 llvm17-cross-tools_package() {
 	short_desc+=" - build tools for cross compiling LLVM"
 	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"

From 25b45f5f0681d7e05229a09db56144940604bcbc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 16:59:18 -0500
Subject: [PATCH 06/12] fixup add llvm17-config

---
 srcpkgs/llvm17-config   |  1 +
 srcpkgs/llvm17/template | 30 +++++++++++++++++++++---------
 2 files changed, 22 insertions(+), 9 deletions(-)
 create mode 120000 srcpkgs/llvm17-config

diff --git a/srcpkgs/llvm17-config b/srcpkgs/llvm17-config
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-config
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 4843822aeb628..525a656ef0f45 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -62,7 +62,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages="libllvm17 llvm17-doc llvm17-devel"
+subpackages="libllvm17 llvm17-config llvm17-doc llvm17-devel"
 _enabled_projects=
 _enabled_runtimes=
 
@@ -334,7 +334,8 @@ clang17-headers_package() {
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-config-${version}_${revision}"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17-${version}_${revision}"
 	fi
@@ -491,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -513,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17-config-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -549,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -573,7 +575,7 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
@@ -597,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -620,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -637,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx>=${version}_${revision} llvm17-config>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -666,6 +668,16 @@ libllvm17_package() {
 	}
 }
 
+llvm17-config_package() {
+	short_desc+=" - config tool and cmake files"
+	depends="llvm17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-config
+		vmove usr/lib/cmake/llvm
+
+	}
+}
+
 llvm17-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
@@ -675,7 +687,7 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-config>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi

From 130f5c56173307d8d781202c828a950e22158d38 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 17:01:28 -0500
Subject: [PATCH 07/12] fixup add llvm17-devel

---
 srcpkgs/llvm17/template | 2 --
 1 file changed, 2 deletions(-)

diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 525a656ef0f45..5ac1d3650cdef 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -704,8 +704,6 @@ llvm17-devel_package() {
 		vmove usr/include/llvm
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
-		vmove usr/lib/cmake/llvm
-
 	}
 }
 

From 0d35fedc717e71c84fe7eb6070542ed35272bc94 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:50:09 -0500
Subject: [PATCH 08/12] fixup remove llvm17-config

---
 srcpkgs/libclc/template    |  1 -
 srcpkgs/llvm17-config      |  1 -
 srcpkgs/llvm17/template    | 45 +++++++++++++++-----------------------
 srcpkgs/mesa/template      |  3 +--
 srcpkgs/qt5/template       |  2 +-
 srcpkgs/qt6-tools/template |  2 +-
 6 files changed, 21 insertions(+), 33 deletions(-)
 delete mode 120000 srcpkgs/llvm17-config

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..1d2fa4c871178 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -8,7 +8,6 @@ configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"
diff --git a/srcpkgs/llvm17-config b/srcpkgs/llvm17-config
deleted file mode 120000
index 96970d5c02c13..0000000000000
--- a/srcpkgs/llvm17-config
+++ /dev/null
@@ -1 +0,0 @@
-llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 5ac1d3650cdef..b4be99f733df0 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -62,7 +62,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages="libllvm17 llvm17-config llvm17-doc llvm17-devel"
+subpackages="libllvm17 llvm17-doc llvm17-devel"
 _enabled_projects=
 _enabled_runtimes=
 
@@ -335,7 +335,7 @@ clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
-		llvm17-config-${version}_${revision}"
+		llvm17-${version}_${revision}"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17-${version}_${revision}"
 	fi
@@ -431,7 +431,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -467,7 +467,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -492,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision} llvm17-config-${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -514,7 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
-	depends="mlir17>=${version}_${revision} llvm17-config-${version}_${revision}"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -540,7 +540,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -551,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision} llvm17-config>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -575,7 +575,7 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision} llvm17-config>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
@@ -599,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision} llvm17-config>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -622,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision} llvm17-config>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -639,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision} llvm17-config>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -668,16 +668,6 @@ libllvm17_package() {
 	}
 }
 
-llvm17-config_package() {
-	short_desc+=" - config tool and cmake files"
-	depends="llvm17>=${version}_${revision}"
-	pkg_install() {
-		vmove usr/bin/llvm-config
-		vmove usr/lib/cmake/llvm
-
-	}
-}
-
 llvm17-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
@@ -687,17 +677,18 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17-config>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>=${version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>=${version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>=${version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
+		vmove usr/lib/cmake/llvm
 		vmove usr/lib/libLLVM.so
 		vmove usr/lib/libLTO.so
 		vmove usr/lib/libRemarks.so
@@ -710,7 +701,7 @@ llvm17-devel_package() {
 # These binaries are ONLY used when building llvm, they aren't normally installed
 llvm17-cross-tools_package() {
 	short_desc+=" - build tools for cross compiling LLVM"
-	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/lldb-tblgen
 		vmove usr/bin/clang-tidy-confusable-chars-gen
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..ebf243a053696 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..071d111aec5ee 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,7 +7,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
  gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"

From 75d8769a961fd06f97523d423632faa30cffb1ef Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:01 -0500
Subject: [PATCH 09/12] libclc: Cleanup llvm dependancies

---
 srcpkgs/libclc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index 1d2fa4c871178..2aa07b2b55ed5 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc'
 pkgname=libclc
 version=17.0.6
-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

From 9f83c3fafb666d5d091162cd1598316cb1fa2d41 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:05 -0500
Subject: [PATCH 10/12] mesa: Cleanup llvm dependancies

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index ebf243a053696..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911

From cb989f420299488dcd70af8157fe8c2f94dbfd64 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:08 -0500
Subject: [PATCH 11/12] qt5: Cleanup llvm dependancies

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 126069709d117..7997878784013 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ pkgname=qt5
 version=5.15.11+20231124
 # commit 4765fa1df7a837db9c1f89c4da0dd76b74bb5fab
 # base repo: https://invent.kde.org/qt/qt/qt5
-revision=2
+revision=3
 build_style=meta
 hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"

From 2d37889e9ca0d47d25674db2bc0c1e4829e93293 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:11 -0500
Subject: [PATCH 12/12] qt6-tools: Cleanup llvm dependancies

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 071d111aec5ee..bc810416fd075 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.6.0
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (12 preceding siblings ...)
  2024-02-10  0:51 ` Calandracas606
@ 2024-02-10  2:11 ` Calandracas606
  2024-02-10  2:15 ` Calandracas606
                   ` (35 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  2:11 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 9faa6b5f8e5ec840cfd6d9b9f2b0c0ecccd4a35f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/6] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/libclc/template    |   1 -
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 164 +++++++++++++++++++++++--------------
 srcpkgs/mesa/template      |   3 +-
 srcpkgs/qt5/template       |   2 +-
 srcpkgs/qt6-tools/template |   2 +-
 8 files changed, 109 insertions(+), 66 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..1d2fa4c871178 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -8,7 +8,6 @@ configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..b4be99f733df0 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -62,9 +62,13 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +100,32 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
+
+if [ "$build_option_runtimes" ]; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
+
 if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +289,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +322,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +364,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +431,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +467,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +540,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +575,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +652,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,24 +677,34 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
+		vmove usr/lib/cmake/llvm
 		vmove usr/lib/libLLVM.so
 		vmove usr/lib/libLTO.so
 		vmove usr/lib/libRemarks.so
 		vmove usr/include/llvm
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
-		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..ebf243a053696 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..071d111aec5ee 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,7 +7,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
  gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"

From ce560fe991c5166855db574bc7cf08b65ca92692 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:01 -0500
Subject: [PATCH 2/6] libclc: Cleanup llvm dependancies

---
 srcpkgs/libclc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index 1d2fa4c871178..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,7 +6,7 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"

From 8b4210e389222f4b7820322dbd8978937ca7886b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:05 -0500
Subject: [PATCH 3/6] mesa: Cleanup llvm dependancies

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index ebf243a053696..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911

From b08c25c5be62c145ed9259a34685c961ce6b911f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:11 -0500
Subject: [PATCH 5/6] qt6-tools: Cleanup llvm dependancies

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 071d111aec5ee..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -10,7 +10,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
 hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

From b4b2eeeb43d406b7842ad257f5b249041d2e078d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 20:55:10 -0500
Subject: [PATCH 6/6] clazy: Cleanup llvm dependancies

---
 srcpkgs/clazy/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..97c78b91d740e 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,11 +1,11 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=3
+revision=4
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (13 preceding siblings ...)
  2024-02-10  2:11 ` Calandracas606
@ 2024-02-10  2:15 ` Calandracas606
  2024-02-10  2:38 ` Calandracas606
                   ` (34 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  2:15 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 9faa6b5f8e5ec840cfd6d9b9f2b0c0ecccd4a35f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/6] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/libclc/template    |   1 -
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 164 +++++++++++++++++++++++--------------
 srcpkgs/mesa/template      |   3 +-
 srcpkgs/qt5/template       |   2 +-
 srcpkgs/qt6-tools/template |   2 +-
 8 files changed, 109 insertions(+), 66 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..1d2fa4c871178 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -8,7 +8,6 @@ configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..b4be99f733df0 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -62,9 +62,13 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +100,32 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
+
+if [ "$build_option_runtimes" ]; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
+
 if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +289,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +322,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +364,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +431,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +467,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +540,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +575,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +652,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,24 +677,34 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
+		vmove usr/lib/cmake/llvm
 		vmove usr/lib/libLLVM.so
 		vmove usr/lib/libLTO.so
 		vmove usr/lib/libRemarks.so
 		vmove usr/include/llvm
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
-		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..ebf243a053696 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..071d111aec5ee 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,7 +7,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
  gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"

From ce560fe991c5166855db574bc7cf08b65ca92692 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:01 -0500
Subject: [PATCH 2/6] libclc: Cleanup llvm dependancies

---
 srcpkgs/libclc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index 1d2fa4c871178..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,7 +6,7 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"

From 8b4210e389222f4b7820322dbd8978937ca7886b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:05 -0500
Subject: [PATCH 3/6] mesa: Cleanup llvm dependancies

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index ebf243a053696..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911

From b08c25c5be62c145ed9259a34685c961ce6b911f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:11 -0500
Subject: [PATCH 5/6] qt6-tools: Cleanup llvm dependancies

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 071d111aec5ee..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -10,7 +10,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
 hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

From 64eedc4ee34c867af69c5d78a649c526b9626974 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 20:55:10 -0500
Subject: [PATCH 6/6] clazy: Cleanup llvm dependancies

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (14 preceding siblings ...)
  2024-02-10  2:15 ` Calandracas606
@ 2024-02-10  2:38 ` Calandracas606
  2024-02-10  2:42 ` [PR PATCH] [Updated] " Calandracas606
                   ` (33 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  2:38 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#issuecomment-1936822870

Comment:
@Duncaen lmk if there's any other changes you would like to see

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (15 preceding siblings ...)
  2024-02-10  2:38 ` Calandracas606
@ 2024-02-10  2:42 ` Calandracas606
  2024-02-10  4:09 ` Calandracas606
                   ` (32 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  2:42 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 4da76c9b21b7cf876808f0991001f26ad818b2f2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/6] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/libclc/template    |   1 -
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 162 +++++++++++++++++++++++--------------
 srcpkgs/mesa/template      |   3 +-
 srcpkgs/qt5/template       |   2 +-
 srcpkgs/qt6-tools/template |   2 +-
 8 files changed, 108 insertions(+), 65 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..1d2fa4c871178 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -8,7 +8,6 @@ configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..fdf39a4cf89bd 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,8 +45,9 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
@@ -62,9 +62,13 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +100,32 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
+
+if [ "$build_option_runtimes" ]; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
+
 if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +289,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +322,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +364,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +431,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +467,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +492,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +514,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +540,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +551,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +575,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +599,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +622,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +639,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +652,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,15 +677,15 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +695,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..ebf243a053696 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..071d111aec5ee 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,7 +7,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
  gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"

From 77c5656a220901c6d1be2f26d1aabb3e8b95446e Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:01 -0500
Subject: [PATCH 2/6] libclc: Cleanup llvm dependancies

---
 srcpkgs/libclc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index 1d2fa4c871178..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,7 +6,7 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"

From 4b0728320505f411f0da5b073b7ccf22d11a844b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:05 -0500
Subject: [PATCH 3/6] mesa: Cleanup llvm dependancies

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index ebf243a053696..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911

From 80ddfc418e71d52e5271257765250335542d8abb Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:11 -0500
Subject: [PATCH 5/6] qt6-tools: Cleanup llvm dependancies

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 071d111aec5ee..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -10,7 +10,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
 hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

From b6904e63c1b6453f0b239a82ec584002fc1448df Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 20:55:10 -0500
Subject: [PATCH 6/6] clazy: Cleanup llvm dependancies

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (16 preceding siblings ...)
  2024-02-10  2:42 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-02-10  4:09 ` Calandracas606
  2024-02-10  4:15 ` Calandracas606
                   ` (31 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:09 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

[ci skip]


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

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

From 5dd6a5634dc0e355d926af073941424164f89a3c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 09:20:48 -0500
Subject: [PATCH 1/6] llvm17: fixup and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/libclc/template    |   1 -
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 166 +++++++++++++++++++++++--------------
 srcpkgs/mesa/template      |   3 +-
 srcpkgs/qt5/template       |   2 +-
 srcpkgs/qt6-tools/template |   2 +-
 8 files changed, 108 insertions(+), 69 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..1d2fa4c871178 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -8,7 +8,6 @@ configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
 hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..8a1295f525bdb 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,26 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp runtimes"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb runtimes"
+desc_option_runtimes="Enable libcxx{,abi}, libunwind and compiler-rt"
 
 case "$XBPS_TARGET_MACHINE" in
 	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +96,32 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
+
+if [ "$build_option_runtimes" ]; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+fi
+
 if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
+	if [ "$CROSS_BUILD" ]; then
+		_enabled_projects+="openmp;"
+	else
+		_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+	fi
 	subpackages+=" libomp libomp-devel "
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +130,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +188,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +235,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +285,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +318,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +360,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +427,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +463,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +488,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +510,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +536,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +547,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +571,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +595,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +618,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +635,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +648,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,15 +673,15 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +691,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..ebf243a053696 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..071d111aec5ee 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,7 +7,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
  gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"

From 4d14852ca92cdd67cc0d913ea912e125dab2bf4f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:01 -0500
Subject: [PATCH 2/6] libclc: Cleanup llvm dependancies

---
 srcpkgs/libclc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index 1d2fa4c871178..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,7 +6,7 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"

From 2bdf3e70e95ee1bc99e991f005cedaa8135195fb Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:05 -0500
Subject: [PATCH 3/6] mesa: Cleanup llvm dependancies

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index ebf243a053696..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911

From 40f0b92bf46e4f0cd45f0246fc2e183bf43a92db Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 19:51:11 -0500
Subject: [PATCH 5/6] qt6-tools: Cleanup llvm dependancies

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 071d111aec5ee..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -10,7 +10,7 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
 hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

From ca13e087fba558b0af94f556234085662c9f4731 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Fri, 9 Feb 2024 20:55:10 -0500
Subject: [PATCH 6/6] clazy: Cleanup llvm dependancies

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (17 preceding siblings ...)
  2024-02-10  4:09 ` Calandracas606
@ 2024-02-10  4:15 ` Calandracas606
  2024-02-10  4:22 ` [PR REVIEW] " Calandracas606
                   ` (30 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:15 UTC (permalink / raw)
  To: ml

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

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#issuecomment-1936852540

Comment:
ccache on cross compiling fixed

Not sure if the revisions should be changed on clazy, libclc, etc. They should build the same way, just the dependencies have been worked 

A lot of existing packages have things like clang17-devel and llvm17-devel

clang17-devel is redundant, as it is a dependency of llvm17-devel. Additionally, clang-tools-extra17 is a dependency of clang17-devel. I didn't remove these in all templates to keep this PR small

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (20 preceding siblings ...)
  2024-02-10  4:22 ` Calandracas606
@ 2024-02-10  4:22 ` Calandracas606
  2024-02-10  4:22 ` Calandracas606
                   ` (27 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:22 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1484947333

Comment:
fixes ccache not working when cross compiling

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (19 preceding siblings ...)
  2024-02-10  4:22 ` [PR REVIEW] " Calandracas606
@ 2024-02-10  4:22 ` Calandracas606
  2024-02-10  4:22 ` Calandracas606
                   ` (28 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:22 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1484947330

Comment:
only needs hostmakedepends since this template only generates header files and bitcode files

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (21 preceding siblings ...)
  2024-02-10  4:22 ` Calandracas606
@ 2024-02-10  4:22 ` Calandracas606
  2024-02-10  4:22 ` Calandracas606
                   ` (26 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:22 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1484947790

Comment:
Something about the shuffling around of components makes this template try to build a man-page when it didn't before.

Generating this man-page requires perl

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (22 preceding siblings ...)
  2024-02-10  4:22 ` Calandracas606
@ 2024-02-10  4:22 ` Calandracas606
  2024-02-10 16:40 ` [PR PATCH] [Updated] " Calandracas606
                   ` (25 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:22 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1484947494

Comment:
Headers to fix the missing stddef.h issue

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (18 preceding siblings ...)
  2024-02-10  4:15 ` Calandracas606
@ 2024-02-10  4:22 ` Calandracas606
  2024-02-10  4:22 ` Calandracas606
                   ` (29 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10  4:22 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1484947458

Comment:
simplified by using the llvm17-cross-tools package

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (23 preceding siblings ...)
  2024-02-10  4:22 ` Calandracas606
@ 2024-02-10 16:40 ` Calandracas606
  2024-02-10 17:06 ` [PR REVIEW] " Sqvid
                   ` (24 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 16:40 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

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

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

From 4ed2428676a9980d061c5e5c31763e444701836f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:07 -0500
Subject: [PATCH 1/6] Fix issues and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 175 +++++++++++++++++++++++--------------
 4 files changed, 112 insertions(+), 66 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..479c2ec9e8dc4 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,27 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+_use_llvm17_runtimes="Yes"
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +97,36 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
+
+if [ "$_use_llvm17_runtimes" = "Yes" ]; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+        case "$XBPS_TARGET_MACHINE" in
+                x86_64*|aarch64*)
+                        # openmp fails when built as runtime if cross-compiled
+                        if [ "$CROSS_BUILD" ]; then
+                                _enabled_projects+="openmp;"
+                        else
+                                _enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+                        fi
+                        subpackages+=" libomp libomp-devel "
+                ;;
+        esac
+
+        configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +135,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +193,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +240,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -280,7 +290,7 @@ post_install() {
 clang17_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	 llvm17-${version}_${revision} "
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +323,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +365,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +432,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +468,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +493,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +515,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +541,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +552,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +576,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +600,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision} llvm17-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +623,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +640,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +653,24 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		vmove usr/lib/clang/17/bin
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,15 +678,15 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +696,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }

From fc9621b41a718cf06280ef1c0e3060159fc9a235 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:42 -0500
Subject: [PATCH 2/6] libclc: Cleanup dependancy on llvm17

---
 srcpkgs/libclc/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,9 +6,8 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"

From fc104a97df6e11f735273edd04b6691bfc090236 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:48 -0500
Subject: [PATCH 3/6] clazy: Cleanup dependancy on llvm17

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

From 1d098486326ca2abb23e82f3847fcacdaa934b68 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:22 -0500
Subject: [PATCH 4/6] mesa: Cleanup dependancy on llvm17

---
 srcpkgs/mesa/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }

From b4dfd1c1f84fa304569346467b55b7b9147cdf27 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:03 -0500
Subject: [PATCH 5/6] qt5: Cleanup dependancy on llvm17

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel

From d8d94d21c5e9d4fc0b16507bb86661691bf07590 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:25 -0500
Subject: [PATCH 6/6] qt6-tools: Cleanup dependancy on llvm17

---
 srcpkgs/qt6-tools/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,10 +7,10 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (24 preceding siblings ...)
  2024-02-10 16:40 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-02-10 17:06 ` Sqvid
  2024-02-10 17:07 ` Sqvid
                   ` (23 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Sqvid @ 2024-02-10 17:06 UTC (permalink / raw)
  To: ml

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

New review comment by Sqvid on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485202844

Comment:
I don't think the headers should be a separate package. Surely the headers should always be tied to the compiler. Can't way just add the vmove command to clang17_package() within its pkg_install()? This is how clang15 does it

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (25 preceding siblings ...)
  2024-02-10 17:06 ` [PR REVIEW] " Sqvid
@ 2024-02-10 17:07 ` Sqvid
  2024-02-10 17:14 ` Duncaen
                   ` (22 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Sqvid @ 2024-02-10 17:07 UTC (permalink / raw)
  To: ml

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

New review comment by Sqvid on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485202844

Comment:
I don't think the headers should be a separate package. Surely the headers should always be tied to the compiler. Can't we just add the vmove command to clang17_package() within its pkg_install()? This is how clang15 does it

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (26 preceding siblings ...)
  2024-02-10 17:07 ` Sqvid
@ 2024-02-10 17:14 ` Duncaen
  2024-02-10 17:14 ` Duncaen
                   ` (21 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:14 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485200708

Comment:
I think i would if do `if true; then` here and add a comment like `# enable if runtime subpackages link to this version`. No real point in adding a variable and coming up with a value that means enable.

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (27 preceding siblings ...)
  2024-02-10 17:14 ` Duncaen
@ 2024-02-10 17:14 ` Duncaen
  2024-02-10 17:15 ` Calandracas606
                   ` (20 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:14 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485203697

Comment:
I don't think `llvm-libunwind-devel`, `libcxxabi-devel`, `libcxx-devel` should depend on llvm17.

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (28 preceding siblings ...)
  2024-02-10 17:14 ` Duncaen
@ 2024-02-10 17:15 ` Calandracas606
  2024-02-10 17:17 ` Duncaen
                   ` (19 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 17:15 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485204015

Comment:
Mesa depends on those headers when building opencl kernerls, but does not need clang installed to function (only needs libclang-cpp)

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (29 preceding siblings ...)
  2024-02-10 17:15 ` Calandracas606
@ 2024-02-10 17:17 ` Duncaen
  2024-02-10 17:27 ` Duncaen
                   ` (18 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:17 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485204219

Comment:
Forgot this also needs `usr/lib/clang/17/share`, those files currently end up in `llvm17`;
```
/usr/lib/clang/17/share/asan_ignorelist.txt
/usr/lib/clang/17/share/cfi_ignorelist.txt
/usr/lib/clang/17/share/dfsan_abilist.txt
/usr/lib/clang/17/share/hwasan_ignorelist.txt
/usr/lib/clang/17/share/msan_ignorelist.txt
```

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (30 preceding siblings ...)
  2024-02-10 17:17 ` Duncaen
@ 2024-02-10 17:27 ` Duncaen
  2024-02-10 17:29 ` Duncaen
                   ` (17 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:27 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485205559

Comment:
libclang and libclang-cpp are "embedded" compilers, they need those headers. As example the `include-what-you-use` just uses libclang to parse c files and won't work without those headers.
There might be users who just use `include-what-you-use` without clang binaries.

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (31 preceding siblings ...)
  2024-02-10 17:27 ` Duncaen
@ 2024-02-10 17:29 ` Duncaen
  2024-02-10 17:30 ` Duncaen
                   ` (16 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:29 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485205733

Comment:
`clang17` will in the end depend on `clang17-headers`, that it doesn't ship with them is a bug in the current version that is in the repositories, where those files ended up in `clang17-devel` instead of a separate package or as part of the `clang17` package.

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (32 preceding siblings ...)
  2024-02-10 17:29 ` Duncaen
@ 2024-02-10 17:30 ` Duncaen
  2024-02-10 17:31 ` Sqvid
                   ` (15 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 17:30 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485205733

Comment:
`clang17` will in the end depend on `clang17-headers`, that the current version in the repositories is missing them is a issue that will be resolved (The headers ended up in `clang17-devel` instead of a separate package or as part of the `clang17` package).

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (33 preceding siblings ...)
  2024-02-10 17:30 ` Duncaen
@ 2024-02-10 17:31 ` Sqvid
  2024-02-10 17:33 ` Sqvid
                   ` (14 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Sqvid @ 2024-02-10 17:31 UTC (permalink / raw)
  To: ml

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

New review comment by Sqvid on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485205951

Comment:
@Duncaen is there a use case for having just the headers in a separate package? When would one want to install just those?

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (34 preceding siblings ...)
  2024-02-10 17:31 ` Sqvid
@ 2024-02-10 17:33 ` Sqvid
  2024-02-10 17:44 ` Sqvid
                   ` (13 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Sqvid @ 2024-02-10 17:33 UTC (permalink / raw)
  To: ml

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

New review comment by Sqvid on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485205951

Comment:
@Duncaen is there a use case for having just the headers in a separate package? When would one want to install just those?

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (35 preceding siblings ...)
  2024-02-10 17:33 ` Sqvid
@ 2024-02-10 17:44 ` Sqvid
  2024-02-10 17:58 ` Calandracas606
                   ` (12 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Sqvid @ 2024-02-10 17:44 UTC (permalink / raw)
  To: ml

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

New review comment by Sqvid on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485207575

Comment:
From reading your examples doesn't it sound like the headers should just be packaged in libclang then and have clang17 depend on libclang? It still feels like having solely the headers as a standalone doesn't have much benefit. Would I ever want to install the headers without libclang?

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (36 preceding siblings ...)
  2024-02-10 17:44 ` Sqvid
@ 2024-02-10 17:58 ` Calandracas606
  2024-02-10 18:02 ` Calandracas606
                   ` (11 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 17:58 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485209266

Comment:
Both libclang and libclang-cpp need the headers

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (37 preceding siblings ...)
  2024-02-10 17:58 ` Calandracas606
@ 2024-02-10 18:02 ` Calandracas606
  2024-02-10 18:06 ` Duncaen
                   ` (10 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 18:02 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485209763

Comment:
Although combining libclang-cpp17, and clang17-headers into the libclang17 package might be reasonable

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (38 preceding siblings ...)
  2024-02-10 18:02 ` Calandracas606
@ 2024-02-10 18:06 ` Duncaen
  2024-02-10 18:06 ` Duncaen
                   ` (9 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 18:06 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485210188

Comment:
`libclang17` and `libclang-cpp17` both need the headers and don't depend on each other. `clang17` depends on `libclang-cpp17`.

Having the headers in a separate package is pretty standard, [alpine does the same](https://pkgs.alpinelinux.org/package/edge/main/x86_64/clang17-headers), [debian calls the package libclang-common](https://packages.debian.org/sid/all/libclang-common-17-dev/filelist), [fedora just has a single `clang-libs` package containing both libraries and the headers](https://packages.fedoraproject.org/pkgs/clang/clang-libs/fedora-rawhide.html).

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (39 preceding siblings ...)
  2024-02-10 18:06 ` Duncaen
@ 2024-02-10 18:06 ` Duncaen
  2024-02-10 18:08 ` Duncaen
                   ` (8 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 18:06 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485210188

Comment:
`libclang17` and `libclang-cpp17` both need the headers and don't depend on each other. `clang17` depends on `libclang-cpp17`.

Having the headers in a separate package is pretty standard, [alpine does the same](https://pkgs.alpinelinux.org/package/edge/main/x86_64/clang17-headers), [debian calls the package libclang-common](https://packages.debian.org/sid/all/libclang-common-17-dev/filelist), [fedora just has a single `clang-libs` package containing both libraries (libclang and libclang-cpp) and the headers](https://packages.fedoraproject.org/pkgs/clang/clang-libs/fedora-rawhide.html).

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (40 preceding siblings ...)
  2024-02-10 18:06 ` Duncaen
@ 2024-02-10 18:08 ` Duncaen
  2024-02-10 18:11 ` Duncaen
                   ` (7 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 18:08 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485210443

Comment:
I think the split is fine, `libclang-cpp17` is 64MB and `libclang17` is 35MB, just installing one of them if the other is not required seems like a good idea. 

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (41 preceding siblings ...)
  2024-02-10 18:08 ` Duncaen
@ 2024-02-10 18:11 ` Duncaen
  2024-02-10 18:12 ` Duncaen
                   ` (6 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 18:11 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485210188

Comment:
`libclang17` and `libclang-cpp17` both need the headers and don't depend on each other. `clang17` depends on `libclang-cpp17`.

Having the headers in a separate package is pretty standard, [alpine does the same](https://pkgs.alpinelinux.org/package/edge/main/x86_64/clang17-headers), [debian calls the package libclang-common](https://packages.debian.org/sid/all/libclang-common-17-dev/filelist), only [fedora just has a single `clang-libs` package containing both libraries (libclang and libclang-cpp) and the headers](https://packages.fedoraproject.org/pkgs/clang/clang-libs/fedora-rawhide.html).

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (42 preceding siblings ...)
  2024-02-10 18:11 ` Duncaen
@ 2024-02-10 18:12 ` Duncaen
  2024-02-10 18:46 ` Calandracas606
                   ` (5 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 18:12 UTC (permalink / raw)
  To: ml

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

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485210188

Comment:
`libclang17` and `libclang-cpp17` both need the headers and don't depend on each other. `clang17` depends on `libclang-cpp17`.

Having the headers in a separate package is pretty standard, [alpine does the same](https://pkgs.alpinelinux.org/package/edge/main/x86_64/clang17-headers), [debian is similar, just a different name: libclang-common](https://packages.debian.org/sid/all/libclang-common-17-dev/filelist), only [fedora just has a single `clang-libs` package](https://packages.fedoraproject.org/pkgs/clang/clang-libs/fedora-rawhide.html) containing both libraries (libclang and libclang-cpp) and the headers.

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR REVIEW] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (43 preceding siblings ...)
  2024-02-10 18:12 ` Duncaen
@ 2024-02-10 18:46 ` Calandracas606
  2024-02-10 18:47 ` [PR PATCH] [Updated] " Calandracas606
                   ` (4 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 18:46 UTC (permalink / raw)
  To: ml

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

New review comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48625#discussion_r1485215115

Comment:
`usr/lib/clang/17/share` and `usr/lib/clang/17/bin` are not built on armv*, along with many of the components in `usr/lib/clang/17/bin`

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (44 preceding siblings ...)
  2024-02-10 18:46 ` Calandracas606
@ 2024-02-10 18:47 ` Calandracas606
  2024-02-10 21:01 ` Calandracas606
                   ` (3 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 18:47 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

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

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

From 9636d998faca2b99d269b72951c34fdc028f945d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:07 -0500
Subject: [PATCH 1/6] llvm17: Fix issues and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 180 +++++++++++++++++++++++--------------
 4 files changed, 116 insertions(+), 67 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..70afbc90fd53b 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,25 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +95,37 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -279,8 +288,7 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +321,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +363,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +430,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +466,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +491,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +513,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +539,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +550,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +574,13 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +598,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +621,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +638,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +651,29 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*|aarch64*)
+				vmove usr/lib/clang/17/bin
+				vmove usr/lib/clang/17/share
+			;;
+		esac
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,15 +681,15 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +699,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }

From 93edd1724b31f772db21524b2052c873ae02f723 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:42 -0500
Subject: [PATCH 2/6] libclc: Cleanup dependancy on llvm17

---
 srcpkgs/libclc/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,9 +6,8 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"

From 306c59f85346cc84a01c1bf32a77687187fc9c48 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:48 -0500
Subject: [PATCH 3/6] clazy: Cleanup dependancy on llvm17

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

From 27a7e162f2727a3644882cbf4adf6d0f8ba5fb48 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:22 -0500
Subject: [PATCH 4/6] mesa: Cleanup dependancy on llvm17

---
 srcpkgs/mesa/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }

From a5e5bc8dcf878e7ad9fe87498592e74e64e53468 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:03 -0500
Subject: [PATCH 5/6] qt5: Cleanup dependancy on llvm17

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..126069709d117 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,7 +7,7 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
 makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel

From 06b4bb39f0b756860d7b399c58aed895fde46fc9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:25 -0500
Subject: [PATCH 6/6] qt6-tools: Cleanup dependancy on llvm17

---
 srcpkgs/qt6-tools/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,10 +7,10 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (45 preceding siblings ...)
  2024-02-10 18:47 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-02-10 21:01 ` Calandracas606
  2024-02-10 21:18 ` Calandracas606
                   ` (2 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 21:01 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

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

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

From 2d65406f9c8ca6016ffa78a398f3756279440cbd Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:07 -0500
Subject: [PATCH 1/6] llvm17: Fix issues and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 183 +++++++++++++++++++++++--------------
 4 files changed, 119 insertions(+), 67 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..79540071ce97a 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,25 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +95,37 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -279,8 +288,7 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +321,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17-${version}_${revision} clang-analyzer17-${version}_${revision}
+		llvm17-${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17-${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,14 +363,16 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers-${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
@@ -408,7 +430,7 @@ llvm-bolt17_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -444,7 +466,7 @@ lldb17_package() {
 
 lldb17-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb17-${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -469,7 +491,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +513,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -516,7 +539,7 @@ flang17_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
@@ -527,7 +550,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +574,16 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp-${version}_${revision} llvm17-${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
+		if [ -f "${DESTDIR}/usr/share/man/man1/llvmopenmp.1" ]; then
+			vmove usr/share/man/man1/llvmopenmp.1
+		fi
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -576,7 +601,7 @@ llvm-libunwind_package() {
 
 llvm-libunwind-devel_package() {
 	short_desc+=" - libunwind - development files"
-	depends="llvm-libunwind>=${version}_${revision}"
+	depends="llvm-libunwind-${version}_${revision}"
 	conflicts="libunwind-devel>=0"
 	pkg_install() {
 		vmove usr/include/mach-o
@@ -599,7 +624,7 @@ libcxxabi_package() {
 
 libcxxabi-devel_package() {
 	short_desc+=" - low level support for libc++ - development files"
-	depends="libcxxabi>=${version}_${revision}"
+	depends="libcxxabi-${version}_${revision}"
 	pkg_install() {
 		vmove "usr/include/*cxxabi*"
 		vmove "usr/lib/libc++abi.so"
@@ -616,7 +641,7 @@ libcxx_package() {
 
 libcxx-devel_package() {
 	short_desc+=" - C++ standard library - development files"
-	depends="libcxx>=${version}_${revision}"
+	depends="libcxx-${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/c++
 		vmove "usr/lib/libc++.so"
@@ -629,15 +654,29 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		if [ -d "${DESTDIR}/usr/lib/clang/17/bin" ]; then
+			vmove usr/lib/clang/17/bin
+		fi
+		if [ -d "${DESTDIR}/usr/lib/clang/17/share" ]; then
+			vmove usr/lib/clang/17/share
+		fi
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -645,15 +684,15 @@ llvm17-doc_package() {
 
 llvm17-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm17-${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel-${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel-${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +702,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel-${version}_${revision} llvm17-devel-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }

From 0a6e414e503041318c7edc736bec9aab9ab595b5 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:42 -0500
Subject: [PATCH 2/6] libclc: Cleanup dependancy on llvm17

---
 srcpkgs/libclc/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,9 +6,8 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"

From 5038f0109eb679a0551c10c7b32af61979bf8b9a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:48 -0500
Subject: [PATCH 3/6] clazy: Cleanup dependancy on llvm17

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

From 37dc2f831abe079017686fe8f5859035387e4db7 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:22 -0500
Subject: [PATCH 4/6] mesa: Cleanup dependancy on llvm17

---
 srcpkgs/mesa/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }

From 0943a806e59e08b3c66e89cb8489094692044542 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:03 -0500
Subject: [PATCH 5/6] qt5: Cleanup dependancy on llvm17

---
 srcpkgs/qt5/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..3efb7e42d5fd3 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,9 +7,9 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
-makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
+makedepends="clang17-devel SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
  gtk+3-devel icu-devel libXv-devel libbluetooth-devel libcap-devel
  libinput-devel libmng-devel libmariadbclient-devel libproxy-devel

From e3632dfbde7a7c9f58d2feca90cc779dcade39aa Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:25 -0500
Subject: [PATCH 6/6] qt6-tools: Cleanup dependancy on llvm17

---
 srcpkgs/qt6-tools/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,10 +7,10 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (46 preceding siblings ...)
  2024-02-10 21:01 ` Calandracas606
@ 2024-02-10 21:18 ` Calandracas606
  2024-02-10 21:22 ` Calandracas606
  2024-02-10 21:30 ` [PR PATCH] [Merged]: " Duncaen
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 21:18 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

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

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

From 7e7a0b0dec7103069baafda5195d08bc890f9846 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:07 -0500
Subject: [PATCH 1/6] llvm17: Fix issues and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 173 ++++++++++++++++++++++++-------------
 4 files changed, 114 insertions(+), 62 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..d2aa7902db380 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,25 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +95,37 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -279,8 +288,7 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +321,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+		clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
+		llvm17>=${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17>=${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,21 +363,23 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
 }
 
 clang-analyzer17_package() {
-	depends="clang17-${version}_${revision} python3 perl"
+	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
 	pkg_install() {
@@ -380,7 +402,7 @@ clang-analyzer17_package() {
 
 clang-tools-extra17_package() {
 	lib32disabled=yes
-	depends="clang17-${version}_${revision} python3"
+	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
 	pkg_install() {
@@ -469,7 +491,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +513,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -527,7 +550,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +574,16 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
+		if [ -f "${DESTDIR}/usr/share/man/man1/llvmopenmp.1" ]; then
+			vmove usr/share/man/man1/llvmopenmp.1
+		fi
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -629,15 +654,29 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		if [ -d "${DESTDIR}/usr/lib/clang/17/bin" ]; then
+			vmove usr/lib/clang/17/bin
+		fi
+		if [ -d "${DESTDIR}/usr/lib/clang/17/share" ]; then
+			vmove usr/lib/clang/17/share
+		fi
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +686,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +702,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }

From e91e1303e6f9ef7e6fd8acb486fd25c14b61388c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:42 -0500
Subject: [PATCH 2/6] libclc: Cleanup dependancy on llvm17

---
 srcpkgs/libclc/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,9 +6,8 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"

From dbe971b1b17fe2543bc32f6f7e1b93d8fd35d8d2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:48 -0500
Subject: [PATCH 3/6] clazy: Cleanup dependancy on llvm17

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

From 1ff5cb7c88e5c3b920fad467e9fb6b30af370bf1 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:22 -0500
Subject: [PATCH 4/6] mesa: Cleanup dependancy on llvm17

---
 srcpkgs/mesa/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }

From 3ec04ac6888b0ee9f3cf5d420c2e69881dcf9b29 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:03 -0500
Subject: [PATCH 5/6] qt5: Cleanup dependancy on llvm17

---
 srcpkgs/qt5/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..3efb7e42d5fd3 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,9 +7,9 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
-makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
+makedepends="clang17-devel SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
  gtk+3-devel icu-devel libXv-devel libbluetooth-devel libcap-devel
  libinput-devel libmng-devel libmariadbclient-devel libproxy-devel

From f5f54d580b5d5dfff1d563b11801113de2abd8d8 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:25 -0500
Subject: [PATCH 6/6] qt6-tools: Cleanup dependancy on llvm17

---
 srcpkgs/qt6-tools/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,10 +7,10 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Updated] llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (47 preceding siblings ...)
  2024-02-10 21:18 ` Calandracas606
@ 2024-02-10 21:22 ` Calandracas606
  2024-02-10 21:30 ` [PR PATCH] [Merged]: " Duncaen
  49 siblings, 0 replies; 51+ messages in thread
From: Calandracas606 @ 2024-02-10 21:22 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Calandracas606/void-packages llvm17-fixup
https://github.com/void-linux/void-packages/pull/48625

llvm17: fixup and refactor
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

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

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

From ca0211acb689abb13ac7f54174638247defe3373 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:07 -0500
Subject: [PATCH 1/6] llvm17: Fix issues and refactor

---
 srcpkgs/clang17-headers    |   1 +
 srcpkgs/compiler-rt        |   1 +
 srcpkgs/llvm17-cross-tools |   1 +
 srcpkgs/llvm17/template    | 173 ++++++++++++++++++++++++-------------
 4 files changed, 114 insertions(+), 62 deletions(-)
 create mode 120000 srcpkgs/clang17-headers
 create mode 120000 srcpkgs/compiler-rt
 create mode 120000 srcpkgs/llvm17-cross-tools

diff --git a/srcpkgs/clang17-headers b/srcpkgs/clang17-headers
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/clang17-headers
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17-cross-tools b/srcpkgs/llvm17-cross-tools
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/llvm17-cross-tools
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index 7bc22ec50272e..aef0bf773d6be 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,9 +24,9 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
- -DLLVM_ENABLE_RUNTIMES=all
  -DLLVM_BINUTILS_INCDIR=/usr/include
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
  -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
@@ -36,7 +36,6 @@ hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config "
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
  libxml2-devel binutils-devel "
-depends="libllvm17>=${version}_${revision}"
 short_desc="LLVM Compiler Infrastructure Project - Version 17"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
@@ -46,25 +45,25 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt openmp ";;
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
 esac
 
-if [ "$XBPS_CCACHE" ]; then
-	configure_args+=" -DLLVM_CCACHE_BUILD=YES "
-fi
-
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
 fi
 if [ "$build_option_clang_tools_extra" ]; then
 	_enabled_projects+="clang-tools-extra;"
@@ -96,15 +95,37 @@ if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
 	subpackages+=" flang17 flang17-devel "
 fi
-if [ "$build_option_openmp" ]; then
-	_enabled_projects+="openmp;"
-	subpackages+=" libomp libomp-devel "
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
-subpackages+=" llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel libcxxabi libcxxabi-devel libllvm17 llvm17-doc llvm17-devel "
 
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -113,6 +134,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -170,37 +192,16 @@ pre_configure() {
 	esac
 
 	if [ "$CROSS_BUILD" ]; then
-		msg_normal "Building host tblgen\n"
-		mkdir -p build/HOST
-		cd build/HOST
-		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
-			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
-			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-			-DLLVM_ENABLE_PROJECTS=${_enabled_projects}
-
-		make ${makejobs} -C utils/TableGen
-		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
-
-		make ${makejobs} -C tools/clang/utils/TableGen
-		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
-
-		make ${makejobs} -C tools/mlir/tools/mlir-pdll
-		configure_args+=" -DMLIR_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-tblgen"
-		configure_args+=" -DMLIR_PDLL_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/mlir-pdll"
-		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=${wrksrc}/llvm/build/HOST/bin/mlir-linalg-ods-yaml-gen"
-
-		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
-		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
-		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
-		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
-
-		make ${makejobs} -C tools/llvm-config
-		configure_args+=" -DLLVM_CONFIG_PATH=${wrksrc}/llvm/build/HOST/bin/llvm-config"
-
-		make ${makejobs} -C tools/lldb/utils/TableGen lldb-tblgen
-		configure_args+=" -DLLDB_TABLEGEN_EXE=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
-
-		cd ../..
+		configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin"
+		configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen"
+		configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen"
+		configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll"
+		configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen"
+		configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config"
+		configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen"
 	fi
 
 	case "$XBPS_TARGET_MACHINE" in
@@ -238,6 +239,14 @@ post_build() {
 		-DSPHINX_WARNINGS_AS_ERRORS=OFF
 
 	ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html
+
+	if [ -z "$CROSS_BUILD" ]; then
+		# Binaries ONLY used during the process of building llvm, and aren't usually installed
+		vmkdir usr/bin
+		vcopy build/bin/lldb-tblgen usr/bin
+		vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin
+		vcopy build/bin/clang-pseudo-gen usr/bin
+	fi
 }
 
 post_install() {
@@ -279,8 +288,7 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision} "
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -313,16 +321,28 @@ clang17_package() {
 	}
 }
 
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
 clang17-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 libclang17-${version}_${revision}"
+	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
+	 llvm17>=${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17>=${version}_${revision}"
+	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
 		vmove usr/include/clang
 		vmove usr/include/clang-c
-		vmove usr/lib/clang
 		vmove usr/lib/libear
 		vmove usr/lib/cmake/clang
 		vmove "usr/lib/libclang*.a"
@@ -343,21 +363,23 @@ clang17-devel_package() {
 }
 
 libclang17_package() {
-	short_desc+=" - C frontend runtime library"
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
 libclang-cpp17_package() {
-	short_desc+=" - C frontend runtime library (C++ interface)"
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
 }
 
 clang-analyzer17_package() {
-	depends="clang17-${version}_${revision} python3 perl"
+	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
 	pkg_install() {
@@ -380,7 +402,7 @@ clang-analyzer17_package() {
 
 clang-tools-extra17_package() {
 	lib32disabled=yes
-	depends="clang17-${version}_${revision} python3"
+	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
 	pkg_install() {
@@ -469,7 +491,7 @@ lld17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision}"
+	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -491,6 +513,7 @@ mlir17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -527,7 +550,7 @@ flang17-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision}"
+	depends="flang17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -551,14 +574,16 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
 		vmove "usr/lib/libarcher*.so"
 		vmove "usr/lib/libomp*.so"
 		vmove usr/lib/cmake/openmp
-		vmove usr/share/man/man1/llvmopenmp.1
+		if [ -f "${DESTDIR}/usr/share/man/man1/llvmopenmp.1" ]; then
+			vmove usr/share/man/man1/llvmopenmp.1
+		fi
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove "usr/lib/libomptarget*.bc"
 			vmove "usr/lib/libarcher*.a"
@@ -629,15 +654,29 @@ libcxx-devel_package() {
 	}
 }
 
+compiler-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		if [ -d "${DESTDIR}/usr/lib/clang/17/bin" ]; then
+			vmove usr/lib/clang/17/bin
+		fi
+		if [ -d "${DESTDIR}/usr/lib/clang/17/share" ]; then
+			vmove usr/lib/clang/17/share
+		fi
+	}
+}
+
 libllvm17_package() {
-	short_desc+=" - runtime library"
+	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
 llvm17-doc_package() {
-	short_desc+=" - documentation "
+	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
@@ -647,13 +686,13 @@ llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>={$version}_${revision} "
+		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>={$version}_${revision} "
+		depends+=" mlir17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>={$version}_${revision} "
+		depends+=" clang17-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -663,6 +702,16 @@ llvm17-devel_package() {
 		vmove usr/include/llvm-c
 		vmove "usr/lib/libLLVM*.a"
 		vmove usr/lib/cmake/llvm
+	}
+}
 
+# These binaries are ONLY used when building llvm, they aren't normally installed
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/lldb-tblgen
+		vmove usr/bin/clang-tidy-confusable-chars-gen
+		vmove usr/bin/clang-pseudo-gen
 	}
 }

From 63d3abeae602fe1b5be12c53d22effdcb148e675 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:42 -0500
Subject: [PATCH 2/6] libclc: Cleanup dependancy on llvm17

---
 srcpkgs/libclc/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/libclc/template b/srcpkgs/libclc/template
index fa0807f9ace69..714d6acbb404f 100644
--- a/srcpkgs/libclc/template
+++ b/srcpkgs/libclc/template
@@ -6,9 +6,8 @@ build_style=cmake
 # disable clspv (failing tests, we don't ship it)
 configure_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  -DLIBCLC_TARGETS_TO_BUILD=amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl;spirv-mesa3d-;spirv64-mesa3d-"
-hostmakedepends="clang17 llvm17-devel python3 libedit-devel libffi-devel
+hostmakedepends="llvm17-devel python3 libedit-devel libffi-devel
  ncurses-devel zlib-devel SPIRV-LLVM-Translator"
-makedepends="llvm17-devel"
 short_desc="Open implementation of the OpenCL C programming language"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="BSD-3-Clause, MIT"

From bf77a3c9579bec1e543e33aa3de2f14359ae393e Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:37:48 -0500
Subject: [PATCH 3/6] clazy: Cleanup dependancy on llvm17

---
 srcpkgs/clazy/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index fdab8dda0b89b..5d9cf7c7cb04a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -4,8 +4,8 @@ version=1.11
 revision=3
 build_style=cmake
 build_helper=qemu
-hostmakedepends="llvm"
-makedepends="clang llvm17-devel clang-tools-extra"
+hostmakedepends="llvm17 perl"
+makedepends="llvm17-devel"
 depends="clang"
 short_desc="Qt oriented code checker based on clang framework"
 maintainer="John <me@johnnynator.dev>"

From 675f2cc5bb473660c557f6b97a886f5e3f67fc9c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:38:22 -0500
Subject: [PATCH 4/6] mesa: Cleanup dependancy on llvm17

---
 srcpkgs/mesa/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f763b99e58098..8613d434f71b2 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=23.3.5
-revision=2
+revision=3
 build_style=meson
 _llvmver=17
 #Disable LTO flag should be present, see https://gitlab.freedesktop.org/mesa/mesa/-/issues/6911
@@ -9,7 +9,7 @@ configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
  -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++17"
-hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}-devel
+hostmakedepends="gettext flex pkg-config python3-Mako glslang llvm${_llvmver}
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
  libXxf86vm-devel libdrm-devel libffi-devel libva-devel
@@ -188,7 +188,6 @@ post_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		find -iname "*.ninja" -exec sed -i "{}" \
 			-e "/rustc/s; --sysroot ${XBPS_CROSS_BASE}/usr;;g" \
-			-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
 			\;
 	fi
 }

From 003c917cffec191e566cf26da9e2ce00b7481c4b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:03 -0500
Subject: [PATCH 5/6] qt5: Cleanup dependancy on llvm17

---
 srcpkgs/qt5/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 6855e526a100a..3efb7e42d5fd3 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -7,9 +7,9 @@ version=5.15.11+20231124
 # base repo: https://invent.kde.org/qt/qt/qt5
 revision=2
 build_style=meta
-hostmakedepends="cmake llvm17 clang17 clang17-devel flex perl glib-devel pkg-config
+hostmakedepends="cmake clang17 flex perl glib-devel pkg-config
  python3 re2c ruby which"
-makedepends="SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
+makedepends="clang17-devel SDL2-devel Vulkan-Headers alsa-lib-devel double-conversion-devel
  eudev-libudev-devel ffmpeg-devel freetds-devel glib-devel gst-plugins-base1-devel
  gtk+3-devel icu-devel libXv-devel libbluetooth-devel libcap-devel
  libinput-devel libmng-devel libmariadbclient-devel libproxy-devel

From 3c25415a2d5f50384ecf32abec3b977129fb7074 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 10 Feb 2024 11:39:25 -0500
Subject: [PATCH 6/6] qt6-tools: Cleanup dependancy on llvm17

---
 srcpkgs/qt6-tools/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index 358f58a282a76..986db5dffd239 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -7,10 +7,10 @@ configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON
  -DQT_FEATURE_pixeltool=ON
  -DQT_FEATURE_distancefieldgenerator=ON"
-hostmakedepends="qt6-base perl qt6-plugin-sqlite clang clang-tools-extra
+hostmakedepends="qt6-base perl qt6-plugin-sqlite clang17 clang-tools-extra17
  qt6-declarative-host-tools"
 makedepends="qt6-base-devel qt6-plugin-sqlite qt6-declarative-devel
- gumbo-parser-devel icu-devel llvm17-devel clang-tools-extra"
+ gumbo-parser-devel icu-devel llvm17-devel"
 short_desc="Cross-platform application and UI framework (QT6) - qt6-tools component"
 maintainer="John <me@johnnynator.dev>"
 license="custom:GPL-3.0-only-with-Qt-GPL-exception-1.0, LGPL-3.0-only, GPL-2.0-or-later"

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PR PATCH] [Merged]: llvm17: fixup and refactor
  2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
                   ` (48 preceding siblings ...)
  2024-02-10 21:22 ` Calandracas606
@ 2024-02-10 21:30 ` Duncaen
  49 siblings, 0 replies; 51+ messages in thread
From: Duncaen @ 2024-02-10 21:30 UTC (permalink / raw)
  To: ml

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

There's a merged pull request on the void-packages repository

llvm17: fixup and refactor
https://github.com/void-linux/void-packages/pull/48625

Description:
<!-- 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**|**NO**
-->

<!-- 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-musl

Fixes an issue where clang17 fails to compile anything due to missing headers (stddef.h)

In the meantime, clang17-devel needs to be installed to use clang17

[ci skip]

closes #48616

^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2024-02-10 21:30 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 14:22 [PR PATCH] llvm17: fixup and refactor Calandracas606
2024-02-09 14:24 ` [PR PATCH] [Updated] " Calandracas606
2024-02-09 14:25 ` Calandracas606
2024-02-09 14:46 ` Calandracas606
2024-02-09 14:58 ` Calandracas606
2024-02-09 16:37 ` Calandracas606
2024-02-09 18:01 ` Calandracas606
2024-02-09 18:27 ` Calandracas606
2024-02-09 18:30 ` Calandracas606
2024-02-09 18:48 ` Calandracas606
2024-02-09 20:55 ` Calandracas606
2024-02-09 21:59 ` Calandracas606
2024-02-09 22:01 ` Calandracas606
2024-02-10  0:51 ` Calandracas606
2024-02-10  2:11 ` Calandracas606
2024-02-10  2:15 ` Calandracas606
2024-02-10  2:38 ` Calandracas606
2024-02-10  2:42 ` [PR PATCH] [Updated] " Calandracas606
2024-02-10  4:09 ` Calandracas606
2024-02-10  4:15 ` Calandracas606
2024-02-10  4:22 ` [PR REVIEW] " Calandracas606
2024-02-10  4:22 ` Calandracas606
2024-02-10  4:22 ` Calandracas606
2024-02-10  4:22 ` Calandracas606
2024-02-10  4:22 ` Calandracas606
2024-02-10 16:40 ` [PR PATCH] [Updated] " Calandracas606
2024-02-10 17:06 ` [PR REVIEW] " Sqvid
2024-02-10 17:07 ` Sqvid
2024-02-10 17:14 ` Duncaen
2024-02-10 17:14 ` Duncaen
2024-02-10 17:15 ` Calandracas606
2024-02-10 17:17 ` Duncaen
2024-02-10 17:27 ` Duncaen
2024-02-10 17:29 ` Duncaen
2024-02-10 17:30 ` Duncaen
2024-02-10 17:31 ` Sqvid
2024-02-10 17:33 ` Sqvid
2024-02-10 17:44 ` Sqvid
2024-02-10 17:58 ` Calandracas606
2024-02-10 18:02 ` Calandracas606
2024-02-10 18:06 ` Duncaen
2024-02-10 18:06 ` Duncaen
2024-02-10 18:08 ` Duncaen
2024-02-10 18:11 ` Duncaen
2024-02-10 18:12 ` Duncaen
2024-02-10 18:46 ` Calandracas606
2024-02-10 18:47 ` [PR PATCH] [Updated] " Calandracas606
2024-02-10 21:01 ` Calandracas606
2024-02-10 21:18 ` Calandracas606
2024-02-10 21:22 ` Calandracas606
2024-02-10 21:30 ` [PR PATCH] [Merged]: " Duncaen

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).