Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions native/ghostty/deps/README.md
Original file line number Diff line number Diff line change
@@ -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 <file>`) 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/<hash>.tar.gz`) after a build that could reach the host.
Binary file not shown.
17 changes: 15 additions & 2 deletions tools/terminal/build-ghostty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down
Loading