diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/nix | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/nix')
| -rwxr-xr-x | vendor/libghostty-vt/nix/build-support/check-zig-cache.sh | 2 | ||||
| -rwxr-xr-x | vendor/libghostty-vt/nix/build-support/update-mirror.nu | 113 | ||||
| -rw-r--r-- | vendor/libghostty-vt/nix/devShell.nix | 29 | ||||
| -rw-r--r-- | vendor/libghostty-vt/nix/libghostty-vt.nix | 6 | ||||
| -rw-r--r-- | vendor/libghostty-vt/nix/package.nix | 4 |
5 files changed, 115 insertions, 39 deletions
diff --git a/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh b/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh index 9a392784..52ab1b17 100755 --- a/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh +++ b/vendor/libghostty-vt/nix/build-support/check-zig-cache.sh @@ -79,7 +79,7 @@ elif [ "$1" != "--update" ]; then 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" +zon2nix "$BUILD_ZIG_ZON" --16 --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" diff --git a/vendor/libghostty-vt/nix/build-support/update-mirror.nu b/vendor/libghostty-vt/nix/build-support/update-mirror.nu index 8571ddea..974e9d0f 100755 --- a/vendor/libghostty-vt/nix/build-support/update-mirror.nu +++ b/vendor/libghostty-vt/nix/build-support/update-mirror.nu @@ -2,23 +2,65 @@ # 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. +# directory, and updates the build.zig.zon files (the root one as well as +# every pkg/*/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. +# HTTP files are downloaded unmodified. Git dependencies use Zig's normalized +# cache archive so their content hashes 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. +# to blob storage, and the build.zig.zon files will already be updated with +# the new URLs. +def download-git-package [url: string, expected_hash: string, destination: string] { + let cache_dir = (mktemp --directory) + let result = (do { ^zig fetch --global-cache-dir $cache_dir $url } | complete) + + if $result.exit_code != 0 { + rm --recursive $cache_dir + error make { + msg: $"zig fetch failed for ($url): ($result.stderr | str trim)" + } + } + + let actual_hash = ($result.stdout | str trim) + if $actual_hash != $expected_hash { + rm --recursive $cache_dir + error make { + msg: $"zig fetch hash mismatch for ($url): expected ($expected_hash), got ($actual_hash)" + } + } + + let archive = ($cache_dir | path join "p" $"($actual_hash).tar.gz") + if not ($archive | path exists) { + rm --recursive $cache_dir + error make { + msg: $"zig fetch did not produce a cache archive for ($url)" + } + } + + cp $archive $destination + rm --recursive $cache_dir +} + 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 root_dir = ($script_dir | path join ".." ".." | path expand) + let input_file = ($root_dir | path join "build.zig.zon.json") let output_dir = $output + # All build.zig.zon files that may reference external URLs: the root + # one plus every package under pkg/. build.zig.zon.json is generated + # from the full dependency tree so it covers all of these. + let zon_files = ( + [($root_dir | path join "build.zig.zon")] + | append (glob ($root_dir | path join "pkg" "*" "build.zig.zon")) + | sort + ) + # Ensure the output directory exists mkdir $output_dir @@ -34,8 +76,11 @@ def main [ 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") { + let is_git_url = ($url | str starts-with "git+http") + let is_http_url = ($url | str starts-with "http") + + # Skip URLs that aren't HTTP downloads or HTTP-backed Git repositories. + if not ($is_http_url or $is_git_url) { continue } @@ -44,8 +89,13 @@ def main [ continue } - # Extract the file extension from the URL - let extension = ($url | parse -r '(\.[a-z0-9]+(?:\.[a-z0-9]+)?)$' | get -o capture0.0 | default "") + # Git dependencies are mirrored using an archive of the normalized package + # tree produced by Zig. Fetching it over HTTP produces the same package hash. + let extension = if $is_git_url { + ".tar.gz" + } else { + $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 "") @@ -69,28 +119,45 @@ def main [ # Download the file if not $dry_run { - http get $url | save -f ($output_dir | path join $filename) + let destination = ($output_dir | path join $filename) + if $is_git_url { + download-git-package $url $key $destination + } else { + http get $url | save -f $destination + } } } 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) + } + + # Apply the URL replacements to every build.zig.zon that references them. + for zon_file in $zon_files { + mut zon_content = (open --raw $zon_file) + mut count = 0 for replacement in $url_replacements { - $zon_content = ($zon_content | str replace $replacement.old $replacement.new) + if ($zon_content | str contains $replacement.old) { + $zon_content = ($zon_content | str replace --all $replacement.old $replacement.new) + $count = $count + 1 + } + } + + if $count == 0 { + continue } - $zon_content | save -f $zon_file - print $"Updated ($url_replacements | length) URLs in build.zig.zon" + let relative_path = ($zon_file | path relative-to $root_dir) + if $dry_run { + print $"Would update ($count) URLs in ($relative_path)" + } else { + # Backup the old file + let backup_file = $"($zon_file).bak" + cp $zon_file $backup_file + $zon_content | save -f $zon_file + print $"Updated ($count) URLs in ($relative_path), backup at ($relative_path).bak" + } } } diff --git a/vendor/libghostty-vt/nix/devShell.nix b/vendor/libghostty-vt/nix/devShell.nix index b530c56c..fba128a2 100644 --- a/vendor/libghostty-vt/nix/devShell.nix +++ b/vendor/libghostty-vt/nix/devShell.nix @@ -24,10 +24,13 @@ #, vulkan-loader # unused vttest, wabt, + wasm-tools, wasmtime, + binaryen, + twiggy, + wizer, wraptest, zig, - zig_0_15, zip, llvmPackages_latest, bzip2, @@ -60,6 +63,7 @@ zlib, alejandra, jq, + kaitai-struct-compiler, minisign, pandoc, pinact, @@ -86,6 +90,12 @@ gi_typelib_path = import ./build-support/gi-typelib-path.nix { inherit pkgs lib stdenv; }; + python = python3.withPackages (python-pkgs: [ + python-pkgs.jsonschema + python-pkgs.kaitaistruct + python-pkgs.ucs-detect + python-pkgs.wasmtime + ]); in mkShell { name = "ghostty"; @@ -117,13 +127,18 @@ in # Testing parallel - python3 + python vttest hyperfine + kaitai-struct-compiler # wasm + binaryen + twiggy wabt + wasm-tools wasmtime + wizer # Localization gettext @@ -139,11 +154,6 @@ in blueprint-compiler libadwaita gtk4 - - # Python packages - (python3.withPackages (python-pkgs: [ - python-pkgs.ucs-detect - ])) ] ++ lib.optionals stdenv.hostPlatform.isLinux [ # My nix shell environment installs the non-interactive version @@ -222,8 +232,7 @@ in '') + (lib.optionalString stdenv.hostPlatform.isDarwin '' # On macOS, we unset the macOS SDK env vars that Nix sets up because - # we rely on a system installation. Nix only provides a macOS SDK - # and we need iOS too. + # we rely on a system installation. Nix only provides a macOS SDK. unset SDKROOT unset DEVELOPER_DIR @@ -243,6 +252,6 @@ in # We need to remove "xcrun" from the PATH. It is injected by # some dependency but we need to rely on system Xcode tools export PATH=$(echo "$PATH" | awk -v RS=: -v ORS=: '$0 !~ /xcrun/ || $0 == "/usr/bin" {print}' | sed 's/:$//') - export PATH="/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" + export PATH="${python}/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" ''); } diff --git a/vendor/libghostty-vt/nix/libghostty-vt.nix b/vendor/libghostty-vt/nix/libghostty-vt.nix index 2b67fc83..78072ed1 100644 --- a/vendor/libghostty-vt/nix/libghostty-vt.nix +++ b/vendor/libghostty-vt/nix/libghostty-vt.nix @@ -11,7 +11,7 @@ versionCheckHook, darwin, xcbuild, - zig_0_15, + zig_0_16, revision ? "dirty", optimize ? "Debug", simd ? true, @@ -59,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: { [ git pkg-config - zig_0_15 + zig_0_16 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.cctools @@ -264,7 +264,7 @@ stdenv.mkDerivation (finalAttrs: { meta = { homepage = "https://ghostty.org"; license = lib.licenses.mit; - platforms = zig_0_15.meta.platforms; + platforms = zig_0_16.meta.platforms; pkgConfigModules = [ "libghostty-vt" "libghostty-vt-static" diff --git a/vendor/libghostty-vt/nix/package.nix b/vendor/libghostty-vt/nix/package.nix index fd952c9d..31db683c 100644 --- a/vendor/libghostty-vt/nix/package.nix +++ b/vendor/libghostty-vt/nix/package.nix @@ -10,7 +10,7 @@ git, ncurses, pkg-config, - zig_0_15, + zig_0_16, pandoc, revision ? "dirty", optimize ? "Debug", @@ -63,7 +63,7 @@ in ncurses pandoc pkg-config - zig_0_15 + zig_0_16 gobject-introspection wrapGAppsHook4 blueprint-compiler |
