| 1 | # Build Process |
| 2 | |
| 3 | !!! Warning |
| 4 | |
| 5 | This section is currently somewhat WIP. |
| 6 | |
| 7 | !!! Warning |
| 8 | |
| 9 | This section is intended for people who wish to work on/build/distribute bottom, not general users. |
| 10 | |
| 11 | ## Overview |
| 12 | |
| 13 | bottom manages its own binary builds for nightly and stable release purposes. The core build workflow is handled by [`build_releases.yml`](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/build_releases.yml), called by a wrapper workflow for [nightly](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/nightly.yml) and [stable](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/deployment.yml) releases. Builds take place via GitHub Actions. |
| 14 | |
| 15 | The main things built are: |
| 16 | |
| 17 | - Binaries for various platforms |
| 18 | - MSI installer for Windows |
| 19 | - `.deb` package for Debian and its derivatives |
| 20 | |
| 21 | This documentation gives a high-level overview of the build process for each part. For the most up-to-date and detailed reference, definitely refer back to the [`build_releases.yml`](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/build_releases.yml) file. |
| 22 | |
| 23 | ## Binaries |
| 24 | |
| 25 | Binaries are built currently for various targets. Note that not all of these are officially supported. The following general steps are performed: |
| 26 | |
| 27 | - Set up the Rust toolchain for the action runner. |
| 28 | - Enable cache. |
| 29 | - Build a release build with: |
| 30 | |
| 31 | - `--features deploy`, which enables only crates needed for release builds. |
| 32 | - `--locked` to lock the dependency versions. |
| 33 | - The following env variables set: |
| 34 | |
| 35 | - `BTM_GENERATE: true` |
| 36 | - `COMPLETION_DIR: "target/tmp/bottom/completion/"` |
| 37 | - `MANPAGE_DIR: "target/tmp/bottom/manpage/"` |
| 38 | |
| 39 | These generate the manpages and shell completions (see [Packaging](../packaging-and-distribution.md) for some more information). |
| 40 | |
| 41 | - Bundle the binaries and manpage/completions. |
| 42 | - Cleanup. |
| 43 | |
| 44 | Some builds use [`cross`](https://github.com/cross-rs/cross) to do cross-compilation builds for architectures otherwise not natively supported by the runner. |
| 45 | |
| 46 | ## MSI |
| 47 | |
| 48 | This builds a full Windows installer using [`cargo-wix`](https://github.com/volks73/cargo-wix). This requires some setup beforehand with some dependencies: |
| 49 | |
| 50 | - Net-Framework-Core (handled by Powershell) |
| 51 | - wixtoolset (handled by chocolatey) |
| 52 | - Rust toolchain |
| 53 | |
| 54 | After that, cache is enabled, and `cargo wix` takes care of the rest. |
| 55 | |
| 56 | ## `.deb` |
| 57 | |
| 58 | Currently, `.deb` files are built for x86 and ARM architectures (`armv7`, `aarch64`). This is handled by [`cargo-deb`](https://crates.io/crates/cargo-deb). |
| 59 | |
| 60 | - For x86, this is handled natively with just `cargo-deb`. |
| 61 | - For ARM, this uses a Docker container, [cargo-deb-arm](https://github.com/ClementTsang/cargo-deb-arm), which correctly sets the dependencies and architecture for the generated `.deb` file. |
| 62 | |
| 63 | There are additional checks via `dpkg` to ensure the architecture is correctly set. |