build: rename lib-shared and lib-test targets

This commit is contained in:
Adrià Arrufat committed 2026-07-31 21:15:42 +02:00
1 parent 65a88617ec
commit 6f2fbb12ed
5 files changed
+16 -16

No files matched your search

+6 -6
View File
@@ -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
+7 -7
View File
@@ -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);
}
}
+1 -1
View File
@@ -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
*/
+1 -1
View File
@@ -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
*/
+1 -1
View File
@@ -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: