151 lines
7.7 KiB
Markdown
151 lines
7.7 KiB
Markdown
---
|
|
title: Self-Hosting, CI and Releases
|
|
description: Bootstrap stages, the zero-CMake build description, bit-identical rebuilds, the CI matrix and release packaging
|
|
section: Self-Hosting & Releases
|
|
badge: zero-CMake
|
|
order: 1
|
|
tags: [self-host, bootstrap, reproducible, ci, gitea, release, installers, voidlibrary]
|
|
updated: 2026-12-06
|
|
---
|
|
|
|
# Self-Hosting, CI and Releases
|
|
|
|
VoidBuildSystem does not need CMake to build itself. The CMake bootstrap produces the first `vbs`; that binary then builds VoidLibrary through `.native_builder(...)`, declares all VBS targets in root [`build.cpp`](https://git.faumaray.com/Void/Build-System/src/branch/main/build.cpp), runs the native test suites, and packages its own installers.
|
|
|
|
## Stage model
|
|
|
|
:::flow
|
|
CMake bootstrap → self-built vbs (stage 2) → rebuilt vbs (stage 3) → bit-identical comparison
|
|
:::
|
|
|
|
| Stage | Producer | Purpose |
|
|
| --- | --- | --- |
|
|
| Bootstrap | CMake + GCC 16 | Build the first `vbs`, `vbs-registry`, `vbs_describe`, benchmarks and tests |
|
|
| Stage 2 | Bootstrap `vbs` | Build VoidLibrary natively, then VBS, then run `VOID_TEST` suites with CMake trapped |
|
|
| Stage 3 | Stage 2 `vbs` | Rebuild in a separate build directory without cache and compare artifacts |
|
|
|
|
The current root description pins VoidLibrary `de1fdcda72ddd6ac069fba433b13f643327efa3f` and requests the modules VBS needs:
|
|
|
|
```cpp
|
|
library.git("https://git.faumaray.com/Void/VoidLibrary.git",
|
|
Void::Build::Commit{"de1fdcda72ddd6ac069fba433b13f643327efa3f"})
|
|
.native_builder({{"VOID_ENABLED_MODULES",
|
|
"Configuration;Text;Unicode;Async;Algorithms;Crypto;Archive;Testing;Log"},
|
|
{"VOID_ENABLE_TESTING", "0"},
|
|
{"BUILD_SHARED_LIBS", false}});
|
|
```
|
|
|
|
The description declares 13 targets:
|
|
|
|
- `VoidBuildSdk`, `VoidBuildCore`, `GenerateBootstrapConfig`;
|
|
- `vbs`, `VoidBuildRegistry`, `vbs-registry`;
|
|
- `vbs_self_smoke`, `vbs_benchmarks`;
|
|
- `vbs_sdk_tests`, `vbs_core_tests`, `vbs_v1_tests`, `vbs_registry_tests`, `vbs_selfhost_tests`.
|
|
|
|
Source membership is convention-based: `sdk/*.cpp`, `src/*/*.cpp`, `src/*/*/*.cpp`, `recipes/**/*.cpp` and `registry/service/*.cpp`. The entry points are excluded from the core library glob.
|
|
|
|
## Commands
|
|
|
|
```sh
|
|
# Bootstrap
|
|
dev cpp-gcc -c cmake -S . -B build -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
dev cpp-gcc -c cmake --build build --parallel 4
|
|
dev cpp-gcc -c ctest --test-dir build --output-on-failure
|
|
|
|
# Stage 2: build and test the whole project without CMake
|
|
VBS_VOID_SOURCE_DIR=/path/to/VoidLibrary \
|
|
build/bin/vbs test --build-dir build/vbs-stage2 --profile release --jobs 8
|
|
|
|
# Stage 3: rebuild in a clean directory without cache
|
|
build/vbs-stage2/profiles/release/out/bin/vbs build \
|
|
--build-dir build/vbs-stage3 --profile release --target vbs --no-cache --jobs 8
|
|
|
|
# Reproducibility check
|
|
sha256sum build/vbs-stage2/profiles/release/out/bin/vbs \
|
|
build/vbs-stage3/profiles/release/out/bin/vbs
|
|
```
|
|
|
|
`VBS_VOID_SOURCE_DIR` is a development override for the **VoidLibrary** Git dependency only. It never modifies the external checkout and does not change the pin in the description.
|
|
|
|
### What makes the rebuild reproducible
|
|
|
|
- `BootstrapConfig.hpp` is generated per profile; `binary_dir` is empty, so the binary resolves its SDK/binary directory relative to itself.
|
|
- The snapshot materialized root maps to the project root and the profile build directory maps to `/vbs-build`.
|
|
- GCC compiles get `-frandom-seed=<object filename>`.
|
|
- Links set `TZ=UTC` and `LC_ALL=C`.
|
|
- Static archives use deterministic mode.
|
|
- Installer/source archives use canonical timestamps and sorted entries.
|
|
|
|
Bit-identical output is an observed property of the VBS-to-VBS stages, not a claim that every external tool is deterministic. Keep the same compiler, binutils and build flags when comparing.
|
|
|
|
## VoidLibrary recipe and migration
|
|
|
|
The native provider has two paths:
|
|
|
|
- **Generic `build.cpp` subproject**: evaluates the dependency's own description and imports its exported targets.
|
|
- **Built-in VoidLibrary recipe** (`recipes/VoidLibrary/VoidLibraryRecipe.cpp`): builds VoidLibrary's module closure for projects that use the library directly.
|
|
|
|
`contrib/voidlibrary-migration/` contains the description used to migrate VoidLibrary itself: a native build with all modules, profiles and a smoke test. VoidLibrary upstream gained its own VBS description and CI workflow; the remaining upstream work is tracked in its own repository rather than being duplicated here.
|
|
|
|
The self-host recipe (`recipes/SelfHost/VbsSelfHostRecipe.cpp`) builds `vbs` itself without CMake and is exercised by `vbs_selfhost_tests`.
|
|
|
|
## CI matrix
|
|
|
|
The Gitea workflow at `.gitea/workflows/ci.yml` defines:
|
|
|
|
| Stage | Runner | What it does |
|
|
| --- | --- | --- |
|
|
| 1 · Requirements | `vulkan` | Verifies GCC 16, `-freflection`, CMake 4, Ninja and Git |
|
|
| 2A · Linux build | `vulkan` | Debug, RelWithDebInfo and ASan+UBSan builds; uploads binaries, SDK library and compile database |
|
|
| 3A · Linux test | `vulkan` | Full CTest for Debug/RelWithDebInfo; SDK + core suites under sanitizers; benchmark smoke on Debug |
|
|
| 2B · Windows Wine build | `windows-gcc` | Cross-builds VBS with MinGW-w64 GCC 16; uploads binaries and SDK |
|
|
| 3B · Windows Wine test | `windows-gcc` | Runs SDK/core executables under Wine; marked `continue-on-error` while the Wine-hosted suite matures |
|
|
| 4A2 · VBS installers (Linux) | `vulkan` | Self-hosted `vbs install` produces tar, sh, zip, deb, rpm, wix, dmg and nuget archives |
|
|
| 4A2 · VBS installers (Windows) | `windows-gcc` | Cross-installs Windows-target tar, zip, nuget and wix archives; non-blocking |
|
|
| 5 · Release | `vulkan` | Verifies the tag against the project version, writes `SHA256SUMS`, creates the Gitea release and uploads assets |
|
|
|
|
The Linux installer job retries once in a fresh build directory before failing. The Windows lanes exist to exercise the target toolchain and packaging path; they are not a claim of native Windows-host support.
|
|
|
|
## Release packaging
|
|
|
|
`vbs install` builds the project, imports dependencies, stages the prefix and writes the archive:
|
|
|
|
```sh
|
|
vbs install --project . --build-dir build/release --profile release --jobs 4 \
|
|
--prefix /tmp/vbs-prefix \
|
|
--package-name VoidBuildSystem --package-version 1.0.0 \
|
|
--archive dist/vbs-v1.0.0-linux-x86_64.tar \
|
|
--archive-format tar
|
|
```
|
|
|
|
The installer job repeats this for all eight formats. The release job:
|
|
|
|
1. checks that a `v*` tag matches `project(VoidBuildSystem VERSION ...)`;
|
|
2. computes `SHA256SUMS` over every artifact;
|
|
3. creates (or reuses) the Gitea release for the tag;
|
|
4. uploads each installer and the checksum file as release assets.
|
|
|
|
The release body names the commit and points readers at `SHA256SUMS`. Windows artifacts are attached when the optional Windows installer job produced them.
|
|
|
|
## Installer contents
|
|
|
|
The current root description installs the CLI binaries (`vbs`, and `vbs-registry` on POSIX). It does **not** declare `VoidBuildSdk`, `VoidBuildCore` or the SDK headers as install targets, so the 1.0.0 release archive contains those binaries plus the generated export metadata, not a complete SDK. Consumers who need the SDK should build or install the libraries explicitly.
|
|
|
|
## Verification checklist for a self-host change
|
|
|
|
:::steps
|
|
@@step[Bootstrap]
|
|
Build and run CTest with GCC 16.
|
|
@@step[Self-host test]
|
|
Run `vbs test` with `cmake` trapped on `PATH`.
|
|
@@step[Rebuild from a clean directory]
|
|
Build again with `--no-cache` and a different build directory.
|
|
@@step[Compare artifacts]
|
|
Hash `vbs`, `libVoidBuildSdk.a` and `libVoidBuildCore.a` from both stages.
|
|
@@step[Package]
|
|
Run `vbs install` for at least tar and one native format; unpack and run the binary.
|
|
:::
|
|
|
|
Next: [check the quality record and known limits](/build-system/developer/quality-and-status).
|