Merge pull request #4 from francisbouvier/readme

Install: add build and test instructions
This commit is contained in:
Francis Bouvier
2023-09-01 23:32:39 +02:00
committed by GitHub
7 changed files with 112 additions and 3 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
zig-cache
zig-out
vendor
/vendor/lexbor/

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "vendor/jsruntime-lib"]
path = vendor/jsruntime-lib
url = https://github.com/francisbouvier/jsruntime-lib
[submodule "vendor/lexbor-src"]
path = vendor/lexbor-src
url = https://github.com/lexbor/lexbor

View File

@@ -45,3 +45,35 @@ test:
@printf "\e[36mTesting...\e[0m\n"
@zig build test -Dengine=v8 || (printf "\e[33mTest ERROR\e[0m\n"; exit 1;)
@printf "\e[33mTest OK\e[0m\n"
# Install and build required dependencies commands
# ------------
.PHONY: install-submodule
.PHONY: install-lexbor install-jsruntime install-jsruntime-dev
.PHONY: install-dev install
## Install and build dependencies for release
install: install-submodule install-lexbor install-jsruntime
## Install and build dependencies for dev
install-dev: install-submodule install-lexbor install-jsruntime-dev
## Install and build v8 engine for dev
install-lexbor:
@mkdir -p vendor/lexbor
@cd vendor/lexbor && \
cmake ../lexbor-src -DLEXBOR_BUILD_SHARED=OFF && \
make
install-jsruntime-dev:
@cd vendor/jsruntime-lib && \
make install-dev
install-jsruntime:
@cd vendor/jsruntime-lib && \
make install
## Init and update git submodule
install-submodule:
@git submodule init && \
git submodule update

69
README.md Normal file
View File

@@ -0,0 +1,69 @@
# Browsercore
## Build
### Prerequisites
Browsercore is written with [Zig](https://ziglang.org/) `0.10.1`. 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/) and
[lexbor](https://github.com/lexbor/lexbor) libs.
To be able to build the v8 engine for js-runtimelib, you have to install some libs:
For Debian/Ubuntu based Linux:
```
sudo apt install xz-utils \
python3 ca-certificates git \
pkg-config libglib2.0-dev \
cmake
```
For MacOS, you only need Python 3 and cmake.
To be able to build lexbor, you need to install also `cmake`.
### Install and build dependencies
The project uses git submodule for dependencies.
The `make install-submodule` will init and update the submodules in the `vendor/`
directory.
```
make install-submodule
```
### Build lexbor
The command `make install-lexbor` will build lexbor lib used by browsercore.
```
make install-lexbor
```
### Build jsruntime-lib
The command `make install-jsruntime-dev` uses jsruntime-lib'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.
```
make install-jsruntime-dev
```
You should also build a release vesion of v8 with:
```
make install-jsruntime
```
### All in one build
You can run `make intall` and `make install-dev` to install deps all in one.
## Test
You can test browsercore by running `make test`.

View File

@@ -76,7 +76,7 @@ fn common(
fn linkLexbor(step: *std.build.LibExeObjStep) void {
// cmake . -DLEXBOR_BUILD_SHARED=OFF
const lib_path = "../lexbor/liblexbor_static.a";
const lib_path = "vendor/lexbor/liblexbor_static.a";
step.addObjectFile(lib_path);
step.addIncludePath("../lexbor/source");
step.addIncludePath("vendor/lexbor-src/source");
}

1
vendor/jsruntime-lib vendored Submodule

Submodule vendor/jsruntime-lib added at a083235918

1
vendor/lexbor-src vendored Submodule

Submodule vendor/lexbor-src added at b2c0a617f3