Commit Graph
82 Commits
Author SHA1 Message Date
Adrià Arrufat 585cfb06dd build: compile dependencies in ReleaseFast regardless of -Doptimize
Debug and release builds each compiled their own copy of every C
dependency and of the Rust staticlib, because build.zig threaded the
top-level optimize mode into all of them. Under dev_fast the deps also
picked up the bundled-CRT target query, so even the same mode could not
share objects with a plain build.

Dependencies now build in ReleaseFast for the requested target, the way
the prebuilt V8 archive already works. Debug and release builds share
one set of cached dependency objects, and debug binaries run TLS, HTML
parsing, regex and sqlite optimized. -Ddebug_deps restores the old
behaviour for stepping into a dependency.

The Rust staticlib can only be shared by dropping the Debug-only memstats
feature: its single export, html5ever_get_memory_usage, was declared on
the Zig side but never called, and it pulled a jemalloc build into every
cold debug build. The Makefile override that existed for jemalloc's
nested make goes with it.
2026-09-11 05:40:17 +08:00
Adrià Arrufat 04484f287f Makefile: fix test filtering
- Stop re-exporting command-line variables via MAKEFLAGS: tikv-jemalloc-sys's
  build script appends its jobserver flags after the inherited "-- F=..."
  separator, so a cold cargo cache failed with "No rule to make target '-j'"
  whenever any VAR=value was passed to make.
- `TEST_FILTER=... make test` was silently clobbered by the empty F and ran
  the full suite; fall back to the environment value when F is unset.
2026-08-25 15:16:02 +02:00
Karl Seguin ff5b791b7e wip: screenshot 2026-08-19 21:49:02 +08:00
Karl Seguin 8caaf7ad96 dev: On linux -dev_fast is on by default
Assuming the conditions are met for -dev_fast to work (linux, debug, x86-64
without sanitizers), the -dev_fast now defaults to true.

download-v8 make target always downloads the .a (as before) and on linux x86-64
it also downloads the .so.
2026-08-14 10:43:34 +08:00
Karl Seguin af99e845df dev: support for pre-build shared library
Supports prebuild-v8 shared library and adds a `download-v8-shared` make target.
Depends on: https://github.com/lightpanda-io/zig-v8-fork/pull/198

The auto-discovery of the .so is done in the build.zig, which is different than
the auto-discovery of the .a which is done in the Makefile. This is intentional
and if we inverse -Ddev_fast so that it's on by default, the .a's auto discovery
will be moved to build.zig for consistency and explicitness. As-is, we have no
way to tell whether -Dprebuilt_v8_path=v8.a is being injected by Makefile or
is explicit (which isn't a problem so long as we're not doing dev_fast by
default).
2026-08-13 19:28:21 +08:00
Karl Seguin c726b022e8 tests: improve test output and test log handling
1 - TEST_VERBOSE is now off by default
2 - There's a afterEach callback that is automatically run after each tests, it:
     a - clears the log filters
     b - resets the test arena
3 - LogFilter replace with
     a - testing.silenceLog(&.{...scopes...}); to silence all logs for the given
         scopes.
     b - testing.expectLog(&.{...scopes}); to set log expectations, 1 per log.
         The goal here isn't so much to expect logs (though, you can do that),
         but rather to silence an expected # of logs, without silencing more.
2026-07-31 07:30:25 +08:00
Navid EMAD 862fc91f06 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.
2026-07-24 19:29:07 +02:00
Adrià Arrufat bd95d9a610 test: consume agent regression suite from lightpanda-io/demo
The suite moved to the demo repo (machinery in agent/, targets the
existing public/ sites — lightpanda-io/demo#206). Delete the in-repo
copy and point the agent-deterministic job, agent-regression.yml, and
make test-agent at the demo checkout, passing the binary via LPD_PATH
(the same variable wptrunner uses) — same consumption model as
runner/integration/wpt.

Includes a temporary push trigger on agent-regression.yml to validate
the cross-repo wiring pre-merge; dropped before merging.
2026-07-03 09:59:29 +02:00
Adrià Arrufat f191410773 test: add agent regression suite
Two layers driven by test/agent/run.sh:

- deterministic: replay a golden PandaScript against frozen local HN
  fixtures and diff the returned JSON exactly against a golden file.
  No API key, no network; gates every PR via e2e-test.yml.

- live (GOOGLE_API_KEY): closed-form Q&A over a local fixture page
  (substring match), and a live Hacker News scrape saved with --save,
  replayed token-free and validated against a jq shape invariant.
  Runs nightly and on demand via agent-regression.yml.

The live output contract lives in cases/hn-live.task (prompt) +
schemas/hn-live.jq (invariant). Model pinned to gemini-3.5-flash in
run.sh; per-task timeouts and a $usage token ceiling guard runaway
loops. make test-agent for local runs.
2026-07-02 09:40:22 +02:00
Navid EMAD 47bebded55 Point download-v8 at the cache directly, drop the v8/ symlink
The prebuilt archive already lives at .lp-cache/prebuilt-v8/<version>.a;
the v8/libc_v8.a symlink was redundant indirection. build.zig has no
implicit lookup, so the Makefile passes -Dprebuilt_v8_path explicitly
anyway. Point it straight at the cached file, dropping the symlink step,
the v8/ dir, and its .gitignore entry. Keep the version-keyed filename so
bumping the V8 pin fetches a new file instead of clobbering.
2026-05-22 15:16:57 +02:00
Navid EMAD daa8fff5f3 Add ZIGFLAGS= make download-v8 to fetch prebuilt V8 and skip the source build 2026-05-21 14:39:25 +02:00
Karl Seguin 94e8b06583 Merge pull request #2482 from navidemad/make-v8-path
make: forward optional V8_PATH to zig build
2026-05-16 08:41:05 +08:00
Navid EMAD 54e09a5ace make: rename V8_PATH to generic ZIGFLAGS
Per review feedback, generalise the optional pass-through so any
`-D...` build option can be forwarded, not just the prebuilt V8 path.
2026-05-16 02:27:52 +02:00
Karl Seguin 732e19c7b6 add cargo clean to html5ever 2026-05-16 07:34:35 +08:00
Navid EMAD d1a0203d88 make: forward optional V8_PATH to zig build
Without -Dprebuilt_v8_path, the build/test targets rebuild V8 from
source (10+ minutes per invocation). Contributors who already have a
cached archive can now short-circuit by exporting V8_PATH:

    V8_PATH=v8/libc_v8.a mise exec -- make test

When V8_PATH is empty (default), behavior is unchanged.
2026-05-15 22:53:00 +02:00
Navid EMAD ee1cbf1bb3 make: add clean target 2026-05-15 22:51:54 +02:00
Adrià Arrufat f1293b7346 Merge branch 'main' into semantic-versioning 2026-03-20 07:04:05 +09:00
Adrià Arrufat fa1dd5237d build: remove shell target from Makefile 2026-03-19 13:24:41 +09:00
Adrià Arrufat 2dbd32d120 build: automate version resolution in build.zig
Removes manual git flags from CI and build scripts.
Versioning is now automatically derived from git and build.zig.zon.

With this PR, we follow https://semver.org/
Logic:

1. Read the version from build.zig.zon
2. If it doesn't have a `.pre` field (i.e. dev/alpha/beta) it will use that
3. Otherwise it will get the info from git: hash and number of commits since last `.0` version
4. Then build the version: `0.3.0-dev.1493+0896edc3`

Note that, since the latest stable version is `0.2.6`.
The convention is to use `0.3.0-dev`, as:
- `0.2.6` < `0.3.0.dev` < `0.3.0`
2026-03-19 13:03:29 +09:00
ireydiak 7c18d857f0 chore: removed gitsubmodules from README and Makefile 2026-02-28 12:36:40 -05:00
Pierre Tachoire 24b6934d3b remove WPT specific code
Using both lightpanda-io/wpt and lightpanda-io/demo/wptrunner remove the
need for code specific to run WPT from browser.
2026-02-27 10:09:07 +01:00
Pierre Tachoire e288bfbec4 typo fix 2026-02-18 14:50:43 +01:00
Pierre Tachoire d5f4ca15cc add v8 snapshot in build processes 2026-01-07 17:22:49 +01:00
Pierre Tachoire e642c85ebd use ReleaseFast build 2026-01-07 17:22:49 +01:00
Pierre Tachoire 00d4ac6137 update ci scripts
* use checkout v6
* remove useless target from Makefile
2025-12-29 15:17:19 +01:00
Pierre Tachoire d1c33f0872 build: standardize ansi escape sequences in makefile 2025-12-29 12:55:56 +01:00
Pierre Tachoire ffe2bc9a02 update README 2025-12-24 10:35:11 +01:00
Pierre Tachoire 22303d2ae8 Merge pull request #1236 from lightpanda-io/v8-build-with-zig-gclient-ci
V8 build with zig gclient ci
2025-12-18 11:55:55 +08:00
Karl Seguin 3d8b1abda4 More legacy tests
Largely around how URL attributes (a.href, img.href, link.href) handle empty
values.
2025-12-11 16:45:19 +08:00
Halil Durak 6280232e91 add a build step for html5ever in build.zig 2025-11-26 14:20:39 +03:00
Karl Seguin b047cb6dc1 remove libdom 2025-10-27 22:14:59 +08:00
Pierre Tachoire 3b51ca3947 make: download libiconv from GH fork 2025-09-15 08:59:30 +02:00
Pierre Tachoire 62a2d08b53 ci: cache libiconv 2025-09-15 08:43:48 +02:00
sjorsdonkers 7da83d2259 fix makebuilddev 2025-06-03 16:25:35 +02:00
Karl SeguinandPierre Tachoire 72a983f6d8 Apply suggestions from code review
Co-authored-by: Pierre Tachoire <pierre@lightpanda.io>
2025-05-22 15:36:55 +08:00
Karl Seguin a720333c0f Add debug log level to make build-dev and add new make run-debug
Update WPT submodule, now includes xhr/formdata tests.
2025-05-22 15:28:07 +08:00
Karl Seguin ca3fa3dc40 Rework WPT runner (#589)
* Rework WPT runner

We have no crashing tests, remove safe mode. Allows better re-use of arenas,
and if we do introduce a crash, it won't be easy to ignore. Could allow for
re-using the environment across tests to further improve performance.

Remove console now that we have a working console api.

* Update workflows, add summary

Remove --safe option from WPT workflows (it's no longer valid)

Include a total test/case summary when --summary or --text (default) is used.

* remove wpt --safe flag from Makefile

* handle tests in the root of the test folder

* Fix a couple possible segfaults base on strange usage (WPT stuff)

* generate proper JSON

* generate proper JSON (for real this time?)

* fix tag type check
2025-05-03 07:53:02 +08:00
Pierre Tachoire b62faef520 make: add end2end target 2025-04-17 17:41:29 +02:00
Karl Seguin f6c43eaf9c Fix dockerfile (hopefully)
Add dummy --json stats output to tests

Comment typos fixed

Add make get-v8, build-v8 and build-v8-dev make targets
2025-04-15 15:18:06 +08:00
Karl Seguin cda6f89dba work on fixing github workflows 2025-04-15 15:18:06 +08:00
Karl Seguin b8d7744563 replace zig-js-runtime 2025-04-15 15:18:04 +08:00
Pierre Tachoire e79cd58c8f ci: add macos x86_64 nightly build 2025-03-19 17:12:10 +01:00
Pierre Tachoire c5397bfbe2 Merge pull request #448 from karlseguin/set_cookie
Add Set-Cookie parsing
2025-03-04 13:20:33 +01:00
Karl Seguin 6f5028612a add cookie jar 2025-02-27 16:09:10 +08:00
Karl Seguin d0ba06c44b Add git_commit to build and build-dev target
Add "version" command to cli.
2025-02-26 20:44:44 +08:00
Karl Seguin 6d6b840cf6 Use $(ZIG) variable when building netsurf 2025-02-20 08:42:45 +08:00
Karl Seguin 2c4661a250 Add a new unittest build step
Preserves all existing behavior (i.e. make test and zig build test are not
changed in any way).

The new 'unittest' only runs unit tests and is fast to build. It takes ~1.7 to
build unittest, vs ~11.09 to build test. This is really the main goal, and
hopefully any unit test which are (a) fast and (b) don't impact build times
will be run here.

The test runner is based on:
https://gist.github.com/karlseguin/c6bea5b35e4e8d26af6f81c22cb5d76b

It allow filtering, i.e. `make unittest F="parse query dup"`.

'unittest' does memory leak detection when tests use std.testing.allocator.

Fixed a memory leak in url/query which was detected/reported with by the new
'unittest'.

In order to avoid having 3 src/test_xyx.zig files, I merged the existing
test_runner.zig and run_tests.zig into a single main_tests.zig. (this change
is superfluous, but I thought it was cleaner this way. Happy to revert this).
2025-02-09 11:04:21 +08:00
Lucien Coffe 88e32505a3 fix Makefile download-zig: url changed 2024-11-22 18:50:11 +01:00
Francis Bouvier 2a2486cbe0 build: fix clean-libiconv
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-10-30 13:41:34 +01:00
Francis Bouvier b9e2be2052 build: support multi os/arch conf for netsurf
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
2024-10-29 20:06:29 +01:00