From d866fac8f94c238be93604a7a59d7536623640e7 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 14:27:12 -0500 Subject: [PATCH 1/3] 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 505b1f319ac61f6ef6841a3e14e8a65d0ed976d1 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Sat, 16 Nov 2024 14:29:47 -0500 Subject: [PATCH 2/3] 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 " 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 Date: Sat, 16 Nov 2024 14:31:52 -0500 Subject: [PATCH 3/3] 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 " +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" + } +}