@@ -96,9 +96,16 @@ wpt-summary:
9696 @printf " \e[36mBuilding wpt...\e[0m\n"
9797 @$(ZIG ) build wpt -- --summary $(filter-out $@ ,$(MAKECMDGOALS ) ) || (printf " \e[33mBuild ERROR\e[0m\n" ; exit 1; )
9898
99- # # Test
99+ # # Test - `grep` is used to filter out the huge compile command on build
100+ ifeq ($(OS ) , macos)
100101test :
101- @TEST_FILTER=' ${F}' $(ZIG ) build test -freference-trace --summary all
102+ @script -q /dev/null sh -c ' TEST_FILTER="${F}" $(ZIG) build test -freference-trace --summary all' 2>&1 \
103+ | grep --line-buffered -v " ^/.*zig test -freference-trace"
104+ else
105+ test :
106+ @script -qec ' TEST_FILTER="${F}" $(ZIG) build test -freference-trace --summary all' /dev/null 2>&1 \
107+ | grep --line-buffered -v " ^/.*zig test -freference-trace"
108+ endif
102109
103110# # Run demo/runner end to end tests
104111end2end :
@@ -120,128 +127,24 @@ build-v8:
120127
121128# Install and build required dependencies commands
122129# ------------
123- .PHONY : install-submodule
124- .PHONY : install-libiconv
125- .PHONY : _install-netsurf install-netsurf clean-netsurf test-netsurf install-netsurf-dev
126- .PHONY : install-mimalloc install-mimalloc-dev clean-mimalloc
127- .PHONY : install-dev install
130+ .PHONY : install-html5ever install-html5ever-dev
131+ .PHONY : install install-dev
128132
129133# # Install and build dependencies for release
130- install : install-submodule install-libiconv install-netsurf install-mimalloc
134+ install : install-submodule install-html5ever
131135
132136# # Install and build dependencies for dev
133- install-dev : install-submodule install-libiconv install-netsurf-dev install-mimalloc-dev
134-
135- install-netsurf-dev : _install-netsurf
136- install-netsurf-dev : OPTCFLAGS := -O0 -g -DNDEBUG
137-
138- install-netsurf : _install-netsurf
139- install-netsurf : OPTCFLAGS := -DNDEBUG
140-
141- BC_NS := $(BC ) vendor/netsurf/out/$(OS ) -$(ARCH )
142- ICONV := $(BC ) vendor/libiconv/out/$(OS ) -$(ARCH )
143- # TODO: add Linux iconv path (I guess it depends on the distro)
144- # TODO: this way of linking libiconv is not ideal. We should have a more generic way
145- # and stick to a specif version. Maybe build from source. Anyway not now.
146- _install-netsurf : clean-netsurf
147- @printf " \e[36mInstalling NetSurf...\e[0m\n" && \
148- ls $(ICONV ) /lib/libiconv.a 1> /dev/null || (printf " \e[33mERROR: you need to execute 'make install-libiconv'\e[0m\n" ; exit 1; ) && \
149- mkdir -p $(BC_NS ) && \
150- cp -R vendor/netsurf/share $(BC_NS ) && \
151- export PREFIX=$(BC_NS ) && \
152- export OPTLDFLAGS=" -L$( ICONV) /lib" && \
153- export OPTCFLAGS=" $( OPTCFLAGS) -I$( ICONV) /include" && \
154- printf " \e[33mInstalling libwapcaplet...\e[0m\n" && \
155- cd vendor/netsurf/libwapcaplet && \
156- BUILDDIR=$(BC_NS ) /build/libwapcaplet make install && \
157- cd ../libparserutils && \
158- printf " \e[33mInstalling libparserutils...\e[0m\n" && \
159- BUILDDIR=$(BC_NS ) /build/libparserutils make install && \
160- cd ../libhubbub && \
161- printf " \e[33mInstalling libhubbub...\e[0m\n" && \
162- BUILDDIR=$(BC_NS ) /build/libhubbub make install && \
163- rm src/treebuilder/autogenerated-element-type.c && \
164- cd ../libdom && \
165- printf " \e[33mInstalling libdom...\e[0m\n" && \
166- BUILDDIR=$(BC_NS ) /build/libdom make install && \
167- printf " \e[33mRunning libdom example...\e[0m\n" && \
168- cd examples && \
169- $(ZIG ) cc \
170- -I$(ICONV ) /include \
171- -I$(BC_NS ) /include \
172- -L$(ICONV ) /lib \
173- -L$(BC_NS ) /lib \
174- -liconv \
175- -ldom \
176- -lhubbub \
177- -lparserutils \
178- -lwapcaplet \
179- -o a.out \
180- dom-structure-dump.c \
181- $(ICONV ) /lib/libiconv.a && \
182- ./a.out > /dev/null && \
183- rm a.out && \
184- printf " \e[36mDone NetSurf $( OS) \e[0m\n"
185-
186- clean-netsurf :
187- @printf " \e[36mCleaning NetSurf build...\e[0m\n" && \
188- rm -Rf $(BC_NS )
189-
190- test-netsurf :
191- @printf " \e[36mTesting NetSurf...\e[0m\n" && \
192- export PREFIX=$(BC_NS ) && \
193- export LDFLAGS=" -L$( ICONV) /lib -L$( BC_NS) /lib" && \
194- export CFLAGS=" -I$( ICONV) /include -I$( BC_NS) /include" && \
195- cd vendor/netsurf/libdom && \
196- BUILDDIR=$(BC_NS ) /build/libdom make test
197-
198- download-libiconv :
199- ifeq ("$(wildcard vendor/libiconv/libiconv-1.17) ","")
200- @mkdir -p vendor/libiconv
201- @cd vendor/libiconv && \
202- curl -L https://github.com/lightpanda-io/libiconv/releases/download/1.17/libiconv-1.17.tar.gz | tar -xvzf -
203- endif
137+ install-dev : install-submodule install-html5ever-dev
204138
205- build-libiconv : clean-libiconv
206- @cd vendor/libiconv/libiconv-1.17 && \
207- ./configure --prefix=$(ICONV ) --enable-static && \
208- make && make install
139+ install-html5ever :
140+ cd src/html5ever && cargo build --release --target-dir ../../build/html5ever/
209141
210- install-libiconv : download-libiconv build-libiconv
211-
212- clean-libiconv :
213- ifneq ("$(wildcard vendor/libiconv/libiconv-1.17/Makefile) ","")
214- @cd vendor/libiconv/libiconv-1.17 && \
215- make clean
216- endif
142+ install-html5ever-dev :
143+ cd src/html5ever && cargo build --target-dir ../../build/html5ever/
217144
218145data :
219146 cd src/data && go run public_suffix_list_gen.go > public_suffix_list.zig
220147
221- .PHONY : _build_mimalloc
222-
223- MIMALLOC := $(BC ) vendor/mimalloc/out/$(OS ) -$(ARCH )
224- _build_mimalloc : clean-mimalloc
225- @mkdir -p $(MIMALLOC ) /build && \
226- cd $(MIMALLOC ) /build && \
227- cmake -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS ) ../../.. && \
228- make && \
229- mkdir -p $(MIMALLOC ) /lib
230-
231- install-mimalloc-dev : _build_mimalloc
232- install-mimalloc-dev : OPTS=-DCMAKE_BUILD_TYPE=Debug
233- install-mimalloc-dev :
234- @cd $(MIMALLOC ) && \
235- mv build/libmimalloc-debug.a lib/libmimalloc.a
236-
237- install-mimalloc : _build_mimalloc
238- install-mimalloc :
239- @cd $(MIMALLOC ) && \
240- mv build/libmimalloc.a lib/libmimalloc.a
241-
242- clean-mimalloc :
243- @rm -Rf $(MIMALLOC ) /build
244-
245148# # Init and update git submodule
246149install-submodule :
247150 @git submodule init && \
0 commit comments