From ffad4c6ec480647769f1b9b4be6263c4e0d0796c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 21 Aug 2026 08:41:20 -0700 Subject: [PATCH] update mirror, support git+https dependencies --- build.zig.zon | 2 +- build.zig.zon.json | 6 ++-- build.zig.zon.nix | 8 ++--- build.zig.zon.txt | 4 +-- flatpak/zig-packages.json | 10 +++--- nix/build-support/update-mirror.nu | 58 ++++++++++++++++++++++++++---- pkg/wuffs/build.zig.zon | 2 +- 7 files changed, 67 insertions(+), 23 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index c737ea9f1..96cda01a0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -66,7 +66,7 @@ .gobject = .{ // https://github.com/ghostty-org/zig-gobject based on zig_gobject // Temporary until we generate them at build time automatically. - .url = "https://github.com/ghostty-org/zig-gobject/releases/download/0.10.0-2026-07-28-36-1/ghostty-gobject-0.10.0-2026-07-28-36-1.tar.zst", + .url = "https://deps.files.ghostty.org/gobject-2026-07-28-36-1.tar.zst", .hash = "gobject-0.3.2-Skun7F6HogCMynX2JqeSHS7xr-8pK4ob-qRFIcEasVi3", .lazy = true, }, diff --git a/build.zig.zon.json b/build.zig.zon.json index 900da9c2f..376ca05cb 100644 --- a/build.zig.zon.json +++ b/build.zig.zon.json @@ -36,7 +36,7 @@ }, "gobject-0.3.2-Skun7F6HogCMynX2JqeSHS7xr-8pK4ob-qRFIcEasVi3": { "name": "gobject", - "url": "https://github.com/ghostty-org/zig-gobject/releases/download/0.10.0-2026-07-28-36-1/ghostty-gobject-0.10.0-2026-07-28-36-1.tar.zst", + "url": "https://deps.files.ghostty.org/gobject-2026-07-28-36-1.tar.zst", "hash": "sha256-dyCfm2XjiAk30zccjD6AgKFBdE7IRsJuoqnscfvnWSQ=" }, "N-V-__8AALiNBAA-_0gprYr92CjrMj1I5bqNu0TSJOnjFNSr": { @@ -151,8 +151,8 @@ }, "N-V-__8AAP5JWgCGP_AD0teWpa4krRvE9VPZzvviGdbmN4jI": { "name": "wuffs", - "url": "git+https://github.com/google/wuffs-mirror-release-c.git?rev=v0.4.0-alpha.10#7411f488fe2e2c205c3d3b3d28638b7356522930", - "hash": "sha256-AMuAaCbNJYnSeac1B1IRSUh4rlE2KphT04/Ak4Pig5M=" + "url": "https://deps.files.ghostty.org/wuffs-7411f488fe2e2c205c3d3b3d28638b7356522930.tar.gz", + "hash": "sha256-F4d9NG95iGUdbGLkWy47BchoCaZELF40YSN0sqlxmhw=" }, "z2d-0.12.1-j5P_Hsw8EQAKyZTQICCQnAH2xYkLDW8k9uefbsYdfPZ-": { "name": "z2d", diff --git a/build.zig.zon.nix b/build.zig.zon.nix index 411963637..e955d4dc4 100644 --- a/build.zig.zon.nix +++ b/build.zig.zon.nix @@ -164,7 +164,7 @@ in name = "gobject-0.3.2-Skun7F6HogCMynX2JqeSHS7xr-8pK4ob-qRFIcEasVi3"; path = fetchZigArtifact { name = "gobject"; - url = "https://github.com/ghostty-org/zig-gobject/releases/download/0.10.0-2026-07-28-36-1/ghostty-gobject-0.10.0-2026-07-28-36-1.tar.zst"; + url = "https://deps.files.ghostty.org/gobject-2026-07-28-36-1.tar.zst"; hash = "sha256-dyCfm2XjiAk30zccjD6AgKFBdE7IRsJuoqnscfvnWSQ="; unpack = true; }; @@ -371,9 +371,9 @@ in name = "N-V-__8AAP5JWgCGP_AD0teWpa4krRvE9VPZzvviGdbmN4jI"; path = fetchZigArtifact { name = "wuffs"; - url = "git+https://github.com/google/wuffs-mirror-release-c.git?rev=v0.4.0-alpha.10#7411f488fe2e2c205c3d3b3d28638b7356522930"; - hash = "sha256-AMuAaCbNJYnSeac1B1IRSUh4rlE2KphT04/Ak4Pig5M="; - unpack = true; + url = "https://deps.files.ghostty.org/wuffs-7411f488fe2e2c205c3d3b3d28638b7356522930.tar.gz"; + hash = "sha256-F4d9NG95iGUdbGLkWy47BchoCaZELF40YSN0sqlxmhw="; + unpack = false; }; } { diff --git a/build.zig.zon.txt b/build.zig.zon.txt index 2c98db17c..82e00bd4b 100644 --- a/build.zig.zon.txt +++ b/build.zig.zon.txt @@ -1,4 +1,3 @@ -git+https://github.com/google/wuffs-mirror-release-c.git?rev=v0.4.0-alpha.10#7411f488fe2e2c205c3d3b3d28638b7356522930 git+https://github.com/rockorager/libvaxis.git#c1e1f23be38951c425cdf31af455ba23ef178940 git+https://github.com/zigimg/zigimg#d695acd97c02e57bb151e8f659d1280f5cd6ca70 https://deps.files.ghostty.org/DearBindings_v0.17_ImGui_v1.92.5-docking.tar.gz @@ -12,6 +11,7 @@ https://deps.files.ghostty.org/freetype-1220b81f6ecfb3fd222f76cf9106fecfa6554ab0 https://deps.files.ghostty.org/gettext-0.24.tar.gz https://deps.files.ghostty.org/ghostty-themes-release-20260810-152212-0173c3c.tgz https://deps.files.ghostty.org/glslang-12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1.tar.gz +https://deps.files.ghostty.org/gobject-2026-07-28-36-1.tar.zst https://deps.files.ghostty.org/gtk4-layer-shell-1.1.0.tar.gz https://deps.files.ghostty.org/harfbuzz-11.0.0.tar.xz https://deps.files.ghostty.org/highway-66486a10623fa0d72fe91260f96c892e41aceb06.tar.gz @@ -29,10 +29,10 @@ https://deps.files.ghostty.org/vaxis-1dbbe575dff4586fe51e3217aa5c3fecdcbb6089.ta https://deps.files.ghostty.org/wayland-0.6.0-lQa1kqz8AQADQmdNJsNhLoNHcnEGEUjrOaPV-dtEnEmX.tar.gz https://deps.files.ghostty.org/wayland-9cb3d7aa9dc995ffafdbdef7ab86a949d0fb0e7d.tar.gz https://deps.files.ghostty.org/wayland-protocols-258d8f88f2c8c25a830c6316f87d23ce1a0f12d9.tar.gz +https://deps.files.ghostty.org/wuffs-7411f488fe2e2c205c3d3b3d28638b7356522930.tar.gz https://deps.files.ghostty.org/z2d-7dbae85c81784dba9988320bf9543ed9a81350c8.tar.gz https://deps.files.ghostty.org/zf-c35c421f84895193246db06c40683c1a30e616ef.tar.gz https://deps.files.ghostty.org/zig_js-3c23860e47fdcdc5af805efb7fd0bdac5fd3e9bc.tar.gz https://deps.files.ghostty.org/zig_objc-c8de82ff80281215ad92900866dab7103a8efa8b.tar.gz https://deps.files.ghostty.org/zlib-1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb.tar.gz -https://github.com/ghostty-org/zig-gobject/releases/download/0.10.0-2026-07-28-36-1/ghostty-gobject-0.10.0-2026-07-28-36-1.tar.zst https://github.com/vancluever/arocc/archive/ecbc5c799574e0da2758a961b12efa586007f03c.tar.gz diff --git a/flatpak/zig-packages.json b/flatpak/zig-packages.json index 9526f1eb8..ad54aa752 100644 --- a/flatpak/zig-packages.json +++ b/flatpak/zig-packages.json @@ -43,7 +43,7 @@ }, { "type": "archive", - "url": "https://github.com/ghostty-org/zig-gobject/releases/download/0.10.0-2026-07-28-36-1/ghostty-gobject-0.10.0-2026-07-28-36-1.tar.zst", + "url": "https://deps.files.ghostty.org/gobject-2026-07-28-36-1.tar.zst", "dest": "vendor/p/gobject-0.3.2-Skun7F6HogCMynX2JqeSHS7xr-8pK4ob-qRFIcEasVi3", "sha256": "9014db570db06e3fbfcfadb7b32aa8addacc6969e701650683c1c74428adba6c" }, @@ -180,10 +180,10 @@ "sha256": "5cedcadde81b75e60f23e5e83b5dd2b8eb4efb9f8f79bd7a347d148aeb0530f8" }, { - "type": "git", - "url": "https://github.com/google/wuffs-mirror-release-c.git", - "commit": "7411f488fe2e2c205c3d3b3d28638b7356522930", - "dest": "vendor/p/N-V-__8AAP5JWgCGP_AD0teWpa4krRvE9VPZzvviGdbmN4jI" + "type": "archive", + "url": "https://deps.files.ghostty.org/wuffs-7411f488fe2e2c205c3d3b3d28638b7356522930.tar.gz", + "dest": "vendor/p/N-V-__8AAP5JWgCGP_AD0teWpa4krRvE9VPZzvviGdbmN4jI", + "sha256": "17877d346f7988651d6c62e45b2e3b05c86809a6442c5e34612374b2a9719a1c" }, { "type": "archive", diff --git a/nix/build-support/update-mirror.nu b/nix/build-support/update-mirror.nu index b234172bf..974e9d0f5 100755 --- a/nix/build-support/update-mirror.nu +++ b/nix/build-support/update-mirror.nu @@ -5,12 +5,43 @@ # 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 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 @@ -45,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 } @@ -55,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 "") @@ -80,7 +119,12 @@ 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 + } } } diff --git a/pkg/wuffs/build.zig.zon b/pkg/wuffs/build.zig.zon index e2f4bd8fe..3016da7c9 100644 --- a/pkg/wuffs/build.zig.zon +++ b/pkg/wuffs/build.zig.zon @@ -11,7 +11,7 @@ // google/wuffs .wuffs = .{ - .url = "git+https://github.com/google/wuffs-mirror-release-c.git?rev=v0.4.0-alpha.10#7411f488fe2e2c205c3d3b3d28638b7356522930", + .url = "https://deps.files.ghostty.org/wuffs-7411f488fe2e2c205c3d3b3d28638b7356522930.tar.gz", .hash = "N-V-__8AAP5JWgCGP_AD0teWpa4krRvE9VPZzvviGdbmN4jI", .lazy = true, },