Skip to content

Commit f05cb05

Browse files
jschwejdmmrobinson
authored
Add initial offline build instructions (#206)
Release v0.0.5 is the first release which contains the artifact (artifact uploaded manually, future releases will directly add it from CI) Testing: ```shell # in the servo repository create a new clean worktree based on latest main git worktree add ../servo-vendor-testing cd ../servo-vendor-testing # Create a vendored tar-ball (which would be provided by a servo release) ./etc/vendor_servo.py mkdir ../offline-servo cd ../offline-servo # Extracts the tarball into the current directory tar -xf ../servo-vendor-testing/servo.tar.gz uv sync # Now disconnect the internet and build (assuming bootstrap was run before on the machine) ./mach build ``` --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
1 parent 5237d9a commit f05cb05

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [WSL](building/wsl.md)
1919
- [Android](building/android.md)
2020
- [OpenHarmony](building/openharmony.md)
21+
- [Building Offline](building/building-offline.md)
2122
- [General Troubleshooting](building/general-troubleshooting.md)
2223

2324
# Contributing

src/building/offline-builds.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Building Offline
2+
3+
Servo releases provide a `servo-<release-tag>-src-vendored.tar.gz` artifact which contains Servo's source code and all Rust dependencies vendored.
4+
The `.cargo/config.toml` file in the tarball contains the necessary configuration to build Servo offline using the vendored dependencies.
5+
6+
## Linux
7+
8+
Please view the [Linux build instructions](./linux.md) for more on installing the required build dependencies.
9+
We generally recommend using `./mach build` to build Servo, however that does require `uv` to be installed and the Python dependencies to be synced via `uv sync` in advance (otherwise `./mach` will try to access the network to setup the python environment).
10+
```shell
11+
# online pre-build environment (e.g. building a docker container)
12+
uv sync
13+
# offline build environment
14+
./mach build --profile=production --frozen
15+
```
16+
17+
In cases where this is difficult, you can also build Servo using `cargo`, in which case any recent Python version (>= 3.11) should be sufficient (but this is not tested in CI).
18+
Note that `./mach build` will enable the `media-gstreamer` feature by default - When using `cargo` you need to enable this feature manually, and set any gstreamer-related environment variables as well.
19+
The required environment variables for the gstreamer feature are not documented here, but documentation improvements based on our `./mach build` code are welcome.
20+
21+
```shell
22+
# Build an offline release build with the production profile.
23+
cargo build --profile=production --frozen
24+
```
25+
26+
27+
28+
29+
## Windows and macOS
30+
31+
On Windows and macOS, `./mach bootstrap` will download additional dependencies necessary to build Servo.
32+
These are currently not provided in the tarball.
33+
If there is interest in offline builds for these platforms, contributions are welcome (but reach out first on Zulip or via GitHub issues).
34+
35+
36+
## Prebuilt SpiderMonkey Artifacts
37+
38+
Online builds use prebuilt SpiderMonkey artifacts by default, hosted on [servo/mozjs](https://github.com/servo/mozjs)'s GitHub releases.
39+
If you want to simplify or speed-up your build environment, you can pre-download these artifacts yourself and use `MOZJS_ARCHIVE=path/to/libmozjs.tar.gz` to use the prebuilt artifacts in offline builds.
40+
You can verify the integrity of the downloaded artifacts by using [GitHub attestions] with the `gh` tool:
41+
42+
```shell
43+
gh attestion verify path/to/libmozjs.tar.gz -R servo/mozjs
44+
```
45+
46+
[GitHub attestions]: https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations

0 commit comments

Comments
 (0)