From 6f2fbb12ed682aec3cf0e342c9534afd8a4c9bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Fri, 31 Jul 2026 21:15:42 +0200 Subject: [PATCH] build: rename lib-shared and lib-test targets --- Makefile | 12 ++++++------ build.zig | 14 +++++++------- examples/c/fetch.c | 2 +- examples/c/tools.c | 2 +- include/lightpanda.h | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 93dec9707..30cab0a5e 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ help: # $(ZIG) commands # ------------ -.PHONY: build build-v8-snapshot build-dev download-v8 lib-shared lib-shared-example lib-test run run-release test bench data end2end clean +.PHONY: build build-v8-snapshot build-dev download-v8 lib lib-example test-lib run run-release test bench data end2end clean ## Download the prebuilt V8 archive (skips the 10+ min source build) download-v8: @@ -110,19 +110,19 @@ build-dev: @printf "\033[33mBuild OK\033[0m\n" ## Run the C ABI unit tests -lib-test: - @$(ZIG) build $(ZIGFLAGS) lib-test -freference-trace +test-lib: + @$(ZIG) build $(ZIGFLAGS) test-lib -freference-trace # No $(ZIGFLAGS): the published prebuilt V8 has an exe-only TLS model, so the # shared build compiles V8 from source (one-time, ~40 min). ## Build the C shared library (zig-out/lib + zig-out/include) -lib-shared: +lib: @printf "\033[36mBuilding C shared library (first run builds V8 from source)...\033[0m\n" - @$(ZIG) build shared-lib || (printf "\033[33mBuild ERROR\033[0m\n"; exit 1;) + @$(ZIG) build lib || (printf "\033[33mBuild ERROR\033[0m\n"; exit 1;) @printf "\033[33mBuild OK: zig-out/lib/liblightpanda.so\033[0m\n" ## Link and run the C example against the shared library (needs network) -lib-shared-example: lib-shared +lib-example: lib @mkdir -p zig-out/bin @cc examples/c/fetch.c $$(PKG_CONFIG_PATH=zig-out/lib/pkgconfig pkg-config --cflags --libs lightpanda) \ -Wl,-rpath,$(BC)zig-out/lib -o zig-out/bin/fetch-example diff --git a/build.zig b/build.zig index 07eddd0d7..abe6f0e4d 100644 --- a/build.zig +++ b/build.zig @@ -233,7 +233,7 @@ pub fn build(b: *Build) !void { // The published prebuilt V8 is exe-only (local-exec TLS, malloc // shim); the .so needs a source-built V8. Drop this guard once the // fork releases library-safe archives. - const shared_step = b.step("shared-lib", "Build the C shared library (needs a source-built V8)"); + const lib_step = b.step("lib", "Build the C shared library (needs a source-built V8)"); if (prebuilt_v8_path == null) { const shared_lib = b.addLibrary(.{ .name = "lightpanda", @@ -258,14 +258,14 @@ pub fn build(b: *Build) !void { _ = export_check.addOutputFileArg("export-check-ok"); install_so.step.dependOn(&export_check.step); } - shared_step.dependOn(&install_so.step); - shared_step.dependOn(&install_header.step); + lib_step.dependOn(&install_so.step); + lib_step.dependOn(&install_header.step); // The .so resolves its own dependencies, so the link line is // just the library. const shared_pc = pkgConfigFile(b, version_string, "-L${libdir} -llightpanda"); - shared_step.dependOn(&b.addInstallLibFile(shared_pc, "pkgconfig/lightpanda.pc").step); + lib_step.dependOn(&b.addInstallLibFile(shared_pc, "pkgconfig/lightpanda.pc").step); } else { - shared_step.dependOn(&b.addFail("shared-lib needs a source-built V8: drop -Dprebuilt_v8_path").step); + lib_step.dependOn(&b.addFail("lib needs a source-built V8: drop -Dprebuilt_v8_path").step); } // Own binary: the two test suites must not share one V8 platform. @@ -284,8 +284,8 @@ pub fn build(b: *Build) !void { .use_llvm = true, .test_runner = .{ .path = b.path("src/test_runner.zig"), .mode = .simple }, }); - const lib_test_step = b.step("lib-test", "Run the C ABI unit tests"); - lib_test_step.dependOn(&b.addRunArtifact(lib_tests).step); + const test_lib_step = b.step("test-lib", "Run the C ABI unit tests"); + test_lib_step.dependOn(&b.addRunArtifact(lib_tests).step); } } diff --git a/examples/c/fetch.c b/examples/c/fetch.c index 543f34525..bb8397a29 100644 --- a/examples/c/fetch.c +++ b/examples/c/fetch.c @@ -1,6 +1,6 @@ /* Fetch a page and print it as markdown. * - * Build from the repo root after `make lib-shared`, with the link line + * Build from the repo root after `make lib`, with the link line * documented in include/lightpanda.h. Run: * ./fetch https://example.com */ diff --git a/examples/c/tools.c b/examples/c/tools.c index 22375f38a..e80e60c0e 100644 --- a/examples/c/tools.c +++ b/examples/c/tools.c @@ -1,7 +1,7 @@ /* Drive the browser through the tool surface: navigate, then extract the * page title and links via a selector schema. * - * Build from the repo root after `make lib-shared`, with the link line + * Build from the repo root after `make lib`, with the link line * documented in include/lightpanda.h. Run: * ./tools https://example.com */ diff --git a/include/lightpanda.h b/include/lightpanda.h index f2d88f34d..d39204ed3 100644 --- a/include/lightpanda.h +++ b/include/lightpanda.h @@ -30,7 +30,7 @@ * * Logging goes to stderr (level: warnings and errors in release builds). * - * Linking: `make lib-shared` builds liblightpanda.so (zig-out/lib) and + * Linking: `make lib` builds liblightpanda.so (zig-out/lib) and * installs this header (zig-out/include) plus a pkg-config file: * cc app.c $(PKG_CONFIG_PATH=zig-out/lib/pkgconfig pkg-config --cflags --libs lightpanda) * or by hand: