Skip to content

Commit 31833a7

Browse files
committed
Improve build docs
This commit eliminates redundancies between README.md and BUILD.md. Not having to maintain redundant documentation is a big improvement as there is no chance they will be out of sync. Plus, the docs in BUILD.md are a bit more sophisticated while still allowing @probonopd to copy-and-paste commands for his workflow. Additionally, the environment variable used in the chroot scripts has been fixed. The commit further adds a short introduction explaining the differences between the build scripts and recommending Docker for regular users.
1 parent 7ac76ec commit 31833a7

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

BUILD.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# How to build the runtime
22

3+
We maintain and provide two official ways to build the runtime:
4+
5+
- a Docker-based setup that caches dependencies and isolates the build environment from the system
6+
- a `chroot`-based method that can be used in isolated environments like, e.g., GitHub codespaces, if you cannot use Docker
7+
8+
**Please note: We recommend regular users to use the Docker-based setup whenever possible!** The chroot based setup imposes a risk to break your local machine. It is meant **only** for environments that are otherwise isolated or reproducible, e.g., GitHub codespaces.
9+
10+
11+
## chroot-based environment
12+
13+
The chroot-based environment is designed for people who really do not want to use containers and/or run on systems that do not support such an environment (e.g., GitHub codespaces, FreeBSD).
14+
15+
To run a build, use the following command:
16+
17+
```sh
18+
> env ALPINE_ARCH=<arch> chroot/chroot_build.sh
19+
20+
# example calls:
21+
> env ALPINE_ARCH=x86_64 chroot/chroot_build.sh
22+
> env ALPINE_ARCH=i686 chroot/chroot_build.sh
23+
> env ALPINE_ARCH=armhf chroot/chroot_build.sh
24+
> env ALPINE_ARCH=aarch64 chroot/chroot_build.sh
25+
```
26+
27+
The script will download an Alpine miniroot image, extract it into a specific location, bind-mount a set of temporary filesystems (e.g., `/proc`) there, chroot into there and run the build script. It attempts to unmount the previously mounted paths again.
28+
29+
330
## Docker
431

532
As the runtime build requires a special environment with specific dependencies prebuilt and installed as static binaries, we provide a containerized build environment. We use Docker as a runtime for now.
@@ -65,12 +92,3 @@ To specify commands that should be run, use the established `--` to distinguish
6592
> env ARCH=<arch> scripts/create-build-container.sh -u $(id -u):(id -g) -- bash some-script.sh
6693
```
6794

68-
## chroot-based environment
69-
70-
The chroot-based environment is designed for people who really do not want to use containers and/or run on systems that do not support such an environment (e.g., FreeBSD).
71-
72-
To run a build, use the following command:
73-
74-
```sh
75-
> env ARCHITECTURE=<arch> chroot/chroot_build.sh
76-
```

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@ __Please note:__ This repository is meant to be extremely simple.
1717
* Do NOT add additional external dependencies or files. Everything shall be implemented in one file. `runtime.c`
1818
* Do NOT add a complicated "build system" (like autotools, CMake,...) other than the existing simple Makefile and bash
1919

20-
Binaries are provided on GitHub Releases. Should you need to build the runtime locally or on GitHub Codespaces, the following will build the contents of this repository in an Alpine container:
20+
Binaries are provided on GitHub Releases.
2121

22-
```
23-
export ALPINE_ARCH=x86_64
24-
./scripts/chroot/chroot_build.sh # Or execute the steps in it manually
25-
```
26-
27-
This whole process takes only a few seconds, e.g., on GitHub Codespaces.
28-
29-
See [BUILD.md](BUILD.md) for more information, including on how to build using Docker.
22+
**Please see [BUILD.md](BUILD.md) if you want to build the runtime yourself.**
3023

3124
## Signing
3225

0 commit comments

Comments
 (0)