diff --git a/native/ghostty/deps/README.md b/native/ghostty/deps/README.md new file mode 100644 index 00000000..079043b2 --- /dev/null +++ b/native/ghostty/deps/README.md @@ -0,0 +1,16 @@ +# Vendored Zig packages + +Copies of ghostty's build dependencies whose hosts rate-limit or time out on CI runners. `tools/terminal/build-ghostty.sh` +puts each one into the Zig package cache (`zig fetch `) before it builds, so `zig build` finds the package by its hash +and does not download it. + +Each file is named after the Zig package hash in ghostty's `build.zig.zon`. Zig checks that hash when it fetches the +file, so a copy that does not match the pinned dependency fails loudly instead of building something else. + +| File | Package | Upstream | License | +|---|---|---|---| +| `translate_c-0.0.0-Q_BUWhVNBwDOEcIqub4VFPJPB6D9dgwzUMHTX5KWr8Xr.tar.gz` | translate-c (`pkg/translate-c` of ghostty) | `https://codeberg.org/vancluever/translate-c/archive/4e879eb8aba615de112eabd1231ea6e01920cead.tar.gz` | MIT (Zig contributors) | + +These are build-time tools only: nothing from them ships in a package. When the ghostty pin +(`native/ghostty/ghostty-upstream.json`) moves to a dependency with a new hash, replace the file: copy it from a local Zig +cache (`$ZIG_GLOBAL_CACHE_DIR/p/.tar.gz`) after a build that could reach the host. diff --git a/native/ghostty/deps/translate_c-0.0.0-Q_BUWhVNBwDOEcIqub4VFPJPB6D9dgwzUMHTX5KWr8Xr.tar.gz b/native/ghostty/deps/translate_c-0.0.0-Q_BUWhVNBwDOEcIqub4VFPJPB6D9dgwzUMHTX5KWr8Xr.tar.gz new file mode 100644 index 00000000..331f7626 Binary files /dev/null and b/native/ghostty/deps/translate_c-0.0.0-Q_BUWhVNBwDOEcIqub4VFPJPB6D9dgwzUMHTX5KWr8Xr.tar.gz differ diff --git a/tools/terminal/build-ghostty.sh b/tools/terminal/build-ghostty.sh index 6677c70a..cbbd61b8 100755 --- a/tools/terminal/build-ghostty.sh +++ b/tools/terminal/build-ghostty.sh @@ -71,13 +71,26 @@ while read -r patch; do echo "applied $patch" done -# 3. 构建 +# 3. 预置依赖:Codeberg 等托管站会对 CI 限流(429 / 504),仓库里带了这些包的副本(native/ghostty/deps/README.md), +# 先放进 Zig 包缓存,zig build 按哈希找到它们就不再下载。 +for dep in "$root"/native/ghostty/deps/*.tar.gz; do + [[ -e "$dep" ]] || continue + name="$(basename "$dep" .tar.gz)" + if [[ -e "$ZIG_GLOBAL_CACHE_DIR/p/$name" || -e "$ZIG_GLOBAL_CACHE_DIR/p/$name.tar.gz" ]]; then + continue + fi + fetched="$(cd "$src" && "$zig" fetch "$dep")" + [[ "$fetched" == "$name" ]] || { echo "vendored $dep has hash $fetched, expected $name" >&2; exit 1; } + echo "seeded $name" +done + +# 4. 构建 prefix="$root/artifacts/native-build/$rid" rm -rf "$prefix" echo "zig $("$zig" version): build $args -Doptimize=$optimize" (cd "$src" && "$zig" build $args -Doptimize="$optimize" --prefix "$prefix") -# 4. 整理产物:统一文件名,供 MSBuild 拾取 +# 5. 整理产物:统一文件名,供 MSBuild 拾取 out="$root/artifacts/native/$rid" mkdir -p "$out" rm -f "$out"/libghostty-vt.* "$out"/ghostty-vt.*