readme: add install instructions

This commit is contained in:
Pierre Tachoire
2023-09-01 10:25:09 +02:00
parent 257d0337f0
commit 4124b6e4c0
2 changed files with 100 additions and 0 deletions

View File

@@ -45,3 +45,34 @@ 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:
@cd vendor/lexbor && \
cmake . -DLEXBOR_BUILD_TESTS=ON -DLEXBOR_BUILD_EXAMPLES=ON && \
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`.