dev-util/spirv-llvm-translator-21.1.0 dev-util/spirv-headers-1.4.326

This commit is contained in:
TheK0tYaRa 2025-09-25 15:46:42 +03:00
parent 02e8f1f18d
commit af8546c70c
8 changed files with 267 additions and 0 deletions

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>vulkan@gentoo.org</email>
<name>Vulkan Project</name>
</maintainer>
<upstream>
<remote-id type="github">KhronosGroup/SPIRV-Headers</remote-id>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1,36 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MY_PN=SPIRV-Headers
inherit cmake
if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://github.com/KhronosGroup/${MY_PN}.git"
inherit git-r3
elif [[ ${PV} == *1.4.326* ]]; then
EGIT_REPO_URI="https://github.com/KhronosGroup/${MY_PN}.git"
inherit git-r3
#EGIT_COMMIT
EGIT_OVERRIDE_BRANCH_KHRONOSGROUP_SPIRV_HEADERS="vulkan-tmp-${PV}"
KEYWORDS="~amd64 ~x86"
else
SRC_URI="https://github.com/KhronosGroup/${MY_PN}/archive/vulkan-sdk-${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
S="${WORKDIR}"/${MY_PN}-vulkan-sdk-${PV}
fi
DESCRIPTION="Machine-readable files for the SPIR-V Registry"
HOMEPAGE="https://registry.khronos.org/SPIR-V/ https://github.com/KhronosGroup/SPIRV-Headers"
LICENSE="MIT"
SLOT="0"
src_configure() {
local mycmakeargs=(
-DSPIRV_HEADERS_ENABLE_TESTS=OFF
-DSPIRV_HEADERS_ENABLE_INSTALL=ON
)
cmake_src_configure
}

View file

@ -0,0 +1 @@
DIST spirv-llvm-translator-21.1.0.tar.gz 1828044 BLAKE2B 5ebf5c6883c53eb68d5b32fa80f612aa5ac6ac2f1ca80206ab663e9902e0dacfaf1b2ad3ccef733548a0babf4967d6a6f93f4cbd952a23356174ecbfe8e39671 SHA512 dbacf6ff5b12d9755d80f9d673a0bc96e783a586f3d8f93e2291fae934b3c2d2fa8c605b926c42c09fb1391b110c7b7d5bf9185dd980df0f47d0e5afc9119bdc

View file

@ -0,0 +1,63 @@
From c2133b18cb48b9bb9c47897b16d64c5f0547cde6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 4 May 2023 08:44:25 +0200
Subject: [PATCH] [test] Use LD_LIBRARY_PATH to ensure that a new lib is used
(#1989)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the library `BINARY_DIR` to `LD_LIBRARY_PATH` to ensure that
the freshly built `libLLVMSPIRVLib.so` is tested. Otherwise, llvm-spirv
spawned by the test suite may use the previously installed
`libLLVMSPIRVLib.so`.
I have noticed the problem after rebuilding LLVM with
`-DLLVM_ENABLE_ASSSERTIONS=ON`. This meant that the previous version
of `libLLVMSPIRVLib.so` now crashed, effectively causing the test suite
to fail incorrectly.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
test/CMakeLists.txt | 1 +
test/lit.cfg.py | 3 ++-
test/lit.site.cfg.py.in | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 235f6d0a0..355baffb8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,6 +3,7 @@ llvm_canonicalize_cmake_booleans(SPIRV_SKIP_DEBUG_INFO_TESTS)
# required by lit.site.cfg.py.in
get_target_property(LLVM_SPIRV_DIR llvm-spirv BINARY_DIR)
+get_target_property(LLVM_SPIRV_LIB_DIR LLVMSPIRVLib BINARY_DIR)
set(LLVM_SPIRV_TEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if(SPIRV_TOOLS_FOUND AND NOT SPIRV-Tools-tools_FOUND)
diff --git a/test/lit.cfg.py b/test/lit.cfg.py
index 4b66412c3..fd8d3f94c 100644
--- a/test/lit.cfg.py
+++ b/test/lit.cfg.py
@@ -76,6 +76,7 @@
else:
config.substitutions.append(('spirv-val', ':'))
+llvm_config.with_system_environment('LD_LIBRARY_PATH')
if using_spirv_tools:
- llvm_config.with_system_environment('LD_LIBRARY_PATH')
llvm_config.with_environment('LD_LIBRARY_PATH', config.spirv_tools_lib_dir, append_path=True)
+llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_spirv_lib_dir, append_path=True)
diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in
index a01f2bb34..fdc4f4319 100644
--- a/test/lit.site.cfg.py.in
+++ b/test/lit.site.cfg.py.in
@@ -6,6 +6,7 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_spirv_dir = "@LLVM_SPIRV_DIR@"
+config.llvm_spirv_lib_dir = "@LLVM_SPIRV_LIB_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.llvm_shlib_dir = "@SHLIBDIR@"
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"

View file

@ -0,0 +1,34 @@
Fix for "Option 'spirv-ext' registered more than once" error.
Bug: https://bugs.gentoo.org/959744
Upstream PR: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/3218
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,13 +102,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
message(STATUS "Found LLVM: ${LLVM_VERSION}")
- is_llvm_target_library("SPIRV" spirv_present_result INCLUDED_TARGETS)
- if(spirv_present_result)
- message(STATUS "Found SPIR-V Backend")
- set(SPIRV_BACKEND_FOUND TRUE)
- add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT)
- endif()
-
option(CCACHE_ALLOWED "allow use of ccache" TRUE)
find_program(CCACHE_EXE_FOUND ccache)
if(CCACHE_EXE_FOUND AND CCACHE_ALLOWED)
@@ -118,6 +111,13 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
endif()
endif()
+is_llvm_target_library("SPIRV" spirv_present_result INCLUDED_TARGETS)
+if(spirv_present_result)
+ message(STATUS "Found SPIR-V Backend")
+ set(SPIRV_BACKEND_FOUND TRUE)
+ add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT)
+endif()
+
set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
# first try locating SPIRV-Tools via pkgconfig (the old way)

View file

@ -0,0 +1,41 @@
--- a/lib/SPIRV/libSPIRV/SPIRVOpCode.h
+++ b/lib/SPIRV/libSPIRV/SPIRVOpCode.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/VectorComputeUtil.h
+++ b/lib/SPIRV/VectorComputeUtil.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h
+++ b/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/libSPIRV/spirv_internal.hpp
+++ b/lib/SPIRV/libSPIRV/spirv_internal.hpp
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/libSPIRV/SPIRVEnum.h
+++ b/lib/SPIRV/libSPIRV/SPIRVEnum.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/libSPIRV/SPIRV.debug.h
+++ b/lib/SPIRV/libSPIRV/SPIRV.debug.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>
--- a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h
+++ b/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h
@@ -44,1 +44,1 @@
-#include "spirv/unified1/spirv.hpp"
+#include <spirv/unified1/spirv.hpp>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>conikost@gentoo.org</email>
<name>Conrad Kostecki</name>
</maintainer>
<maintainer type="project">
<email>x11@gentoo.org</email>
<name>X11</name>
</maintainer>
<maintainer type="project">
<email>llvm@gentoo.org</email>
</maintainer>
<upstream>
<remote-id type="github">KhronosGroup/SPIRV-LLVM-Translator</remote-id>
</upstream>
</pkgmetadata>

View file

@ -0,0 +1,63 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LLVM_COMPAT=( 21 )
MY_PN="SPIRV-LLVM-Translator"
MY_P="${MY_PN}-${PV}"
inherit cmake-multilib flag-o-matic llvm-r2 multiprocessing
DESCRIPTION="Bi-directional translator between SPIR-V and LLVM IR"
HOMEPAGE="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
SRC_URI="https://github.com/KhronosGroup/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="UoI-NCSA"
SLOT="$(ver_cut 1)"
KEYWORDS="amd64 ~arm arm64 ~loong ~riscv x86"
IUSE="test"
RESTRICT="!test? ( test )"
RDEPEND="
dev-util/spirv-tools[${MULTILIB_USEDEP}]
llvm-core/llvm:${SLOT}=[${MULTILIB_USEDEP}]
"
DEPEND="${RDEPEND}
>=dev-util/spirv-headers-1.4.326
"
BDEPEND="
virtual/pkgconfig
test? (
dev-python/lit
llvm-core/clang:${SLOT}
)
"
#PATCHES=( "${FILESDIR}"/${PN}-21.1.0-intel.patch )
src_prepare() {
append-flags -fPIC
cmake_src_prepare
# do not force a specific LLVM version to find_package(), this only
# causes issues and we force a specific path anyway
sed -i -e '/find_package/s:${BASE_LLVM_VERSION}::' CMakeLists.txt || die
}
multilib_src_configure() {
local mycmakeargs=(
-DCCACHE_ALLOWED="OFF"
-DCMAKE_INSTALL_PREFIX="$(get_llvm_prefix)"
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR="${ESYSROOT}/usr/include/spirv"
-DLLVM_SPIRV_INCLUDE_TESTS=$(usex test "ON" "OFF")
-Wno-dev
)
cmake_src_configure
}
multilib_src_test() {
lit -vv "-j${LIT_JOBS:-$(makeopts_jobs)}" "${BUILD_DIR}/test" || die
}