d4-format
d4-format copied to clipboard
Static d4tools binary
I think d4tools would gain a lot more traction if it was available as a static binary.
I have very little experience with rust, but was able to generate a static binary like this:
static-binary.sh:
#!/bin/bash
apt update
apt install -y musl-tools
rustup target add x86_64-unknown-linux-musl
cargo build --target=x86_64-unknown-linux-musl --profile release
Executed from the d4-format root directory like:
docker run -it -v $(pwd):$(pwd) --workdir $(pwd) rust:1.84-bookworm ./static-binary.sh
Thoughts?
Edit: Ok, the binary is 129MB 😅
Edit2:
$ ldd ./target/x86_64-unknown-linux-musl/release/d4tools
statically linked
I'll add this for the next release. We can probably reduce with some of these: https://github.com/johnthagen/min-sized-rust