From 986e69f45d0e85df4965c0cb827e9657dd8e25c1 Mon Sep 17 00:00:00 2001 From: Francis Bouvier Date: Tue, 14 May 2024 11:27:35 +0200 Subject: [PATCH 1/3] Update dependancy jsruntime-lib -> zig-js-runtime Signed-off-by: Francis Bouvier --- .gitmodules | 6 +++--- Makefile | 16 ++++++++-------- README.md | 8 ++++---- build.zig | 6 +++--- vendor/{jsruntime-lib => zig-js-runtime} | 0 5 files changed, 18 insertions(+), 18 deletions(-) rename vendor/{jsruntime-lib => zig-js-runtime} (100%) diff --git a/.gitmodules b/.gitmodules index 3aa7f9fb..1dcd0195 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "vendor/jsruntime-lib"] - path = vendor/jsruntime-lib - url = git@github.com:lightpanda-io/jsruntime-lib.git +[submodule "vendor/zig-js-runtime"] + path = vendor/zig-js-runtime + url = git@github.com:lightpanda-io/zig-js-runtime.git [submodule "vendor/netsurf/libwapcaplet"] path = vendor/netsurf/libwapcaplet url = git@github.com:lightpanda-io/libwapcaplet.git diff --git a/Makefile b/Makefile index 42ee34f7..51eeec2b 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ help: # ------------ .PHONY: build build-release run run-release shell test bench download-zig wpt -zig_version = $(shell grep 'recommended_zig_version = "' "vendor/jsruntime-lib/build.zig" | cut -d'"' -f2) +zig_version = $(shell grep 'recommended_zig_version = "' "vendor/zig-js-runtime/build.zig" | cut -d'"' -f2) kernel = $(shell uname -ms) ## Download the zig recommended version @@ -93,16 +93,16 @@ test: # Install and build required dependencies commands # ------------ .PHONY: install-submodule -.PHONY: install-jsruntime install-jsruntime-dev install-libiconv +.PHONY: install-zig-js-runtime install-zig-js-runtime-dev 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 ## Install and build dependencies for release -install: install-submodule install-jsruntime install-netsurf install-mimalloc +install: install-submodule install-zig-js-runtime install-netsurf install-mimalloc ## Install and build dependencies for dev -install-dev: install-submodule install-jsruntime-dev install-netsurf-dev install-mimalloc-dev +install-dev: install-submodule install-zig-js-runtime-dev install-netsurf-dev install-mimalloc-dev install-netsurf-dev: _install-netsurf install-netsurf-dev: OPTCFLAGS := -O0 -g -DNDEBUG @@ -178,12 +178,12 @@ ifeq ("$(wildcard vendor/libiconv/lib/libiconv.a)","") make && make install endif -install-jsruntime-dev: - @cd vendor/jsruntime-lib && \ +install-zig-js-runtime-dev: + @cd vendor/zig-js-runtime && \ make install-dev -install-jsruntime: - @cd vendor/jsruntime-lib && \ +install-zig-js-runtime: + @cd vendor/zig-js-runtime && \ make install .PHONY: _build_mimalloc diff --git a/README.md b/README.md index f4054973..d7a86f59 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Browsercore is written with [Zig](https://ziglang.org/) `0.12`. You have to install it with the right version in order to build the project. Browsercore also depends on -[js-runtimelib](https://github.com/francisbouvier/jsruntime-lib/), +[js-runtimelib](https://github.com/francisbouvier/zig-js-runtime/), [Netsurf libs](https://www.netsurf-browser.org/) and [Mimalloc](https://microsoft.github.io/mimalloc) libs. @@ -57,13 +57,13 @@ Note, when Mimalloc is built in dev mode, you can dump memory stats with the env var `MIMALLOC_SHOW_STATS=1`. See https://microsoft.github.io/mimalloc/environment.html -### Build jsruntime-lib +### Build zig-js-runtime -The command `make install-jsruntime-dev` uses jsruntime-lib's `zig-v8` dependency to build v8 engine lib. +The command `make install-jsruntime-dev` uses zig-js-runtime's `zig-v8` dependency to build v8 engine lib. Be aware the build task is very long and cpu consuming. Build v8 engine for debug/dev version, it creates -`vendor/jsruntime-lib/vendor/v8/$ARCH/debug/libc_v8.a` file. +`vendor/zig-js-runtime/vendor/v8/$ARCH/debug/libc_v8.a` file. ``` make install-jsruntime-dev diff --git a/build.zig b/build.zig index 6ee7e317..e96ae302 100644 --- a/build.zig +++ b/build.zig @@ -20,8 +20,8 @@ const std = @import("std"); const builtin = @import("builtin"); -const jsruntime_path = "vendor/jsruntime-lib/"; -const jsruntime = @import("vendor/jsruntime-lib/build.zig"); +const jsruntime_path = "vendor/zig-js-runtime/"; +const jsruntime = @import("vendor/zig-js-runtime/build.zig"); const jsruntime_pkgs = jsruntime.packages(jsruntime_path); /// Do not rename this constant. It is scanned by some scripts to determine @@ -106,7 +106,7 @@ pub fn build(b: *std.build.Builder) !void { // add jsruntime pretty deps const pretty = tests.step.owner.createModule(.{ - .source_file = .{ .path = "vendor/jsruntime-lib/src/pretty.zig" }, + .source_file = .{ .path = "vendor/zig-js-runtime/src/pretty.zig" }, }); tests.addModule("pretty", pretty); diff --git a/vendor/jsruntime-lib b/vendor/zig-js-runtime similarity index 100% rename from vendor/jsruntime-lib rename to vendor/zig-js-runtime From f040f422e4be1f83a0be8cb12518b43dede5e6f9 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 14 May 2024 12:18:24 +0200 Subject: [PATCH 2/3] ci: rename jsruntime-lib into zig-js-runtime --- .github/actions/install/action.yml | 8 ++++---- .github/workflows/wpt.yml | 2 +- .github/workflows/zig-test.yml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 0e285631..7f544947 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -8,11 +8,11 @@ runs: - name: install v8 shell: bash run: | - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/debug/libc_v8.a + mkdir -p vendor/zig-js-runtime/vendor/v8/${{env.ARCH}}/debug + ln -s /usr/local/lib/libc_v8.a vendor/zig-js-runtime/vendor/v8/${{env.ARCH}}/debug/libc_v8.a - mkdir -p vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release - ln -s /usr/local/lib/libc_v8.a vendor/jsruntime-lib/vendor/v8/${{env.ARCH}}/release/libc_v8.a + mkdir -p vendor/zig-js-runtime/vendor/v8/${{env.ARCH}}/release + ln -s /usr/local/lib/libc_v8.a vendor/zig-js-runtime/vendor/v8/${{env.ARCH}}/release/libc_v8.a - name: libiconv shell: bash diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml index b0b75172..dac11184 100644 --- a/.github/workflows/wpt.yml +++ b/.github/workflows/wpt.yml @@ -55,7 +55,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} - # fetch submodules recusively, to get jsruntime-lib submodules also. + # fetch submodules recusively, to get zig-js-runtime submodules also. submodules: recursive - uses: ./.github/actions/install diff --git a/.github/workflows/zig-test.yml b/.github/workflows/zig-test.yml index 63450e00..eacd5047 100644 --- a/.github/workflows/zig-test.yml +++ b/.github/workflows/zig-test.yml @@ -15,7 +15,7 @@ on: - "build.zig" - "src/**/*.zig" - "src/*.zig" - - "vendor/jsruntime-lib" + - "vendor/zig-js-runtime" pull_request: # By default GH trigger on types opened, synchronize and reopened. @@ -53,7 +53,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} - # fetch submodules recusively, to get jsruntime-lib submodules also. + # fetch submodules recusively, to get zig-js-runtime submodules also. submodules: recursive - uses: ./.github/actions/install @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} - # fetch submodules recusively, to get jsruntime-lib submodules also. + # fetch submodules recusively, to get zig-js-runtime submodules also. submodules: recursive - uses: ./.github/actions/install @@ -105,7 +105,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.GH_CI_PAT }} - # fetch submodules recusively, to get jsruntime-lib submodules also. + # fetch submodules recusively, to get zig-js-runtime submodules also. submodules: recursive - uses: ./.github/actions/install From 5fbbf1b59fdfa84430b6dd01e82b091eaa74fd4e Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 14 May 2024 12:22:13 +0200 Subject: [PATCH 3/3] readme: fix zig-js-runtime step --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d7a86f59..184475d6 100644 --- a/README.md +++ b/README.md @@ -59,20 +59,20 @@ https://microsoft.github.io/mimalloc/environment.html ### Build zig-js-runtime -The command `make install-jsruntime-dev` uses zig-js-runtime's `zig-v8` dependency to build v8 engine lib. +The command `make install-zig-js-runtime-dev` uses zig-js-runtime's `zig-v8` dependency to build v8 engine lib. Be aware the build task is very long and cpu consuming. Build v8 engine for debug/dev version, it creates `vendor/zig-js-runtime/vendor/v8/$ARCH/debug/libc_v8.a` file. ``` -make install-jsruntime-dev +make install-zig-js-runtime-dev ``` You should also build a release vesion of v8 with: ``` -make install-jsruntime +make install-zig-js-runtime ``` ### All in one build