Github messages for voidlinux
 help / color / mirror / Atom feed
From: Calandracas606 <Calandracas606@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] DRAFT: llvm19: bootstrap build, fix cmake, fix spirv translator
Date: Sat, 16 Nov 2024 23:04:33 +0100	[thread overview]
Message-ID: <20241116220433.1164421FA5@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-53096@inbox.vuxu.org>

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

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

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

DRAFT: llvm19: bootstrap build, fix cmake, fix spirv translator
<!-- Uncomment relevant sections and delete options which are not applicable -->

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

<!--
#### 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-glibc
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
<!--
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->

[ci skip]


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

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

From d866fac8f94c238be93604a7a59d7536623640e7 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 16 Nov 2024 14:27:12 -0500
Subject: [PATCH 1/5] New package: llvm19-bootstrap-19.1.3

---
 srcpkgs/llvm19-bootstrap/patches  |  1 +
 srcpkgs/llvm19-bootstrap/template | 74 +++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 120000 srcpkgs/llvm19-bootstrap/patches
 create mode 100644 srcpkgs/llvm19-bootstrap/template

diff --git a/srcpkgs/llvm19-bootstrap/patches b/srcpkgs/llvm19-bootstrap/patches
new file mode 120000
index 00000000000000..61bc4babf371f0
--- /dev/null
+++ b/srcpkgs/llvm19-bootstrap/patches
@@ -0,0 +1 @@
+../llvm19/patches
\ No newline at end of file
diff --git a/srcpkgs/llvm19-bootstrap/template b/srcpkgs/llvm19-bootstrap/template
new file mode 100644
index 00000000000000..223bcfd2e01c1e
--- /dev/null
+++ b/srcpkgs/llvm19-bootstrap/template
@@ -0,0 +1,74 @@
+# Template file for 'llvm19-bootstrap'
+pkgname=llvm19-bootstrap
+version=19.1.3
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release -Wno-dev
+ -DENABLE_LINKER_BUILD_ID=YES
+ -DLLVM_INSTALL_UTILS=YES
+ -DLLVM_BINUTILS_INCDIR=/usr/include
+ -DBASE_LLVM_VERSION=${version}
+ -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
+ -DLLVM_TARGETS_TO_BUILD=Native
+ -DLLVM_ENABLE_PROJECTS=clang;lld
+"
+hostmakedepends="perl python3 pkg-config"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel z3-devel SPIRV-Headers SPIRV-Tools-devel"
+short_desc="LLVM Compiler Infrastructure Project - Version 19"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0 AND NCSA AND custom:Apache-2.0-with-llvm-exception"
+homepage="https://www.llvm.org"
+_spirv_version=v19.1.1
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz
+ https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/${_spirv_version}.tar.gz"
+checksum="e5106e2bef341b3f5e41340e4b6c6a58259f4021ad801acf14e88f1a84567b05
+ 7f6f7a1af0eb40910ddf3a7647d2186c8c5dc5a47945afa935aeec56bacf4336"
+skip_extraction=${_spirv_version}.tar.gz
+conflicts="llvm19>=0 llvm18>=0 llvm17>=0 llvm15>=0"
+lib32disabled=yes
+python_version=3
+nodebug=yes
+repository=bootstrap
+nocross="bootstrap package"
+
+# fails to build with libquadmth on musl
+case "$XBPS_TARGET_MACHINE" in
+	x86_64|i686) makedepends+=" libquadmath-devel" ;;
+esac
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	i686*) _arch="X86";;
+	x86_64*) _arch="X86";;
+	armv5*) _arch="Armv5te";;
+	armv6*) _arch="Armv6";;
+	armv7*) _arch="Armv7";;
+	aarch64*) _arch="AArch64";;
+	mips*) _arch="Mips";;
+	ppc*) _arch="PowerPC";;
+	riscv64*) _arch="RISCV64";;
+esac
+
+configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
+
+pre_configure() {
+	configure_args+=" -DLLVM_HOST_TRIPLE=$($CC -dumpmachine)"
+	configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=$($CXX -dumpmachine)"
+	echo "${configure_args}"
+}
+
+post_extract() {
+	vsrcextract -C llvm/projects/llvm-spirv ${_spirv_version}.tar.gz
+}
+
+post_install() {
+	vlicense ${wrksrc}/LICENSE.TXT
+}

From 505b1f319ac61f6ef6841a3e14e8a65d0ed976d1 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 16 Nov 2024 14:29:47 -0500
Subject: [PATCH 2/5] llvm19: bootstrap build, fix cmake and spirv translator.

---
 srcpkgs/llvm19/template | 51 +++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 27 deletions(-)

diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template
index 774ef89d66064f..5dfe9007b4314f 100644
--- a/srcpkgs/llvm19/template
+++ b/srcpkgs/llvm19/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm19'
 pkgname=llvm19
 version=19.1.3
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _llvm_prefix=lib/llvm/19
@@ -47,30 +47,25 @@ configure_args="
  -DBASE_LLVM_VERSION=${version}
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr
  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
+ -DLLVM_SPIRV=/usr/bin/llvm-spirv
 "
 hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
  python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config
  python3-mdit-py-plugins python3-MyST-Parser python3-markdown-it SPIRV-Headers SPIRV-Tools-devel
  patchelf $(vopt_if graphviz graphviz)"
 makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
- libxml2-devel binutils-devel z3-devel SPIRV-Headers SPIRV-Tools-devel"
+ libxml2-devel binutils-devel z3-devel"
 short_desc="LLVM Compiler Infrastructure Project - Version 19"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0 AND NCSA AND custom:Apache-2.0-with-llvm-exception"
 homepage="https://www.llvm.org"
 _spirv_version=v19.1.0
-distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz
- https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/${_spirv_version}.tar.gz"
-checksum="e5106e2bef341b3f5e41340e4b6c6a58259f4021ad801acf14e88f1a84567b05
- 2e64231db8646d8c220d44136712549b5d4c4194c6ce0e57c4f5ab342beee9a2"
-skip_extraction=${_spirv_version}.tar.gz
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=e5106e2bef341b3f5e41340e4b6c6a58259f4021ad801acf14e88f1a84567b05
 conflicts="llvm18>=0 llvm17>=0 llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-CFLAGS="-Wno-unused-command-line-argument"
-CXXFLAGS="-Wno-unused-command-line-argument"
-
 if [ "$XBPS_WORDSIZE" == "32" ]; then
 	nodebug=yes  # 32bit memory exhasted
 fi
@@ -105,7 +100,10 @@ case "$XBPS_TARGET_MACHINE" in
 esac
 
 if [ -z "$CROSS_BUILD" ]; then
-	build_options_default+=" llvm_spirv"
+	hostmakedepends+=" llvm19-bootstrap"
+
+	# Needs lld on the target machine
+	configure_args+=" -DLLVM_USE_LINKER=lld"
 fi
 
 # build fails because compiler_rt generates armv7 instructions when target is armv6
@@ -169,7 +167,7 @@ configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" llvm19-cross-tools "
+	hostmakedepends+=" llvm19-cross-tools SPIRV-LLVM-Translator19"
 
 	configure_args+=" -DLLVM_TOOLS_BINAIRY_DIR=/${_llvm_bindir}"
 	configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/${_llvm_bindir}"
@@ -195,7 +193,7 @@ fi
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages="llvm19-cross-tools ${subpackages}"
 	# OCaml cross build is broken
-	hostmakedepends+=" ocaml ocaml-findlib "
+	hostmakedepends+=" ocaml ocaml-findlib"
 	# lldb cross build fails with lua
 	makedepends+=" lua53-devel "
 fi
@@ -245,12 +243,6 @@ _vlink_libs() {
 	done
 }
 
-post_extract() {
-	if [ "$build_option_llvm_spirv" ]; then
-		vsrcextract -C llvm/projects/llvm-spirv ${_spirv_version}.tar.gz
-	fi
-}
-
 post_patch() {
 	# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
 	case "$XBPS_TARGET_MACHINE" in
@@ -287,14 +279,11 @@ _setup_cross_cflags() {
 }
 
 pre_configure() {
+	CC="clang"
+	CXX="clang++"
 	if [ "$CROSS_BUILD" ]; then
 		_setup_cross_cflags
 	fi
-	if [ "$build_option_llvm_spirv" ]; then
-		configure_args+=" -DLLVM_SPIRV=${wrksrc}/llvm/build/bin/llvm-spirv"
-	else
-		configure_args+=" -DLLVM_SPIRV=/${_llvm_bindir}/llvm-spirv"
-	fi
 }
 
 post_build() {
@@ -567,8 +556,8 @@ clang19_package() {
 
 	if [ "$build_option_polly" ]; then
 		alternatives+="
-			clang:/usr/lib/LLVMPolly.so:/${_llvm_libdir}/LLVMPolly.so
-			clang:/usr/share/man/man1/polly.1:/${_llvm_mandir}/man1/polly1.1
+		 clang:/usr/lib/LLVMPolly.so:/${_llvm_libdir}/LLVMPolly.so
+		 clang:/usr/share/man/man1/polly.1:/${_llvm_mandir}/man1/polly1.1
 		"
 	fi
 	pkg_install() {
@@ -607,6 +596,10 @@ clang19-devel_package() {
 	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
+	alternatives="clang19-devel:/usr/lib/cmake/clang:/${_llvm_libdir}/cmake/clang"
+	if [ "$build_option_polly" ]; then
+		alternatives+=" clang19-devel:/usr/lib/cmake/polly:/${_llvm_libdir}/cmake/polly"
+	fi
 	pkg_install() {
 		vmove ${_llvm_incdir}/clang
 		vmove ${_llvm_incdir}/clang-c
@@ -816,6 +809,7 @@ lld19-devel_package() {
 	conflicts="lld18-devel>=0 lld17-devel>=0 lld15-devel>=0"
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
+	alternatives="lld19-devel:/usr/lib/cmake/lld:/${_llvm_libdir}/cmake/lld"
 	pkg_install() {
 		vmove ${_llvm_incdir}/lld
 		vmove ${_llvm_libdir}/cmake/lld
@@ -863,6 +857,7 @@ mlir19-devel_package() {
 	conflicts="mlir18-devel>=0 mlir17-devel>=0"
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
+	alternatives="mlir-devel:/usr/lib/cmake/mlir:/${_llvm_libdir}/cmake/mlir"
 	pkg_install() {
 		vmove ${_llvm_incdir}/mlir
 		vmove ${_llvm_incdir}/mlir-c
@@ -905,6 +900,7 @@ flang19-devel_package() {
 	conflicts="flang18-devel>=0 flang17-devel>=0"
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
+	alternatives="flang-devel:/usr/lib/cmake/flang:/${_llvm_libdir}/cmake/flang"
 	pkg_install() {
 		vmove ${_llvm_incdir}/flang
 		vmove ${_llvm_libdir}/cmake/flang
@@ -947,6 +943,7 @@ libomp19-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp19>=${version}_${revision}"
 	conflicts="libomp18-devel>=0 libomp17-devel>=0"
+	alternatives="libomp-devel:/usr/lib/cmake/openmp:/${_llvm_libdir}/cmake/openmp"
 	pkg_install() {
 		if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher.so" ]; then
 			vmove "${_llvm_libdir}/libarcher*.so"
@@ -1066,7 +1063,7 @@ llvm19-devel_package() {
 	if [ "$build_option_clang" ]; then
 		depends+=" clang19-devel>=${version}_${revision} "
 	fi
-	alternatives+=" llvm-devel:/usr/lib/cmake/llvm:/usr/${_llvm_libdir}/cmake/llvm"
+	alternatives="llvm-devel:/usr/lib/cmake/llvm:/${_llvm_libdir}/cmake/llvm"
 	pkg_install() {
 		vmove ${_llvm_libdir}/libLLVM.so
 		vmove ${_llvm_libdir}/libLTO.so

From bbf2e526f755f318e35567b1ac6c707ac0fc06ec Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 16 Nov 2024 14:31:52 -0500
Subject: [PATCH 3/5] New package: SPIRV-LLVM-Translator19

---
 common/shlibs                            |  1 +
 srcpkgs/SPIRV-LLVM-Translator19          |  1 -
 srcpkgs/SPIRV-LLVM-Translator19-devel    |  2 +-
 srcpkgs/SPIRV-LLVM-Translator19/template | 35 ++++++++++++++++++++++++
 4 files changed, 37 insertions(+), 2 deletions(-)
 delete mode 120000 srcpkgs/SPIRV-LLVM-Translator19
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator19/template

diff --git a/common/shlibs b/common/shlibs
index 7c5765d5337f7c..bdafc5f1b43498 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1000,6 +1000,7 @@ libLLVM-17.so libllvm17-17.0.6_1
 libLLVM.so.18.1 libllvm18-18.1.8_1
 libLLVM.so.19.1 libllvm19-19.1.0_1
 libLLVMSPIRVLib.so.18.1 SPIRV-LLVM-Translator-18.1.2_1
+libLLVMSPIRVLib.so.19.1 SPIRV-LLVM-Translator-19.1.1_1
 libomp.so.5 libomp-17.0.6_1
 libomptarget.so.18.1 libomp-18.1.8_1
 libisofs.so.6 libisofs-0.6.24_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator19 b/srcpkgs/SPIRV-LLVM-Translator19
deleted file mode 120000
index 985027fe0a5c8d..00000000000000
--- a/srcpkgs/SPIRV-LLVM-Translator19
+++ /dev/null
@@ -1 +0,0 @@
-llvm19
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator19-devel b/srcpkgs/SPIRV-LLVM-Translator19-devel
index 985027fe0a5c8d..05559ceaa12cf0 120000
--- a/srcpkgs/SPIRV-LLVM-Translator19-devel
+++ b/srcpkgs/SPIRV-LLVM-Translator19-devel
@@ -1 +1 @@
-llvm19
\ No newline at end of file
+SPIRV-LLVM-Translator19
\ No newline at end of file
diff --git a/srcpkgs/SPIRV-LLVM-Translator19/template b/srcpkgs/SPIRV-LLVM-Translator19/template
new file mode 100644
index 00000000000000..55cfb758a50f7f
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator19/template
@@ -0,0 +1,35 @@
+# Template file for 'SPIRV-LLVM-Translator19'
+pkgname=SPIRV-LLVM-Translator19
+version=19.1.1
+revision=1
+_llvm_ver=${version%.*.*}
+build_style=cmake
+configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+ -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
+hostmakedepends="clang${_llvm_ver} llvm${_llvm_ver} pkg-config"
+makedepends="llvm${_llvm_ver}-devel SPIRV-Headers SPIRV-Tools-devel"
+short_desc="API and commands for processing SPIR-V modules - LLVM ${_llvm_ver}"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="NCSA"
+homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
+distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
+checksum=7f6f7a1af0eb40910ddf3a7647d2186c8c5dc5a47945afa935aeec56bacf4336
+
+alternatives="llvm-spirv:llvm-spirv:/usr/bin/llvm-spirv-${_llvm_ver}"
+
+post_install() {
+	mv ${DESTDIR}/usr/bin/llvm-spirv ${DESTDIR}/usr/bin/llvm-spirv-${_llvm_ver}
+	vlicense LICENSE.TXT
+}
+
+SPIRV-LLVM-Translator19-devel_package() {
+	depends="SPIRV-LLVM-Translator${_llvm_ver}-${version}_${revision}"
+	conflicts="SPIRV-LLVM-Translator>=0"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From e542b41c5d19c326e9e0263bb907bd65ee31a4c6 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 16 Nov 2024 15:15:09 -0500
Subject: [PATCH 4/5] llvm19: !fixup

---
 srcpkgs/llvm19/template | 105 ++++++++++++++++++++++++++++------------
 1 file changed, 74 insertions(+), 31 deletions(-)

diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template
index 5dfe9007b4314f..dd2c21d0ffd5cc 100644
--- a/srcpkgs/llvm19/template
+++ b/srcpkgs/llvm19/template
@@ -591,32 +591,41 @@ clang19-devel_package() {
 	 clang19>=${version}_${revision} clang-analyzer19>=${version}_${revision}
 	 llvm19>=${version}_${revision}"
 	conflicts="clang18-devel clang17-devel clang15-devel"
+	short_desc+=" - C language family frontend - development Files"
+	homepage="https://clang.llvm.org/"
+	_clang19_devel_files=(
+		include/clang
+		include/clang-c
+		lib/cmake/clang
+	)
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra19>=${version}_${revision}"
+		_clang19_devel_files+=(include/clang-tidy)
 	fi
-	short_desc+=" - C language family frontend - development Files"
-	homepage="https://clang.llvm.org/"
-	alternatives="clang19-devel:/usr/lib/cmake/clang:/${_llvm_libdir}/cmake/clang"
 	if [ "$build_option_polly" ]; then
-		alternatives+=" clang19-devel:/usr/lib/cmake/polly:/${_llvm_libdir}/cmake/polly"
+		_clang19_devel_files+=(
+			include/polly
+			lib/cmake/polly
+		)
 	fi
+	for _alt in "${_clang19_devel_files[@]}"; do
+		alternatives+=" clang-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
-		vmove ${_llvm_incdir}/clang
-		vmove ${_llvm_incdir}/clang-c
 		vmove ${_llvm_libdir}/libear
-		vmove ${_llvm_libdir}/cmake/clang
 		vmove "${_llvm_libdir}/libclang*.a"
 		vmove "${_llvm_libdir}/libclang*.so"
 		vmove ${_llvm_datadir}/clang
 		if [ "$build_option_clang_tools_extra" ]; then
-			vmove ${_llvm_incdir}/clang-tidy
 			vmove ${_llvm_libdir}/libfindAllSymbols.a
 		fi
 		if [ "$build_option_polly" ]; then
-			vmove ${_llvm_incdir}/polly
-			vmove ${_llvm_libdir}/cmake/polly
 			vmove "${_llvm_libdir}/libPolly*.a"
 		fi
+		for _f in "${_clang19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
+
 	}
 }
 
@@ -766,9 +775,17 @@ lldb19-devel_package() {
 	depends="lldb19>=${version}_${revision}"
 	conflicts="lldb18-devel>=0 lldb17-devel>=0 lldb15-devel>=0"
 	short_desc+=" - LLDB debugger - development files"
+	_lldb19_devel_files=(
+		include/lldb
+	)
+	for _alt in "${_lldb19_devel_files[@]}"; do
+		alternatives+=" lldb-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
-		vmove ${_llvm_incdir}/lldb
 		vmove "${_llvm_libdir}/liblldb*.so"
+		for _f in "${_lldb19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
 	}
 }
 
@@ -809,11 +826,20 @@ lld19-devel_package() {
 	conflicts="lld18-devel>=0 lld17-devel>=0 lld15-devel>=0"
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	alternatives="lld19-devel:/usr/lib/cmake/lld:/${_llvm_libdir}/cmake/lld"
+	# alternatives="lld19-devel:/usr/lib/cmake/lld:/${_llvm_libdir}/cmake/lld"
+	_lld19_devel_files=(
+		include/lld
+		lib/cmake/lld
+	)
+	for _alt in "${_lld19_devel_files[@]}"; do
+		alternatives+=" lld-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
-		vmove ${_llvm_incdir}/lld
-		vmove ${_llvm_libdir}/cmake/lld
 		vmove "${_llvm_libdir}/liblld*.a"
+
+		for _f in "${_lld19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
 	}
 }
 
@@ -858,13 +884,22 @@ mlir19-devel_package() {
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
 	alternatives="mlir-devel:/usr/lib/cmake/mlir:/${_llvm_libdir}/cmake/mlir"
+	_mlir19_devel_files=(
+		include/mlir
+		include/mlir-c
+	)
+	for _alt in "${_mlir19_devel_files[@]}"; do
+		alternatives+=" mlir-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
-		vmove ${_llvm_incdir}/mlir
-		vmove ${_llvm_incdir}/mlir-c
 		vmove ${_llvm_libdir}/cmake/mlir
 		vmove "${_llvm_libdir}/libMLIR*"
 		vmove "${_llvm_libdir}/objects-Release/obj.MLIR*"
 		vmove "${_llvm_libdir}/libmlir*"
+
+		for _f in "${_mlir19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
 	}
 }
 
@@ -900,13 +935,21 @@ flang19-devel_package() {
 	conflicts="flang18-devel>=0 flang17-devel>=0"
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	alternatives="flang-devel:/usr/lib/cmake/flang:/${_llvm_libdir}/cmake/flang"
+	_flang19_devel_files=(
+		include/flang
+		lib/cmake/flang
+	)
+	for _alt in "${_flang19_devel_files[@]}"; do
+		alternatives+=" flang-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
-		vmove ${_llvm_incdir}/flang
-		vmove ${_llvm_libdir}/cmake/flang
 		vmove "${_llvm_libdir}/libFIR*.a"
 		vmove "${_llvm_libdir}/libHLFIR*.a"
 		vmove "${_llvm_libdir}/libCUF*.a"
+
+		for _f in "${_flang19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
 	}
 }
 
@@ -1063,15 +1106,23 @@ llvm19-devel_package() {
 	if [ "$build_option_clang" ]; then
 		depends+=" clang19-devel>=${version}_${revision} "
 	fi
-	alternatives="llvm-devel:/usr/lib/cmake/llvm:/${_llvm_libdir}/cmake/llvm"
+	_llvm19_devel_files=(
+		lib/cmake/llvm
+		include/llvm
+		include/llvm-c
+	)
+	for _alt in "${_llvm19_devel_files[@]}"; do
+		alternatives+=" llvm-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
+	done
 	pkg_install() {
 		vmove ${_llvm_libdir}/libLLVM.so
 		vmove ${_llvm_libdir}/libLTO.so
 		vmove ${_llvm_libdir}/libRemarks.so
-		vmove ${_llvm_incdir}/llvm
-		vmove ${_llvm_incdir}/llvm-c
 		vmove "${_llvm_libdir}/libLLVM*.a"
-		vmove ${_llvm_libdir}/cmake/llvm
+
+		for _f in "${_llvm19_devel_files[@]}"; do
+			vmove usr/${_llvm_prefix}/${_f}
+		done
 	}
 }
 
@@ -1102,14 +1153,6 @@ llvm19-cross-tools_package() {
 		if [ "$build_option_mlir" ]; then
 			vcopy build/bin/mlir-src-sharder ${_llvm_bindir}
 		fi
-
-		if [ "$build_option_llvm_spirv" ]; then
-			patchelf --add-rpath '$ORIGIN/../lib' ${DESTDIR}/${_llvm_bindir}/llvm-spirv
-			vmove ${_llvm_bindir}/llvm-spirv
-			vmove ${_llvm_incdir}/LLVMSPIRVLib
-			vmove ${_llvm_libdir}/pkgconfig/LLVMSPIRVLib.pc
-			vmove "${_llvm_libdir}/libLLVMSPIRV*.a"
-		fi
 	}
 }
 

From cab9bb85dfad376c53b22a8624756c20178d3def Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sat, 16 Nov 2024 17:04:22 -0500
Subject: [PATCH 5/5] llvm19: !fixup

---
 srcpkgs/SPIRV-LLVM-Translator19/template | 10 ++-
 srcpkgs/llvm19/template                  | 87 ++++--------------------
 2 files changed, 24 insertions(+), 73 deletions(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator19/template b/srcpkgs/SPIRV-LLVM-Translator19/template
index 55cfb758a50f7f..59ce5305ad1479 100644
--- a/srcpkgs/SPIRV-LLVM-Translator19/template
+++ b/srcpkgs/SPIRV-LLVM-Translator19/template
@@ -6,9 +6,13 @@ _llvm_ver=${version%.*.*}
 build_style=cmake
 configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
  -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
- -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
+ -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr
+ -DCMAKE_PREFIX_PATH=${XBPS_CROSS_BASE}/usr/lib/llvm/${_llvm_ver}
+"
 hostmakedepends="clang${_llvm_ver} llvm${_llvm_ver} pkg-config"
+# hostmakedepends="pkg-config"
 makedepends="llvm${_llvm_ver}-devel SPIRV-Headers SPIRV-Tools-devel"
+# makedepends="SPIRV-Headers SPIRV-Tools-devel"
 short_desc="API and commands for processing SPIR-V modules - LLVM ${_llvm_ver}"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="NCSA"
@@ -18,6 +22,10 @@ checksum=7f6f7a1af0eb40910ddf3a7647d2186c8c5dc5a47945afa935aeec56bacf4336
 
 alternatives="llvm-spirv:llvm-spirv:/usr/bin/llvm-spirv-${_llvm_ver}"
 
+# if [ "$CROSS_BUILD" ]; then
+# 	# configure_args+=" -DLINK_DIRECTORIES=/usr/lib/llvm/19/lib/"
+# fi
+
 post_install() {
 	mv ${DESTDIR}/usr/bin/llvm-spirv ${DESTDIR}/usr/bin/llvm-spirv-${_llvm_ver}
 	vlicense LICENSE.TXT
diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template
index dd2c21d0ffd5cc..dd69254f141db1 100644
--- a/srcpkgs/llvm19/template
+++ b/srcpkgs/llvm19/template
@@ -593,26 +593,14 @@ clang19-devel_package() {
 	conflicts="clang18-devel clang17-devel clang15-devel"
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
-	_clang19_devel_files=(
-		include/clang
-		include/clang-c
-		lib/cmake/clang
-	)
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra19>=${version}_${revision}"
-		_clang19_devel_files+=(include/clang-tidy)
-	fi
-	if [ "$build_option_polly" ]; then
-		_clang19_devel_files+=(
-			include/polly
-			lib/cmake/polly
-		)
 	fi
-	for _alt in "${_clang19_devel_files[@]}"; do
-		alternatives+=" clang-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
+		vmove ${_llvm_incdir}/clang
+		vmove ${_llvm_incdir}/clang-c
 		vmove ${_llvm_libdir}/libear
+		vmove ${_llvm_libdir}/cmake/clang
 		vmove "${_llvm_libdir}/libclang*.a"
 		vmove "${_llvm_libdir}/libclang*.so"
 		vmove ${_llvm_datadir}/clang
@@ -620,11 +608,10 @@ clang19-devel_package() {
 			vmove ${_llvm_libdir}/libfindAllSymbols.a
 		fi
 		if [ "$build_option_polly" ]; then
+			vmove ${_llvm_incdir}/polly
+			vmove ${_llvm_libdir}/cmake/polly
 			vmove "${_llvm_libdir}/libPolly*.a"
 		fi
-		for _f in "${_clang19_devel_files[@]}"; do
-			vmove usr/${_llvm_prefix}/${_f}
-		done
 
 	}
 }
@@ -775,13 +762,8 @@ lldb19-devel_package() {
 	depends="lldb19>=${version}_${revision}"
 	conflicts="lldb18-devel>=0 lldb17-devel>=0 lldb15-devel>=0"
 	short_desc+=" - LLDB debugger - development files"
-	_lldb19_devel_files=(
-		include/lldb
-	)
-	for _alt in "${_lldb19_devel_files[@]}"; do
-		alternatives+=" lldb-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
+		vmove ${_llvm_incdir}/lldb
 		vmove "${_llvm_libdir}/liblldb*.so"
 		for _f in "${_lldb19_devel_files[@]}"; do
 			vmove usr/${_llvm_prefix}/${_f}
@@ -826,20 +808,10 @@ lld19-devel_package() {
 	conflicts="lld18-devel>=0 lld17-devel>=0 lld15-devel>=0"
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	# alternatives="lld19-devel:/usr/lib/cmake/lld:/${_llvm_libdir}/cmake/lld"
-	_lld19_devel_files=(
-		include/lld
-		lib/cmake/lld
-	)
-	for _alt in "${_lld19_devel_files[@]}"; do
-		alternatives+=" lld-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
+		vmove ${_llvm_incdir}/lld
+		vmove ${_llvm_libdir}/cmake/lld
 		vmove "${_llvm_libdir}/liblld*.a"
-
-		for _f in "${_lld19_devel_files[@]}"; do
-			vmove usr/${_llvm_prefix}/${_f}
-		done
 	}
 }
 
@@ -883,23 +855,13 @@ mlir19-devel_package() {
 	conflicts="mlir18-devel>=0 mlir17-devel>=0"
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
-	alternatives="mlir-devel:/usr/lib/cmake/mlir:/${_llvm_libdir}/cmake/mlir"
-	_mlir19_devel_files=(
-		include/mlir
-		include/mlir-c
-	)
-	for _alt in "${_mlir19_devel_files[@]}"; do
-		alternatives+=" mlir-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
+		vmove ${_llvm_incdir}/mlir
+		vmove ${_llvm_incdir}/mlir-c
 		vmove ${_llvm_libdir}/cmake/mlir
 		vmove "${_llvm_libdir}/libMLIR*"
 		vmove "${_llvm_libdir}/objects-Release/obj.MLIR*"
 		vmove "${_llvm_libdir}/libmlir*"
-
-		for _f in "${_mlir19_devel_files[@]}"; do
-			vmove usr/${_llvm_prefix}/${_f}
-		done
 	}
 }
 
@@ -935,21 +897,12 @@ flang19-devel_package() {
 	conflicts="flang18-devel>=0 flang17-devel>=0"
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	_flang19_devel_files=(
-		include/flang
-		lib/cmake/flang
-	)
-	for _alt in "${_flang19_devel_files[@]}"; do
-		alternatives+=" flang-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
+		vmove ${_llvm_incdir}/flang
+		vmove ${_llvm_libdir}/cmake/flang
 		vmove "${_llvm_libdir}/libFIR*.a"
 		vmove "${_llvm_libdir}/libHLFIR*.a"
 		vmove "${_llvm_libdir}/libCUF*.a"
-
-		for _f in "${_flang19_devel_files[@]}"; do
-			vmove usr/${_llvm_prefix}/${_f}
-		done
 	}
 }
 
@@ -986,7 +939,6 @@ libomp19-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp19>=${version}_${revision}"
 	conflicts="libomp18-devel>=0 libomp17-devel>=0"
-	alternatives="libomp-devel:/usr/lib/cmake/openmp:/${_llvm_libdir}/cmake/openmp"
 	pkg_install() {
 		if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher.so" ]; then
 			vmove "${_llvm_libdir}/libarcher*.so"
@@ -1106,23 +1058,14 @@ llvm19-devel_package() {
 	if [ "$build_option_clang" ]; then
 		depends+=" clang19-devel>=${version}_${revision} "
 	fi
-	_llvm19_devel_files=(
-		lib/cmake/llvm
-		include/llvm
-		include/llvm-c
-	)
-	for _alt in "${_llvm19_devel_files[@]}"; do
-		alternatives+=" llvm-devel:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
-	done
 	pkg_install() {
 		vmove ${_llvm_libdir}/libLLVM.so
 		vmove ${_llvm_libdir}/libLTO.so
 		vmove ${_llvm_libdir}/libRemarks.so
+		vmove ${_llvm_incdir}/llvm
+		vmove ${_llvm_incdir}/llvm-c
 		vmove "${_llvm_libdir}/libLLVM*.a"
-
-		for _f in "${_llvm19_devel_files[@]}"; do
-			vmove usr/${_llvm_prefix}/${_f}
-		done
+		vmove ${_llvm_libdir}/cmake/llvm
 	}
 }
 

  parent reply	other threads:[~2024-11-16 22:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 19:33 [PR PATCH] " Calandracas606
2024-11-16 20:15 ` [PR PATCH] [Updated] " Calandracas606
2024-11-16 22:04 ` Calandracas606 [this message]
2024-11-16 22:06 ` Calandracas606
2024-11-17  2:52 ` Calandracas606
2024-11-17 17:17 ` [PR PATCH] [Updated] " Calandracas606
2024-11-17 17:22 ` Calandracas606
2024-11-17 18:15 ` Calandracas606
2024-11-17 18:31 ` Calandracas606
2024-11-17 18:32 ` Calandracas606
2024-11-17 19:38 ` Calandracas606
2024-11-17 19:59 ` Calandracas606
2024-11-17 21:47 ` Calandracas606
2024-11-17 21:49 ` Calandracas606
2024-11-18  1:38 ` Calandracas606
2024-11-18  2:58 ` Calandracas606
2024-11-18  7:03 ` classabbyamp
2024-11-18 20:54 ` [PR PATCH] [Updated] " Calandracas606
2024-11-18 20:58 ` Calandracas606
2024-11-18 21:00 ` [PR PATCH] [Merged]: " classabbyamp

Reply instructions:

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

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

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

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

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

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

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