Build the Vulkan GPU driver in the Linux binary builds

Add vulkan-headers to the Linux dependencies, and fail freezing on Linux
if either the OpenGL or the Vulkan GPU driver, or the built-in shaders
for its shader target, are missing. Document vulkan-headers as a build
dependency.
This commit is contained in:
Kovid Goyal 2026-11-04 07:28:05 +05:30
parent 23e450a225
commit c709a3eb66
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 29 additions and 0 deletions

View file

@ -127,6 +127,22 @@ def copy_libs(env) -> None:
shutil.copy2(os.path.join(BIN, 'slangc'), env.bin_dir)
def check_gpu_drivers(env) -> None:
# Both GPU drivers must be part of the build, along with the built-in
# shaders compiled for their shader targets, otherwise kitty silently
# falls back to whichever driver is present
print('Checking GPU drivers...')
ext_dir = os.path.join(env.lib_dir, 'kitty-extensions')
shaders_dir = os.path.join(env.lib_dir, 'kitty', 'shaders')
for driver, target_prefix in (('opengl', 'glsl-'), ('vulkan', 'spirv-')):
path = os.path.join(ext_dir, f'kitty.{driver}.so')
if not os.path.isfile(path):
raise SystemExit(f'The {driver} GPU driver was not built, {path} does not exist')
targets = [x for x in os.listdir(shaders_dir) if x.startswith(target_prefix) and os.path.isfile(os.path.join(shaders_dir, x, 'cell.json'))]
if not targets:
raise SystemExit(f'The built-in shaders were not compiled for the {driver} GPU driver in {shaders_dir}')
def add_ca_certs(env) -> None:
print('Downloading CA certs...')
from urllib.request import urlopen
@ -258,6 +274,7 @@ def main() -> None:
env = Env(os.path.join(ext_dir, kitty_constants['appname']))
copy_libs(env)
copy_python(env)
check_gpu_drivers(env)
iv['build_frozen_launcher']([path_to_freeze_dir(), env.obj_dir])
files = find_binaries(env)
fix_permissions(files)

View file

@ -298,6 +298,16 @@
}
},
{
"name": "vulkan-headers 1.4.363",
"os": "linux",
"unix": {
"file_extension": "tar.gz",
"hash": "sha256:cbaf687d3c59b9666fe080e7f8396b6b4f4d344a768ee6b337c59852f4526b68",
"urls": ["https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v{version}.{file_extension}"]
}
},
{
"name": "wayland-protocols 1.49",
"os": "linux",

View file

@ -106,6 +106,8 @@ Build-time dependencies:
* ``gcc`` or ``clang``
* ``simde``
* ``shader-slang``
* ``vulkan-headers`` (needed only on Linux and BSD, to build the Vulkan GPU driver,
without them kitty uses only OpenGL)
* ``go`` >= _build_go_version (see :file:`go.mod` for go packages used during building)
* ``pkg-config``
* Symbols NERD Font Mono either installed system-wide or placed in :file:`fonts/SymbolsNerdFontMono-Regular.ttf`