diff --git a/.gitignore b/.gitignore index c23d7cc4..48403d38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /.zig-cache/ /.lp-cache/ -/v8/ /zig-pkg/ zig-out lightpanda.id diff --git a/Makefile b/Makefile index 4f30d2fd..22a82879 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,12 @@ V8_VERSION := $(shell awk -F\' '/^ v8:/{f=1} f&&/default:/{print $$2; exit}' $( 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_LINK := v8/libc_v8.a -# If the prebuilt archive is in place and the caller hasn't set ZIGFLAGS, link -# against it (the same flag CI passes) rather than building V8 from source. +# 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. ifeq ($(strip $(ZIGFLAGS)),) - ifneq ($(wildcard $(V8_LINK)),) - ZIGFLAGS := -Dprebuilt_v8_path=$(V8_LINK) + ifneq ($(wildcard $(V8_CACHE)),) + ZIGFLAGS := -Dprebuilt_v8_path=$(V8_CACHE) endif endif @@ -77,14 +76,13 @@ help: ## Download the prebuilt V8 archive (skips the 10+ min source build) download-v8: - @mkdir -p $(dir $(V8_CACHE)) $(dir $(V8_LINK)) + @mkdir -p $(dir $(V8_CACHE)) @test -f $(V8_CACHE) || ( \ printf "\033[36mDownloading prebuilt V8 $(V8_VERSION) ($(ZIG_V8_TAG))...\033[0m\n"; \ curl -fL --progress-bar -o $(V8_CACHE) \ https://github.com/lightpanda-io/zig-v8-fork/releases/download/$(ZIG_V8_TAG)/$(V8_ARCHIVE) \ || (rm -f $(V8_CACHE); printf "\033[33mDownload ERROR\033[0m\n"; exit 1) ) - @ln -sf $(abspath $(V8_CACHE)) $(V8_LINK) - @printf "\033[33mV8 ready: %s -> %s\033[0m\n" "$(V8_LINK)" "$(V8_CACHE)" + @printf "\033[33mV8 ready: %s\033[0m\n" "$(V8_CACHE)" ## Build v8 snapshot build-v8-snapshot: @@ -130,7 +128,7 @@ end2end: @test -d ../demo cd ../demo && go run runner/main.go -## Remove build artifacts (keeps v8/ and zig-pkg/ — slow to re-fetch) +## Remove build artifacts (keeps .lp-cache/ and zig-pkg/ — slow to re-fetch) clean: rm -rf zig-out .zig-cache src/snapshot.bin cd src/html5ever && cargo clean