From d866fac8f94c238be93604a7a59d7536623640e7 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 14:27:12 -0500 Subject: [PATCH 1/4] 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 " +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 fb3141b34b2aa5382b2623ec5dbf771d2c7e80dd Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 14:29:47 -0500 Subject: [PATCH 2/4] llvm19: bootstrap build, fix cmake and spirv translator. --- srcpkgs/llvm19/template | 50 +++++++++++++---------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template index 774ef89d66064f..29c67b5235265f 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 " 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() { @@ -1066,7 +1055,6 @@ 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" pkg_install() { vmove ${_llvm_libdir}/libLLVM.so vmove ${_llvm_libdir}/libLTO.so @@ -1105,14 +1093,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 6b6a4df744ba5731848dc7c6b83d35d9d3791174 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 14:31:52 -0500 Subject: [PATCH 3/4] New package: SPIRV-LLVM-Translator19 --- common/shlibs | 1 + srcpkgs/SPIRV-LLVM-Translator19 | 1 - srcpkgs/SPIRV-LLVM-Translator19-devel | 2 +- srcpkgs/SPIRV-LLVM-Translator19/template | 37 ++++++++++++++++++++++++ 4 files changed, 39 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..1998680f7d07b9 --- /dev/null +++ b/srcpkgs/SPIRV-LLVM-Translator19/template @@ -0,0 +1,37 @@ +# 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 + -DCMAKE_PREFIX_PATH=${XBPS_CROSS_BASE}/usr/lib/llvm/${_llvm_ver} +" +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 " +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 fe058bbbca813f4a9c0c39fe7edc53a6dbcf19fa Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 21:52:09 -0500 Subject: [PATCH 4/4] llvm19: nocross (im sorry buildbot) --- srcpkgs/SPIRV-LLVM-Translator19/template | 2 ++ srcpkgs/llvm19/template | 2 ++ 2 files changed, 4 insertions(+) diff --git a/srcpkgs/SPIRV-LLVM-Translator19/template b/srcpkgs/SPIRV-LLVM-Translator19/template index 1998680f7d07b9..8fad3a5fb149bb 100644 --- a/srcpkgs/SPIRV-LLVM-Translator19/template +++ b/srcpkgs/SPIRV-LLVM-Translator19/template @@ -18,6 +18,8 @@ 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 +nocross="im sorry buildbot" + alternatives="llvm-spirv:llvm-spirv:/usr/bin/llvm-spirv-${_llvm_ver}" post_install() { diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template index 29c67b5235265f..dbe921cf647eed 100644 --- a/srcpkgs/llvm19/template +++ b/srcpkgs/llvm19/template @@ -66,6 +66,8 @@ conflicts="llvm18>=0 llvm17>=0 llvm15>=0" lib32disabled=yes python_version=3 +nocross="im sorry buildbot" + if [ "$XBPS_WORDSIZE" == "32" ]; then nodebug=yes # 32bit memory exhasted fi