docs: document shared library

This commit is contained in:
Fathy Boundjadj 2023-02-05 10:30:08 +01:00
parent d12e2b62e9
commit 61ed570950

View File

@ -104,17 +104,30 @@ As far as tested, the operating systems under are supported:
- MacOS
- Windows 11 and WSL
## Development
## Contributing
Carbonyl is split in two parts: the "core" which is built into a shared library (`libcarbonyl`), and the "runtime" which dynamically loads the core (`carbonyl` executable).
The core is written in Rust and takes a few seconds to build from scratch. The runtime is a modified version of the Chromium headless shell and takes more than an hour to build from scratch.
If you're just making changes to the Rust code, build `libcarbonyl` and replace it in a release version of Carbonyl.
### Core
```console
$ cargo build
```
### Runtime
Few notes:
- You need to build Chromium
- Building Carbonyl is almost the same as building Chromium with extra steps to patch and bundle the Rust library. Scripts in the `scripts/` directory are simple wrappers around `gn`, `ninja`, etc..
- Building the runtime is almost the same as building Chromium with extra steps to patch and bundle the Rust library. Scripts in the `scripts/` directory are simple wrappers around `gn`, `ninja`, etc..
- Building Chromium for arm64 on Linux requires an amd64 processor
- Carbonyl is only tested on Linux and macOS, other platforms likely require code changes to Chromium
- Chromium is huge and takes a long time to build, making your computer mostly unresponsive. An 8-core CPU such as an M1 Max or an i9 9900k with 10 Gbps fiber takes around ~1 hour to fetch and build. It requires around 100 GB of disk space.
### Fetch
#### Fetch
> Fetch Chromium's code.
@ -122,7 +135,7 @@ Few notes:
$ ./scripts/gclient.sh sync
```
### Apply patches
#### Apply patches
> Any changes made to Chromium will be reverted, make sure to save any changes you made.
@ -130,7 +143,7 @@ $ ./scripts/gclient.sh sync
$ ./scripts/patches.sh apply
```
### Configure
#### Configure
```console
$ ./scripts/gn.sh args out/Default
@ -165,7 +178,7 @@ import("//carbonyl/src/browser/args.gn")
# symbol_level=0
```
### Build binaries
#### Build binaries
```console
$ ./scripts/build.sh Default
@ -179,7 +192,7 @@ This should produce the following outputs:
- `out/Default/libGLESv2.so`
- `out/Default/v8_context_snapshot.bin`
### Build Docker image
#### Build Docker image
```console
# Build arm64 Docker image using binaries from the Default target
@ -188,7 +201,7 @@ $ ./scripts/docker-build.sh Default arm64
$ ./scripts/docker-build.sh Default amd64
```
### Run
#### Run
```
$ ./scripts/run.sh Default https://wikipedia.org