Skip to content

Commit 3c46d4b

Browse files
committed
fix(ghostty-native): unpack zig bootstrap zips on windows
1 parent e6f6239 commit 3c46d4b

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/ghostty-native/build/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,15 @@ if [[ -z "$ZIG_BIN" ]]; then
106106
echo " Bootstrapping Zig $ZIG_VERSION ($ZIG_ARCHIVE$ZIG_EXT)..."
107107
curl -L "https://ziglang.org/download/$ZIG_VERSION/$ZIG_ARCHIVE$ZIG_EXT" -o "$ARCHIVE_PATH"
108108
rm -rf "$RELEASE_ZIG_ROOT"
109-
tar -xf "$ARCHIVE_PATH" -C /tmp
109+
if [[ "$ZIG_EXT" == ".zip" ]]; then
110+
# Git Bash tar does not reliably unpack Windows Zig zip archives.
111+
ARCHIVE_PATH_WIN="$(cygpath -w "$ARCHIVE_PATH")"
112+
TMP_DIR_WIN="$(cygpath -w /tmp)"
113+
powershell.exe -NoProfile -Command \
114+
"\$ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath '$ARCHIVE_PATH_WIN' -DestinationPath '$TMP_DIR_WIN' -Force"
115+
else
116+
tar -xf "$ARCHIVE_PATH" -C /tmp
117+
fi
110118
mv "/tmp/$ZIG_ARCHIVE" "$RELEASE_ZIG_ROOT"
111119
fi
112120
ZIG_BIN="$RELEASE_ZIG_BIN"

packages/ghostty-native/test/package-boundary.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ describe("Feature: ghostty-native package boundary", () => {
4949
expect(buildScript).toContain("https://ziglang.org/download/$ZIG_VERSION/");
5050
expect(buildScript).toContain('RELEASE_ZIG_ROOT="/tmp/zig-$ZIG_VERSION"');
5151
expect(buildScript).toContain("ghostty-vt minimal dependency graph");
52+
expect(buildScript).toContain('if [[ "$ZIG_EXT" == ".zip" ]]; then');
53+
expect(buildScript).toContain("Expand-Archive -LiteralPath");
54+
expect(buildScript).toContain('ARCHIVE_PATH_WIN="$(cygpath -w "$ARCHIVE_PATH")"');
5255
expect(nativeBuild).toContain('root_source_file = b.path(".ghostty-src/src/lib_vt.zig")');
5356
expect(nativeBuild).toContain('build_options.addOption(bool, "simd", false)');
5457
expect(nativeBuild).toContain('terminal_options.add(b, ghostty_module)');

0 commit comments

Comments
 (0)