feat(flatpak): ship the SPIRV-Tools programs

Crafter.Graphics' PushConstantRewrite and UIFusedShader tests require
tool:spirv-val, and the Sdk has no spirv-val, so inside the Flatpak they
are skipped. The spirv-tools module the validation layer needs built
only the libraries, and removed them afterwards.

It now builds the programs as well, spirv-val, spirv-opt, spirv-dis and
the rest, which link SPIRV-Tools statically, and ships them. The
headers, the static libraries, the CMake and pkg-config files and
libSPIRV-Tools-shared.so, which nothing here links, are still removed,
and a post-install step runs spirv-val --version.
This commit is contained in:
Jorijn van der Graaf 2026-11-01 22:28:08 +01:00
commit 40dcb18a1e
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 21 additions and 8 deletions

View file

@ -11,8 +11,9 @@
#
# Programs that `-r` and the test runner start run in this sandbox, so the
# tools to debug them live here too: lldb (above), the Sdk's gdb, valgrind
# and strace, and the Khronos Vulkan validation layers, GPU-assisted
# validation included, which neither the Sdk nor its GL extensions carry.
# and strace, the Khronos Vulkan validation layers, GPU-assisted validation
# included, which neither the Sdk nor its GL extensions carry, and the
# SPIRV-Tools programs such as spirv-val.
app-id: net.catcrafts.CrafterBuild
runtime: org.freedesktop.Sdk
runtime-version: '26.08'
@ -270,7 +271,7 @@ modules:
# move the layers to the SDK release of that loader and take the other
# four revisions from its known_good.json again. The four are built into
# /app at those revisions rather than taken from the Sdk, whose versions
# follow the runtime, and none of them ships.
# follow the runtime, and of them only SPIRV-Tools' programs ship.
- name: vulkan-headers
buildsystem: cmake-ninja
builddir: true
@ -308,20 +309,32 @@ modules:
- name: spirv-tools
# The optimizer GPU-assisted validation instruments shaders with, linked
# into the layer statically.
# into the layer statically, and SPIRV-Tools' programs (spirv-val,
# spirv-opt, spirv-dis and the rest), which ship: a program or test that
# checks its SPIR-V with spirv-val, as Crafter.Graphics' do, finds it in
# the sandbox. The libraries and headers stay build-only.
buildsystem: cmake-ninja
builddir: true
build-options:
no-debuginfo: true
strip: true
config-opts:
- -DCMAKE_BUILD_TYPE=Release
# The installed SPIRV-Headers: its include/ holds the grammar files
# SPIRV-Tools generates its tables from, as the source tree does.
- -DSPIRV-Headers_SOURCE_DIR=/app
- -DSPIRV_SKIP_EXECUTABLES=ON
- -DSPIRV_SKIP_TESTS=ON
- -DSPIRV_WERROR=OFF
cleanup:
- '*'
- /include/spirv-tools
- /lib/libSPIRV-Tools*.a
# Always built besides the static libraries, and linked by nothing
# here: the programs and the layer take SPIRV-Tools statically.
- /lib/libSPIRV-Tools-shared.so
- /lib/cmake/SPIRV-Tools*
- /lib/pkgconfig/SPIRV-Tools*
post-install:
- spirv-val --version
sources:
- type: archive
url: https://github.com/KhronosGroup/SPIRV-Tools/archive/b707790a898e44038547df54580022fc1cf89c3d.tar.gz