Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

116.7. shaderc-2026.4

glslc and libshaderc — GLSL and HLSL to SPIR-V, on the system glslang and SPIRV-Tools

Version 2026.4, release 1
Shelf gpu — The GPU stack: Mesa, DRM, GL and Vulkan loaders and headers, shader compilers, VA-API, OpenCL
Phase 41_system (System), 600 of 1047 in build order
Licence Apache-2.0
Homepage https://github.com/google/shaderc
Build time 1.0 SBU
Installed size 21.3 MiB in 11 files
Recipe ports/core/gpu/shaderc/kpkgbuild

About

shaderc is Google’s shader compiler built on glslang and spirv-tools: glslc, a command-line compiler from GLSL and HLSL to SPIR-V with GCC-like options, and libshaderc, the same as a library. glslc is the compiler Vulkan projects call by name at build time: libggml compiles the shaders of ggml’s Vulkan backend with it, the GPU path of whisper.cpp and llama.cpp, and gtk4, blender, waypipe and the other ports that name it in depends build with it too.

Each shaderc release names, in its DEPS file, the glslang and SPIRV-Tools revisions it was cut against, and the recipe’s version is chosen so that those match the versions of the glslang and spirv-tools ports; a bump of either moves this one too.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/gpu.txt:

glslc compiles the shaders of whisper's Vulkan (GPU) backend.

Sources

Dependencies

Depends on: cmake, ninja, python3, pkgconf, glslang, spirv-tools, spirv-headers.

Required by (6): blender, gtk4, libggml, supertuxkart, warzone2100, waypipe.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install shaderc'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gpu/shaderc.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/gpu/shaderc
echo 'f06ce5bcca94e5df7f34e115743597d0ad2e13c5fe9213c67dc8c76031241947  shaderc-2026.4.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/shaderc
SRC=$SRC_ROOT/shaderc-2026.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf shaderc-2026.4.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/shaderc-system-deps.patch"

cmake -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D CMAKE_INSTALL_LIBDIR=lib \
	-D CMAKE_BUILD_TYPE=Release \
	-D CMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG" \
	-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS -DNDEBUG" \
	-D SHADERC_SYSTEM_DEPS=ON \
	-D SHADERC_SKIP_TESTS=ON \
	-D SHADERC_SKIP_EXAMPLES=ON \
	-D SHADERC_SKIP_COPYRIGHT_CHECK=ON \
	-D SHADERC_ENABLE_WERROR_COMPILE=OFF \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

rm -f "$PKG/usr/lib/libshaderc.a" "$PKG/usr/lib/libshaderc_combined.a" \
	"$PKG/usr/lib/pkgconfig/shaderc_static.pc" \
	"$PKG/usr/lib/pkgconfig/shaderc_combined.pc"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/shaderc, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf shaderc-2026.4-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/shaderc, and runs the triggers its paths call for.

Contents

Installed programs: glslc.

Installed libraries: libshaderc_shared.so.

Installed directories: /usr/include/shaderc, /usr/share/licenses/shaderc.

Short descriptions

shaderc.pc Tools and libraries for Vulkan shader compilation

Notes

The release archive carries third_party/ with only its CMakeLists.txt and licence files: the sources it expects there are fetched from git by upstream’s utils/git-sync-deps, which a build with no network cannot run. That is what the patch is for.

Only the shared library ships. build.sh removes libshaderc.a, libshaderc_combined.a and their pkg-config files shaderc_static.pc and shaderc_combined.pc. libshaderc_combined.a is meant to carry glslang and SPIRV-Tools inside it, and built against the installed packages it carries neither; shaderc_static.pc names -lshaderc_util, a static library the install does not ship. A program that linked either archive by its pkg-config file would not link.