summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-02-14 07:23:10 -0800
committerMitchell Hashimoto <m@mitchellh.com>2025-03-23 14:40:50 -0700
commitacafe881a06ed359b4f95a50ab247ae0540de9f8 (patch)
treedd3c304f6a65579436c167bbf90cb9b238f729d3
parent80030f20f076c4d1b953fc409a57d4a06d542c2f (diff)
Add back `fetch-zig-cache.sh` for packaging
See the comment on more details, which also covers when and how we can remove this.
-rwxr-xr-xnix/build-support/fetch-zig-cache.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/nix/build-support/fetch-zig-cache.sh b/nix/build-support/fetch-zig-cache.sh
new file mode 100755
index 000000000..cb6b52a1c
--- /dev/null
+++ b/nix/build-support/fetch-zig-cache.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# NOTE THIS IS A TEMPORARY SCRIPT TO SUPPORT PACKAGE MAINTAINERS.
+# Since #5439[1], we've been moving away from this and using an alternate
+# nix-based approach to cache our dependencies. #5733 aims to make this more
+# readily consumable by people who don't have Nix installed so that Nix
+# is not a hard dependency.
+#
+# Further, a future Zig version will hopefully fix the issue where
+# `zig build --fetch` doesn't fetch transitive dependencies[3]. When that
+# is resolved, we won't need any special machinery for the general use case
+# at all and packagers can just use `zig build --fetch`.
+#
+# [1]: https://github.com/ghostty-org/ghostty/pull/5439
+# [2]: https://github.com/ghostty-org/ghostty/pull/5733
+# [3]: https://github.com/ziglang/zig/issues/20976
+
+if [ -z ${ZIG_GLOBAL_CACHE_DIR+x} ]
+then
+ echo "must set ZIG_GLOBAL_CACHE_DIR!"
+ exit 1
+fi
+
+zig build --fetch
+zig fetch git+https://github.com/zigimg/zigimg#3a667bdb3d7f0955a5a51c8468eac83210c1439e
+zig fetch git+https://github.com/mitchellh/libxev#f6a672a78436d8efee1aa847a43a900ad773618b