diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/nix/build-support | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/nix/build-support')
7 files changed, 322 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/nix/build-support/build-inputs.nix b/vendor/libghostty-vt/nix/build-support/build-inputs.nix new file mode 100644 index 00000000..8f39968a --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/build-inputs.nix @@ -0,0 +1,46 @@ +{ + pkgs, + lib, + stdenv, + enableX11 ? true, + enableWayland ? true, +}: +[ + pkgs.libGL +] +++ lib.optionals stdenv.hostPlatform.isLinux [ + pkgs.bzip2 + pkgs.expat + pkgs.fontconfig + pkgs.freetype + pkgs.harfbuzz + pkgs.libpng + pkgs.libxml2 + pkgs.oniguruma + pkgs.simdutf + pkgs.zlib + + pkgs.glslang + pkgs.spirv-cross + + pkgs.libxkbcommon + + pkgs.glib + pkgs.gobject-introspection + pkgs.gsettings-desktop-schemas + pkgs.gst_all_1.gst-plugins-base + pkgs.gst_all_1.gst-plugins-good + pkgs.gst_all_1.gstreamer + pkgs.gtk4 + pkgs.libadwaita +] +++ lib.optionals (stdenv.hostPlatform.isLinux && enableX11) [ + pkgs.libx11 + pkgs.libxcursor + pkgs.libxi + pkgs.libxrandr +] +++ lib.optionals (stdenv.hostPlatform.isLinux && enableWayland) [ + pkgs.gtk4-layer-shell + pkgs.wayland +] diff --git a/vendor/libghostty-vt/nix/build-support/check-blueprints.sh b/vendor/libghostty-vt/nix/build-support/check-blueprints.sh new file mode 100755 index 00000000..8325981c --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/check-blueprints.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -o nounset -o pipefail -o errexit + +find src -name \*.blp -exec blueprint-compiler format {} \+ +find src -name \*.blp -exec blueprint-compiler compile --output=/dev/null {} \; diff --git a/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh b/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh new file mode 100755 index 00000000..9a392784 --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash +# +# This script checks if the build.zig.zon.nix file is up-to-date. +# If the `--update` flag is passed, it will update all necessary +# files to be up to date. +# +# The files owned by this are: +# +# - build.zig.zon.nix +# - build.zig.zon.txt +# - build.zig.zon.json +# - flatpak/zig-packages.json +# +# All of these are auto-generated and should not be edited manually. + +# Nothing in this script should fail. +set -e + +WORK_DIR=$(mktemp -d) + +if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then + echo "could not create temp dir" + exit 1 +fi + +function cleanup { + rm -rf "$WORK_DIR" +} + +trap cleanup EXIT + +help() { + echo "" + echo "To fix, please (manually) re-run the script from the repository root," + echo "commit, and submit a PR with the update:" + echo "" + echo " ./nix/build-support/check-zig-cache.sh --update" + echo " git add build.zig.zon.nix build.zig.zon.txt build.zig.zon.json flatpak/zig-packages.json" + echo " git commit -m \"nix: update build.zig.zon.nix build.zig.zon.txt build.zig.zon.json flatpak/zig-packages.json\"" + echo "" +} + +ROOT="$(realpath "$(dirname "$0")/../../")" +BUILD_ZIG_ZON="$ROOT/build.zig.zon" +BUILD_ZIG_ZON_NIX="$ROOT/build.zig.zon.nix" +BUILD_ZIG_ZON_TXT="$ROOT/build.zig.zon.txt" +BUILD_ZIG_ZON_JSON="$ROOT/build.zig.zon.json" +ZIG_PACKAGES_JSON="$ROOT/flatpak/zig-packages.json" + +if [ -f "${BUILD_ZIG_ZON_NIX}" ]; then + OLD_HASH_NIX=$(sha512sum "${BUILD_ZIG_ZON_NIX}" | awk '{print $1}') +elif [ "$1" != "--update" ]; then + echo -e "\nERROR: build.zig.zon.nix missing." + help + exit 1 +fi + +if [ -f "${BUILD_ZIG_ZON_TXT}" ]; then + OLD_HASH_TXT=$(sha512sum "${BUILD_ZIG_ZON_TXT}" | awk '{print $1}') +elif [ "$1" != "--update" ]; then + echo -e "\nERROR: build.zig.zon.txt missing." + help + exit 1 +fi + +if [ -f "${BUILD_ZIG_ZON_JSON}" ]; then + OLD_HASH_JSON=$(sha512sum "${BUILD_ZIG_ZON_JSON}" | awk '{print $1}') +elif [ "$1" != "--update" ]; then + echo -e "\nERROR: build.zig.zon.json missing." + help + exit 1 +fi + +if [ -f "${ZIG_PACKAGES_JSON}" ]; then + OLD_HASH_FLATPAK=$(sha512sum "${ZIG_PACKAGES_JSON}" | awk '{print $1}') +elif [ "$1" != "--update" ]; then + echo -e "\nERROR: flatpak/zig-packages.json missing." + help + exit 1 +fi + +zon2nix "$BUILD_ZIG_ZON" --15 --nix "$WORK_DIR/build.zig.zon.nix" --txt "$WORK_DIR/build.zig.zon.txt" --json "$WORK_DIR/build.zig.zon.json" --flatpak "$WORK_DIR/zig-packages.json" +alejandra --quiet "$WORK_DIR/build.zig.zon.nix" +prettier --log-level warn --write "$WORK_DIR/build.zig.zon.json" +prettier --log-level warn --write "$WORK_DIR/zig-packages.json" + +NEW_HASH_NIX=$(sha512sum "$WORK_DIR/build.zig.zon.nix" | awk '{print $1}') +NEW_HASH_TXT=$(sha512sum "$WORK_DIR/build.zig.zon.txt" | awk '{print $1}') +NEW_HASH_JSON=$(sha512sum "$WORK_DIR/build.zig.zon.json" | awk '{print $1}') +NEW_HASH_FLATPAK=$(sha512sum "$WORK_DIR/zig-packages.json" | awk '{print $1}') + +if [ "${OLD_HASH_NIX}" == "${NEW_HASH_NIX}" ] && [ "${OLD_HASH_TXT}" == "${NEW_HASH_TXT}" ] && [ "${OLD_HASH_JSON}" == "${NEW_HASH_JSON}" ] && [ "${OLD_HASH_FLATPAK}" == "${NEW_HASH_FLATPAK}" ]; then + echo -e "\nOK: build.zig.zon.nix unchanged." + echo -e "OK: build.zig.zon.txt unchanged." + echo -e "OK: build.zig.zon.json unchanged." + echo -e "OK: flatpak/zig-packages.json unchanged." + exit 0 +elif [ "$1" != "--update" ]; then + echo -e "\nERROR: build.zig.zon.nix, build.zig.zon.txt, or build.zig.zon.json needs to be updated.\n" + echo " * Old build.zig.zon.nix hash: ${OLD_HASH_NIX}" + echo " * New build.zig.zon.nix hash: ${NEW_HASH_NIX}" + echo " * Old build.zig.zon.txt hash: ${OLD_HASH_TXT}" + echo " * New build.zig.zon.txt hash: ${NEW_HASH_TXT}" + echo " * Old build.zig.zon.json hash: ${OLD_HASH_JSON}" + echo " * New build.zig.zon.json hash: ${NEW_HASH_JSON}" + echo " * Old flatpak/zig-packages.json hash: ${OLD_HASH_FLATPAK}" + echo " * New flatpak/zig-packages.json hash: ${NEW_HASH_FLATPAK}" + help + exit 1 +else + mv "$WORK_DIR/build.zig.zon.nix" "$BUILD_ZIG_ZON_NIX" + echo -e "\nOK: build.zig.zon.nix updated." + mv "$WORK_DIR/build.zig.zon.txt" "$BUILD_ZIG_ZON_TXT" + echo -e "OK: build.zig.zon.txt updated." + mv "$WORK_DIR/build.zig.zon.json" "$BUILD_ZIG_ZON_JSON" + echo -e "OK: build.zig.zon.json updated." + mv "$WORK_DIR/zig-packages.json" "$ZIG_PACKAGES_JSON" + echo -e "OK: flatpak/zig-packages.json updated." + exit 0 +fi diff --git a/vendor/libghostty-vt/nix/build-support/fetch-zig-cache.sh b/vendor/libghostty-vt/nix/build-support/fetch-zig-cache.sh new file mode 100755 index 00000000..9cc3dce2 --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/fetch-zig-cache.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# NOTE THIS IS A TEMPORARY SCRIPT TO SUPPORT PACKAGE MAINTAINERS. +# +# A future Zig version will hopefully fix the issue where +# `zig build --fetch` doesn't fetch transitive dependencies[1]. When that +# is resolved, we won't need any special machinery for the general use case +# at all and packagers can just use `zig build --fetch`. +# +# [1]: https://github.com/ziglang/zig/issues/20976 + +if [ -z ${ZIG_GLOBAL_CACHE_DIR+x} ] +then + echo "must set ZIG_GLOBAL_CACHE_DIR!" + exit 1 +fi + +# Go through each line of our build.zig.zon.txt and fetch it. +SCRIPT_PATH="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)" +ZON_TXT_FILE="$SCRIPT_PATH/../../build.zig.zon.txt" +while IFS= read -r url; do + echo "Fetching: $url" + zig fetch "$url" >/dev/null 2>&1 || { + echo "Failed to fetch: $url" >&2 + exit 1 + } +done < "$ZON_TXT_FILE" diff --git a/vendor/libghostty-vt/nix/build-support/gi-typelib-path.nix b/vendor/libghostty-vt/nix/build-support/gi-typelib-path.nix new file mode 100644 index 00000000..2e9533cb --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/gi-typelib-path.nix @@ -0,0 +1,17 @@ +{ + pkgs, + lib, + stdenv, +}: +lib.makeSearchPath "lib/girepository-1.0" (map (lib.getOutput "lib") (lib.optionals stdenv.hostPlatform.isLinux [ + pkgs.cairo + pkgs.gdk-pixbuf + pkgs.glib + pkgs.gobject-introspection + pkgs.graphene + pkgs.gtk4 + pkgs.gtk4-layer-shell + pkgs.harfbuzz + pkgs.libadwaita + pkgs.pango +])) diff --git a/vendor/libghostty-vt/nix/build-support/ld-library-path.nix b/vendor/libghostty-vt/nix/build-support/ld-library-path.nix new file mode 100644 index 00000000..b90a56d9 --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/ld-library-path.nix @@ -0,0 +1,10 @@ +{ + pkgs, + lib, + stdenv, + enableX11 ? true, + enableWayland ? true, +}: +lib.makeLibraryPath (import ./build-inputs.nix { + inherit pkgs lib stdenv enableX11 enableWayland; +}) diff --git a/vendor/libghostty-vt/nix/build-support/update-mirror.nu b/vendor/libghostty-vt/nix/build-support/update-mirror.nu new file mode 100755 index 00000000..8571ddea --- /dev/null +++ b/vendor/libghostty-vt/nix/build-support/update-mirror.nu @@ -0,0 +1,96 @@ +#!/usr/bin/env nu + +# This script downloads external dependencies from build.zig.zon.json that +# are not already mirrored at deps.files.ghostty.org, saves them to a local +# directory, and updates build.zig.zon to point to the new mirror URLs. +# +# The downloaded files are unmodified so their checksums and content hashes +# will match the originals. +# +# After running this script, the files in the output directory can be uploaded +# to blob storage, and build.zig.zon will already be updated with the new URLs. +def main [ + --output: string = "tmp-mirror", # Output directory for the mirrored files + --prefix: string = "https://deps.files.ghostty.org/", # Final URL prefix to ignore + --dry-run, # Print what would be downloaded without downloading +] { + let script_dir = ($env.CURRENT_FILE | path dirname) + let input_file = ($script_dir | path join ".." ".." "build.zig.zon.json") + let zon_file = ($script_dir | path join ".." ".." "build.zig.zon") + let output_dir = $output + + # Ensure the output directory exists + mkdir $output_dir + + # Read and parse the JSON file + let deps = open $input_file + + # Track URL replacements for build.zig.zon + mut url_replacements = [] + + # Process each dependency + for entry in ($deps | transpose key value) { + let key = $entry.key + let name = $entry.value.name + let url = $entry.value.url + + # Skip URLs that don't start with http(s) + if not ($url | str starts-with "http") { + continue + } + + # Skip URLs already hosted at the prefix + if ($url | str starts-with $prefix) { + continue + } + + # Extract the file extension from the URL + let extension = ($url | parse -r '(\.[a-z0-9]+(?:\.[a-z0-9]+)?)$' | get -o capture0.0 | default "") + + # Try to extract commit hash (40 hex chars) from URL + let commit_hash = ($url | parse -r '([a-f0-9]{40})' | get -o capture0.0 | default "") + + # Try to extract date pattern (YYYY-MM-DD or YYYYMMDD with optional suffixes) + let date_pattern = ($url | parse -r '((?:release-)?20\d{2}(?:-?\d{2}){2}(?:[-]\d+)*(?:[-][a-z0-9]+)?)' | get -o capture0.0 | default "") + + # Build filename based on what we found + let filename = if (not ($commit_hash | is-empty)) { + $"($name)-($commit_hash)($extension)" + } else if (not ($date_pattern | is-empty)) { + $"($name)-($date_pattern)($extension)" + } else { + $"($key)($extension)" + } + let new_url = $"($prefix)($filename)" + print $"($url) -> ($filename)" + + # Track the replacement + $url_replacements = ($url_replacements | append {old: $url, new: $new_url}) + + # Download the file + if not $dry_run { + http get $url | save -f ($output_dir | path join $filename) + } + } + + if $dry_run { + print "Dry run complete - no files were downloaded\n" + print $"Would update ($url_replacements | length) URLs in build.zig.zon" + } else { + print "All dependencies downloaded successfully\n" + print $"Updating ($zon_file)..." + + # Backup the old file + let backup_file = $"($zon_file).bak" + cp $zon_file $backup_file + print $"Backed up to ($backup_file)" + + mut zon_content = (open $zon_file) + for replacement in $url_replacements { + $zon_content = ($zon_content | str replace $replacement.old $replacement.new) + } + $zon_content | save -f $zon_file + + print $"Updated ($url_replacements | length) URLs in build.zig.zon" + } +} |
