2021-07-26 02:02:51 +00:00
|
|
|
# Building from Source
|
|
|
|
|
2022-06-06 23:38:46 +00:00
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
* `make` - needed to build openssl via vendor feature
|
|
|
|
* `perl` - needed to build openssl via vendor feature
|
|
|
|
|
2022-08-08 06:10:32 +00:00
|
|
|
### FreeBSD
|
|
|
|
|
|
|
|
* `gmake` - needed to build openssl via vender feature (`pkg install gmake`)
|
|
|
|
|
|
|
|
|
2021-07-26 02:02:51 +00:00
|
|
|
## Using Cargo
|
|
|
|
|
2021-07-29 04:53:32 +00:00
|
|
|
A debug build is straightforward:
|
|
|
|
|
2021-07-26 02:02:51 +00:00
|
|
|
```bash
|
|
|
|
cargo build
|
|
|
|
```
|
|
|
|
|
2021-07-29 04:53:32 +00:00
|
|
|
A release build is also straightforward:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cargo build --release
|
|
|
|
```
|
|
|
|
|
|
|
|
If you want to install the binary locally from source:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Where you are currently an the root of the project
|
|
|
|
cargo install --path .
|
|
|
|
```
|
|
|
|
|
2021-07-26 02:02:51 +00:00
|
|
|
## Completely static binary
|
|
|
|
|
|
|
|
To compile a completely static binary (not linked to libc), we need to target
|
|
|
|
musl using:
|
|
|
|
|
|
|
|
```bash
|
2021-07-29 04:53:32 +00:00
|
|
|
rustup target add x86_64-unknown-linux-musl
|
2021-07-26 02:02:51 +00:00
|
|
|
cargo build --target x86_64-unknown-linux-musl
|
|
|
|
```
|
|
|
|
|
2021-07-29 04:53:32 +00:00
|
|
|
### Mac-specific
|
|
|
|
|
|
|
|
Note that on Mac OS X you will need to install musl-gcc:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
brew install FiloSottile/musl-cross/musl-cross
|
|
|
|
```
|
|
|
|
|
|
|
|
And to do a strip (on Mac), use the musl strip:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
x86_64-linux-musl-gcc target/x86_64-unknown-linux-musl/release/distant
|
|
|
|
```
|
|
|
|
|
2021-07-26 02:02:51 +00:00
|
|
|
At the moment, this is not possible to build on M1 Macs:
|
|
|
|
https://github.com/FiloSottile/homebrew-musl-cross/issues/23
|
2021-07-29 04:53:32 +00:00
|
|
|
|
2022-06-06 23:52:37 +00:00
|
|
|
## Using Docker
|
2021-07-29 04:53:32 +00:00
|
|
|
|
2022-06-06 23:52:37 +00:00
|
|
|
From the root of the repository, run the below, replacing `VERSION` with a
|
|
|
|
version like `0.16.4`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker build -t chipsenkbeil/distant:VERSION .
|
|
|
|
```
|