docs: cross-compiling sws from source [skip ci]
https://static-web-server.net/building-from-source/#cross-compiling
Diff
docs/content/building-from-source.md | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
@@ -50,6 +50,25 @@ cargo run --no-default-features -- -h
cargo build --release --no-default-features
```
## Cross-compiling
If you want to cross-compile SWS then consider using [Zig](https://github.com/ziglang/zig) as [linker](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html) for [easier cross compiling](https://actually.fyi/posts/zig-makes-rust-cross-compilation-just-work/).
Let's say, you want to cross-compile SWS from macOS to Linux. Then follow these steps.
1. Add the necessary toolchain, for example: `rustup target add x86_64-unknown-linux-gnu` or using `rustup target add x86_64-unknown-linux-musl` if a statically-linked binary is wanted.
2. Install the latest [Zig](https://github.com/ziglang/zig) version via `brew install zig`
3. Install [cargo-zigbuild](https://github.com/rust-cross/cargo-zigbuild) via `cargo install cargo-zigbuild`
4. Finally, just build SWS as follows:
```sh
# dynamically-linked binary
cargo zigbuild --verbose --release --target=x86_64-unknown-linux-gnu
# or statically-linked binary
cargo zigbuild --verbose --release --target=x86_64-unknown-linux-musl
```
Built binaries can be found under the corresponding toolchain directory inside `target/`.
## Building documentation from source
All HTML documentation is located in the `docs/` project's directory and is built using [Material for MkDocs](https://github.com/squidfunk/mkdocs-material).