Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
b047cb6
remove libdom
karlseguin Oct 17, 2025
cdd3135
get fetch campire working
karlseguin Oct 28, 2025
d397317
re-enable minimum viable CDP server
karlseguin Oct 28, 2025
59bbfc4
fix casing
karlseguin Oct 28, 2025
1a04ebc
fix Node.contains
karlseguin Oct 28, 2025
fb9cce7
Scripts now properly block rendering
karlseguin Oct 29, 2025
5ae1190
HTMLDocument
karlseguin Oct 29, 2025
c966211
HTMLAllCollection
karlseguin Oct 30, 2025
618b28a
add FormData and base KeyValueList
karlseguin Oct 31, 2025
d397d75
DOMImplementation and DocumentType skeletons
karlseguin Nov 1, 2025
8b3f36c
url/location host getter
karlseguin Nov 1, 2025
9138a3c
MediaQueryLis dummy
karlseguin Nov 1, 2025
21d008c
class_index => class_id
karlseguin Nov 1, 2025
de71b97
optional listener, or object listener
karlseguin Nov 1, 2025
4c0437b
History placeholder
karlseguin Nov 2, 2025
4e9f7c7
Intl and IFrame skeleton
karlseguin Nov 3, 2025
5ec5647
Merge ScriptManager/Module loading changes
karlseguin Nov 13, 2025
32bad5f
Element.matches, Element.hasAttributes and DOMStringMap (Element.data…
karlseguin Nov 13, 2025
c5a1d8a
Element.checkVisibility and Element.checkVisibility
karlseguin Nov 13, 2025
7a5cade
remove 16 bytes from Element
karlseguin Nov 13, 2025
6cf0163
Document.activeElement, focus and blur
karlseguin Nov 13, 2025
6742646
DOMParser
karlseguin Nov 13, 2025
1164da5
copyright notices
karlseguin Nov 14, 2025
7ab88e9
add legacy tests, optimize empty types
karlseguin Nov 14, 2025
04f719c
wpt runner
karlseguin Nov 14, 2025
5ae74d6
improve form element support
karlseguin Nov 14, 2025
c311828
add add_attrs_if_missing callback
karlseguin Nov 14, 2025
19dfea7
Work on HTMLTemplateElement
karlseguin Nov 15, 2025
ff3a9c5
add remove_from_parent html5ever callback
karlseguin Nov 15, 2025
c3ba39c
add reparent_children html5ever callback
karlseguin Nov 15, 2025
b8cc74f
allow filtering legacy tests, fix location tests, improve URLSearchPa…
karlseguin Nov 17, 2025
83b5527
enhance Anchor API
karlseguin Nov 17, 2025
8670938
add rust support into nix flake
mookums Nov 17, 2025
c1c0eda
fix curl dependency issue with zlib
mookums Nov 17, 2025
38ca58d
use llvm on tests
mookums Nov 17, 2025
5819cfb
Merge pull request #1211 from lightpanda-io/zigdom-nix
karlseguin Nov 17, 2025
54a2e76
MutationObserver and IntersectionObserver
karlseguin Nov 18, 2025
991c2c1
More MutationObserver options, Performance API
karlseguin Nov 18, 2025
bd3da38
add native custom elements
karlseguin Nov 19, 2025
1aca22f
JS API table changes for zigdom
nikneym Nov 20, 2025
629297e
uncomment the assertion
nikneym Nov 20, 2025
afaf105
ShadowRoot
karlseguin Nov 20, 2025
0e65bfc
Merge pull request #1225 from lightpanda-io/nikneym/rework-types-zigdom
karlseguin Nov 20, 2025
7b513bd
support long svg element types
karlseguin Nov 20, 2025
ce351af
fix build
karlseguin Nov 20, 2025
57aa267
iframe.contentWindow
karlseguin Nov 20, 2025
302b9f9
micro-optimize pseudoclass parsing, add :modal
karlseguin Nov 20, 2025
b9486e8
add HTMLDialogElement
karlseguin Nov 21, 2025
095413c
Element.toggleAttribute and InteresectionObserver init param overload
karlseguin Nov 21, 2025
1b9b49f
customElements.upgrade
karlseguin Nov 21, 2025
b504a79
dummy ResizeObserver
karlseguin Nov 21, 2025
6784388
initial `Blob` support on zigdom
nikneym Nov 20, 2025
20cbf99
port `Blob` functions
nikneym Nov 21, 2025
4d192f5
port `File` API tests
nikneym Nov 21, 2025
f4d58c8
prefer `get` prefix in getter accessors
nikneym Nov 21, 2025
3e44d5b
move `Blob` out of `files/` + provide subclasses of `Blob` in `_type`
nikneym Nov 21, 2025
9a7bafb
`Blob` is in another castle
nikneym Nov 21, 2025
b4f9f96
add `Blob` ancestor initializer to `Factory`
nikneym Nov 21, 2025
0142520
change how `Blob` and `File` initialized
nikneym Nov 21, 2025
5c9ff9d
fix `Blob#slice` return type
nikneym Nov 21, 2025
de9a0c0
bring back import for `ResizeObserver`
nikneym Nov 21, 2025
1193423
Merge pull request #1229 from lightpanda-io/nikneym/blob-zigdom
karlseguin Nov 21, 2025
cbe2124
make crypto callable from the window
karlseguin Nov 21, 2025
216b166
:checked pseudoclass
karlseguin Nov 21, 2025
470f5b5
Headers and improved Request
karlseguin Nov 21, 2025
357df22
more pseudoclass support
karlseguin Nov 21, 2025
3c010f0
tweak custom element callbacks
karlseguin Nov 22, 2025
6b990f8
CustomEvent and document.createEvent
karlseguin Nov 22, 2025
d3c00cd
Link get/set href
karlseguin Nov 22, 2025
f536f16
Correct exception on custom element re-definition
karlseguin Nov 22, 2025
871fd46
fix 0-size structs all having the same identity (the same pointer
karlseguin Nov 24, 2025
e336c67
various small api fixes/tweaks
karlseguin Nov 24, 2025
aa1742d
use SlabAllocator
mookums Nov 24, 2025
219245b
standardize slab testing names
mookums Nov 25, 2025
218d08b
add some skeleton implementations for various CSS WebAPIs
karlseguin Nov 25, 2025
35a728e
explicitly run microtasks
karlseguin Nov 25, 2025
6d6f134
window.screen
karlseguin Nov 25, 2025
4a46021
element: add prefix and localName accessors
krichprollsch Nov 25, 2025
a0fa232
element: upper case only the suffix part of the tagname
krichprollsch Nov 25, 2025
be0a808
Add HTMLSlotElement, PerformanceObserver and Script get/set type
karlseguin Nov 25, 2025
0da87e1
add slab statistics
mookums Nov 25, 2025
058f86e
new exponential SlabAllocator
mookums Nov 25, 2025
e1d9732
PerformanceObserver.supportedEntryTypes
karlseguin Nov 25, 2025
71af78c
adoptNode and importNode
karlseguin Nov 25, 2025
23e3a1d
move `html5ever/` under `vendor/`
nikneym Nov 25, 2025
6280232
add a build step for `html5ever` in `build.zig`
nikneym Nov 25, 2025
444ae00
mv `vendor/html5ever` `src/html5ever`
nikneym Nov 26, 2025
d23eacb
update `.gitignore`
nikneym Nov 26, 2025
18b51de
Merge pull request #1234 from lightpanda-io/nikneym/html5ever-build-c…
karlseguin Nov 26, 2025
67f63a6
improve parsed (i.e. static) custom element callbacks
karlseguin Nov 26, 2025
8bbf57c
Merge pull request #1233 from lightpanda-io/zigdom-factory-allocators
mookums Nov 26, 2025
63f489d
initial with full chain allocations
mookums Nov 26, 2025
8348f2d
fix slot alignment in slab chunks
mookums Nov 26, 2025
afe9ee5
fix freeing with new combined chains
mookums Nov 26, 2025
2ddaa35
use stream for logging stats
mookums Nov 26, 2025
45c7184
use nullable slice for tracking chain allocations
mookums Nov 26, 2025
15dff34
shrink EventTarget back to 16
mookums Nov 26, 2025
8775564
merge module loading tweaks that were made to main
karlseguin Nov 27, 2025
0d57356
Response constructor, window.CSS
karlseguin Nov 27, 2025
f25b8fc
Event.composedPath and adjusted target when crossing shadowroot boundary
karlseguin Nov 27, 2025
819424f
Support Image constructor (i.e. new Image(..))
karlseguin Nov 27, 2025
94bcb30
fetch response headers
karlseguin Nov 27, 2025
8ce8c7a
use _prototype_root decl everywhere
mookums Nov 27, 2025
34c10e1
fix svgElement + allow base tags
mookums Nov 27, 2025
833a336
call AttributeChangedCallback on upgrade
karlseguin Nov 28, 2025
8858f88
Window.scrollX/Y, postMessage, more custom element edge cases
karlseguin Nov 28, 2025
9f587ab
MessageChannel and MessagePort
karlseguin Nov 28, 2025
0bc0a38
ci: update installation workflow
krichprollsch Nov 25, 2025
dbd500c
update docker file
krichprollsch Nov 25, 2025
a1064a5
cleanup README
krichprollsch Nov 25, 2025
1e090f9
add html5ever install method
krichprollsch Nov 25, 2025
e74a286
ci: add install-html5ever-dev
krichprollsch Nov 25, 2025
bde8b64
update html5ever instructions
krichprollsch Nov 26, 2025
613428c
Execute script.onload/onerror
karlseguin Nov 30, 2025
92ae2c4
ReadableStream
karlseguin Dec 1, 2025
493c5b4
Merge pull request #1232 from lightpanda-io/ns_prefix
karlseguin Dec 1, 2025
92572c9
update zig-v8 version
krichprollsch Nov 29, 2025
f968db6
ci: use setup-zig v2.0.5
krichprollsch Nov 29, 2025
c9b9ef9
ci: build html5ever typo
krichprollsch Dec 1, 2025
d18253d
fix import for rename CSS.zig insto css.zig
krichprollsch Dec 1, 2025
ee7c380
zig fmt
krichprollsch Dec 1, 2025
4b60f56
ci: use releaseFast for hmtl5ever release mode
krichprollsch Dec 1, 2025
129b59a
html5ever: prefer `dev` build only on `Debug` optimization
nikneym Dec 1, 2025
bfa2e6b
Merge pull request #1235 from lightpanda-io/fix-ci-install
karlseguin Dec 1, 2025
07931dd
Merge pull request #1240 from lightpanda-io/nikneym/html5ever-build-o…
karlseguin Dec 1, 2025
af8970b
Merge pull request #1238 from lightpanda-io/zigdom-chain-allocation
mookums Dec 1, 2025
e807c9b
Add XmlSerializer, add Response.type, tweak HTMLTemplate to redirect …
karlseguin Dec 1, 2025
6a48f6d
Element.hasAttributes
karlseguin Dec 1, 2025
fd39168
Range
karlseguin Dec 2, 2025
6a46a9b
HTMLDataElement
karlseguin Dec 2, 2025
3dd61ae
css.zig -> CSS.zig
karlseguin Dec 2, 2025
abd3ee9
Add ignore list for unkown global property
karlseguin Dec 2, 2025
a61e87c
Don't break wait on scheduler callback error
karlseguin Dec 2, 2025
c90e9c1
add Performance.Mark
karlseguin Dec 2, 2025
b5eceb5
try safer http cleanup on page deinit
karlseguin Dec 2, 2025
0690dd9
Merge branch 'performance_mark' into zigdom
karlseguin Dec 2, 2025
4823e0b
Merge branch 'unknown_property_ignore_list' into zigdom
karlseguin Dec 2, 2025
568a442
custom element registry 'whenDefine' function
karlseguin Dec 2, 2025
c0da699
Element.setInnerText
karlseguin Dec 3, 2025
2de0d4b
Header case insensitive
karlseguin Dec 3, 2025
63eeada
Fix comment dump, improve dump of shadowroot and slots
karlseguin Dec 3, 2025
2a4cbbe
Performance.measure
karlseguin Dec 3, 2025
74ffc27
Add stack & line number to script eval failure
karlseguin Dec 3, 2025
60c1f19
add TextTrackCue and VTTCue (for reddit)
karlseguin Dec 3, 2025
7cb06f3
MediaError and :scope pseudoclass
karlseguin Dec 3, 2025
c9882e1
Properly handle insertion of DocumentFragment
karlseguin Dec 4, 2025
aa3a402
Link get/set rel
karlseguin Dec 4, 2025
ff9f9ba
fetch with body
karlseguin Dec 4, 2025
dd3781a
Higher performance.now() precision (closer to FFs behavior)
karlseguin Dec 5, 2025
61a1a25
Fix typos
karlseguin Dec 5, 2025
1cde0bb
preserve casing (tags/attributes) for SVG/XML/MathML namespace
karlseguin Dec 5, 2025
8e16c58
encode property as u32 whenever possible
karlseguin Dec 5, 2025
637a105
getRootNode composed support
karlseguin Dec 5, 2025
e41d530
CompositionEvent
karlseguin Dec 5, 2025
08d7f54
fix comment formatting
krichprollsch Dec 6, 2025
eecadb3
Merge pull request #1249 from lightpanda-io/comment-format
karlseguin Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 20 additions & 27 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
zig:
description: 'Zig version to install'
required: false
default: '0.15.1'
default: '0.15.2'
arch:
description: 'CPU arch used to select the v8 lib'
required: false
Expand All @@ -17,7 +17,7 @@ inputs:
zig-v8:
description: 'zig v8 version to install'
required: false
default: 'v0.1.33'
default: 'v0.1.35'
v8:
description: 'v8 version to install'
required: false
Expand All @@ -26,6 +26,10 @@ inputs:
description: 'cache dir to use'
required: false
default: '~/.cache'
mode:
description: 'debug or release'
required: false
default: 'debug'

runs:
using: "composite"
Expand All @@ -38,7 +42,7 @@ runs:
sudo apt-get update
sudo apt-get install -y wget xz-utils python3 ca-certificates git pkg-config libglib2.0-dev gperf libexpat1-dev cmake clang

- uses: mlugg/setup-zig@v2
- uses: mlugg/setup-zig@v2.0.5
with:
version: ${{ inputs.zig }}

Expand All @@ -58,37 +62,26 @@ runs:

wget -O ${{ inputs.cache-dir }}/v8/libc_v8.a https://github.com/lightpanda-io/zig-v8-fork/releases/download/${{ inputs.zig-v8 }}/libc_v8_${{ inputs.v8 }}_${{ inputs.os }}_${{ inputs.arch }}.a

- name: install v8
- name: install v8 release
if: ${{ inputs.mode == 'release' }}
shell: bash
run: |
mkdir -p v8/out/${{ inputs.os }}/debug/obj/zig/
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/debug/obj/zig/libc_v8.a

mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a

- name: Cache libiconv
id: cache-libiconv
uses: actions/cache@v4
env:
cache-name: cache-libiconv
with:
path: ${{ inputs.cache-dir }}/libiconv
key: vendor/libiconv/libiconv-1.17

- name: download libiconv
if: ${{ steps.cache-libiconv.outputs.cache-hit != 'true' }}
shell: bash
run: make download-libiconv

- name: build libiconv
- name: install v8 debug
if: ${{ inputs.mode == 'debug' }}
shell: bash
run: make build-libiconv
run: |
mkdir -p v8/out/${{ inputs.os }}/debug/obj/zig/
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/debug/obj/zig/libc_v8.a

- name: build mimalloc
- name: hmtl5ever release
if: ${{ inputs.mode == 'release' }}
shell: bash
run: make install-mimalloc
run: zig build -Doptimize=ReleaseFast html5ever

- name: build netsurf
- name: hmtl5ever debug
if: ${{ inputs.mode == 'debug' }}
shell: bash
run: make install-netsurf
run: zig build html5ever
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
mode: 'release'

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
Expand Down Expand Up @@ -74,6 +75,7 @@ jobs:
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
mode: 'release'

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=generic -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
Expand Down Expand Up @@ -114,6 +116,7 @@ jobs:
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
mode: 'release'

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
Expand Down Expand Up @@ -157,6 +160,7 @@ jobs:
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
mode: 'release'

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
submodules: recursive

- uses: ./.github/actions/install
with:
mode: 'release'

- name: zig build release
run: zig build -Doptimize=ReleaseFast -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zig-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: zig-fmt

env:
ZIG_VERSION: 0.15.1
ZIG_VERSION: 0.15.2

on:
pull_request:
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
zig-cache
/.zig-cache/
zig-out
/vendor/netsurf/out
/vendor/libiconv/
/zig-out/
lightpanda.id
/v8/
/build/
/src/html5ever/target/
18 changes: 0 additions & 18 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
[submodule "vendor/netsurf/libwapcaplet"]
path = vendor/netsurf/libwapcaplet
url = https://github.com/lightpanda-io/libwapcaplet.git/
[submodule "vendor/netsurf/libparserutils"]
path = vendor/netsurf/libparserutils
url = https://github.com/lightpanda-io/libparserutils.git/
[submodule "vendor/netsurf/libdom"]
path = vendor/netsurf/libdom
url = https://github.com/lightpanda-io/libdom.git/
[submodule "vendor/netsurf/share/netsurf-buildsystem"]
path = vendor/netsurf/share/netsurf-buildsystem
url = https://github.com/lightpanda-io/netsurf-buildsystem.git
[submodule "vendor/netsurf/libhubbub"]
path = vendor/netsurf/libhubbub
url = https://github.com/lightpanda-io/libhubbub.git/
[submodule "tests/wpt"]
path = tests/wpt
url = https://github.com/lightpanda-io/wpt
[submodule "vendor/mimalloc"]
path = vendor/mimalloc
url = https://github.com/microsoft/mimalloc.git/
[submodule "vendor/nghttp2"]
path = vendor/nghttp2
url = https://github.com/nghttp2/nghttp2.git
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:stable

ARG MINISIG=0.12
ARG ZIG=0.15.1
ARG ZIG=0.15.2
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ARG V8=14.0.365.4
ARG ZIG_V8=v0.1.33
ARG ZIG_V8=v0.1.35
ARG TARGETPLATFORM

RUN apt-get update -yq && \
Expand Down Expand Up @@ -40,9 +40,7 @@ WORKDIR /browser
RUN git submodule init && \
git submodule update --recursive

RUN make install-libiconv && \
make install-netsurf && \
make install-mimalloc
RUN zig build -Doptimize=ReleaseFast html5ever

# download and install v8
RUN case $TARGETPLATFORM in \
Expand Down
128 changes: 12 additions & 116 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,16 @@ wpt-summary:
@printf "\e[36mBuilding wpt...\e[0m\n"
@$(ZIG) build wpt -- --summary $(filter-out $@,$(MAKECMDGOALS)) || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)

## Test
## Test - `grep` is used to filter out the huge compile command on build
ifeq ($(OS), macos)
test:
@TEST_FILTER='${F}' $(ZIG) build test -freference-trace --summary all
@script -q /dev/null sh -c 'TEST_FILTER="${F}" $(ZIG) build test -freference-trace --summary all' 2>&1 \
| grep --line-buffered -v "^/.*zig test -freference-trace"
else
test:
@script -qec 'TEST_FILTER="${F}" $(ZIG) build test -freference-trace --summary all' /dev/null 2>&1 \
| grep --line-buffered -v "^/.*zig test -freference-trace"
endif

## Run demo/runner end to end tests
end2end:
Expand All @@ -120,128 +127,17 @@ build-v8:

# Install and build required dependencies commands
# ------------
.PHONY: install-submodule
.PHONY: install-libiconv
.PHONY: _install-netsurf install-netsurf clean-netsurf test-netsurf install-netsurf-dev
.PHONY: install-mimalloc install-mimalloc-dev clean-mimalloc
.PHONY: install-dev install
.PHONY: install install-dev

## Install and build dependencies for release
install: install-submodule install-libiconv install-netsurf install-mimalloc
install: install-submodule

## Install and build dependencies for dev
install-dev: install-submodule install-libiconv install-netsurf-dev install-mimalloc-dev

install-netsurf-dev: _install-netsurf
install-netsurf-dev: OPTCFLAGS := -O0 -g -DNDEBUG

install-netsurf: _install-netsurf
install-netsurf: OPTCFLAGS := -DNDEBUG

BC_NS := $(BC)vendor/netsurf/out/$(OS)-$(ARCH)
ICONV := $(BC)vendor/libiconv/out/$(OS)-$(ARCH)
# TODO: add Linux iconv path (I guess it depends on the distro)
# TODO: this way of linking libiconv is not ideal. We should have a more generic way
# and stick to a specif version. Maybe build from source. Anyway not now.
_install-netsurf: clean-netsurf
@printf "\e[36mInstalling NetSurf...\e[0m\n" && \
ls $(ICONV)/lib/libiconv.a 1> /dev/null || (printf "\e[33mERROR: you need to execute 'make install-libiconv'\e[0m\n"; exit 1;) && \
mkdir -p $(BC_NS) && \
cp -R vendor/netsurf/share $(BC_NS) && \
export PREFIX=$(BC_NS) && \
export OPTLDFLAGS="-L$(ICONV)/lib" && \
export OPTCFLAGS="$(OPTCFLAGS) -I$(ICONV)/include" && \
printf "\e[33mInstalling libwapcaplet...\e[0m\n" && \
cd vendor/netsurf/libwapcaplet && \
BUILDDIR=$(BC_NS)/build/libwapcaplet make install && \
cd ../libparserutils && \
printf "\e[33mInstalling libparserutils...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libparserutils make install && \
cd ../libhubbub && \
printf "\e[33mInstalling libhubbub...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libhubbub make install && \
rm src/treebuilder/autogenerated-element-type.c && \
cd ../libdom && \
printf "\e[33mInstalling libdom...\e[0m\n" && \
BUILDDIR=$(BC_NS)/build/libdom make install && \
printf "\e[33mRunning libdom example...\e[0m\n" && \
cd examples && \
$(ZIG) cc \
-I$(ICONV)/include \
-I$(BC_NS)/include \
-L$(ICONV)/lib \
-L$(BC_NS)/lib \
-liconv \
-ldom \
-lhubbub \
-lparserutils \
-lwapcaplet \
-o a.out \
dom-structure-dump.c \
$(ICONV)/lib/libiconv.a && \
./a.out > /dev/null && \
rm a.out && \
printf "\e[36mDone NetSurf $(OS)\e[0m\n"

clean-netsurf:
@printf "\e[36mCleaning NetSurf build...\e[0m\n" && \
rm -Rf $(BC_NS)

test-netsurf:
@printf "\e[36mTesting NetSurf...\e[0m\n" && \
export PREFIX=$(BC_NS) && \
export LDFLAGS="-L$(ICONV)/lib -L$(BC_NS)/lib" && \
export CFLAGS="-I$(ICONV)/include -I$(BC_NS)/include" && \
cd vendor/netsurf/libdom && \
BUILDDIR=$(BC_NS)/build/libdom make test

download-libiconv:
ifeq ("$(wildcard vendor/libiconv/libiconv-1.17)","")
@mkdir -p vendor/libiconv
@cd vendor/libiconv && \
curl -L https://github.com/lightpanda-io/libiconv/releases/download/1.17/libiconv-1.17.tar.gz | tar -xvzf -
endif

build-libiconv: clean-libiconv
@cd vendor/libiconv/libiconv-1.17 && \
./configure --prefix=$(ICONV) --enable-static && \
make && make install

install-libiconv: download-libiconv build-libiconv

clean-libiconv:
ifneq ("$(wildcard vendor/libiconv/libiconv-1.17/Makefile)","")
@cd vendor/libiconv/libiconv-1.17 && \
make clean
endif
install-dev: install-submodule

data:
cd src/data && go run public_suffix_list_gen.go > public_suffix_list.zig

.PHONY: _build_mimalloc

MIMALLOC := $(BC)vendor/mimalloc/out/$(OS)-$(ARCH)
_build_mimalloc: clean-mimalloc
@mkdir -p $(MIMALLOC)/build && \
cd $(MIMALLOC)/build && \
cmake -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) ../../.. && \
make && \
mkdir -p $(MIMALLOC)/lib

install-mimalloc-dev: _build_mimalloc
install-mimalloc-dev: OPTS=-DCMAKE_BUILD_TYPE=Debug
install-mimalloc-dev:
@cd $(MIMALLOC) && \
mv build/libmimalloc-debug.a lib/libmimalloc.a

install-mimalloc: _build_mimalloc
install-mimalloc:
@cd $(MIMALLOC) && \
mv build/libmimalloc.a lib/libmimalloc.a

clean-mimalloc:
@rm -Rf $(MIMALLOC)/build

## Init and update git submodule
install-submodule:
@git submodule init && \
Expand Down
Loading