make: key the prebuilt-V8 cache on the zig-v8 tag

A zig-v8-fork release names its assets after the V8 version only, so the
same filename is reused across fork tags:

  v0.5.0  libc_v8_14.9.207.35_macos_aarch64.a  106944896 bytes
  v0.5.1  libc_v8_14.9.207.35_macos_aarch64.a  106945416 bytes
  v0.5.2  libc_v8_14.9.207.35_macos_aarch64.a  106945984 bytes

V8_CACHE was keyed on that filename alone, so a zig-v8 tag bump that
leaves V8_VERSION unchanged did not invalidate the cache: download-v8's
`test -f` guard saw the old archive and skipped the refresh. The build
then linked yesterday's bindings and failed on undefined symbols for
whatever the new tag added, e.g. after the v0.5.2 bump:

  error: undefined symbol: _v8__Value__IsFloat16Array
  error: undefined symbol: _v8__V8__SetFlagsFromString
  error: undefined symbol: _v8__Isolate__AddNearHeapLimitCallback

Putting the tag in the cache path gives each tag its own entry, so a bump
downloads and a repeat run still hits the cache. The URL keeps using the
bare asset name, which is what the release actually publishes.

Only affects local development; CI installs V8 through the install action
and never calls download-v8.
This commit is contained in:
Navid EMAD
2026-07-24 19:29:07 +02:00
parent 044d5c9186
commit 862fc91f06

View File

@@ -38,11 +38,18 @@ endif
# Building V8 from source takes 10+ minutes. `make download-v8` fetches the
# matching prebuilt archive from the zig-v8-fork releases instead. The versions
# are read from the install action so they can't drift from CI.
#
# The cache path is keyed on ZIG_V8_TAG as well as the archive name: a
# zig-v8-fork release keeps the same asset filename across tags (the name
# encodes only the V8 version), so a tag bump that leaves V8_VERSION alone
# still ships different bytes. Keying the cache on the filename alone made
# download-v8's `test -f` guard skip that refresh and leave a stale archive
# in place, which then fails at link time on undefined v8__* symbols.
V8_ACTION := .github/actions/install/action.yml
V8_VERSION := $(shell awk -F\' '/^ v8:/{f=1} f&&/default:/{print $$2; exit}' $(V8_ACTION))
ZIG_V8_TAG := $(shell awk -F\' '/^ zig-v8:/{f=1} f&&/default:/{print $$2; exit}' $(V8_ACTION))
V8_ARCHIVE := libc_v8_$(V8_VERSION)_$(OS)_$(ARCH).a
V8_CACHE := .lp-cache/prebuilt-v8/$(V8_ARCHIVE)
V8_CACHE := .lp-cache/prebuilt-v8/$(ZIG_V8_TAG)/$(V8_ARCHIVE)
# If the prebuilt archive is in place and the caller hasn't set ZIGFLAGS, point
# the build at it rather than building V8 from source.