modbuild is the official tool used by TerraVox to compile mods for Linux, Windows, and macOS.
It turns your Rust-based mod into shared libraries (.so
, .dll
, .dylib
) with just one command - no manual setup or cross-compilation headaches.
TerraVox uses dynamic .so
/.dll
/.dylib
files to load mods at runtime.
This tool builds those files for all platforms at once - so your mod works everywhere without needing a Mac or Windows machine.
Build it once:
cd modbuild/
cargo build --release
Inside your mod crate (where Cargo.toml
is), run:
cargo run -p modbuild
Or use the compiled binary:
./target/release/modbuild
You'll see a clean report showing .so
, .dll
, and .dylib
outputs.
In your Cargo.toml
, make sure this is set:
[lib]
crate-type = ["cdylib"]
This makes Rust compile your mod as a dynamic library.
🔧 Building for linux...
✅ Built linux: target/x86_64-unknown-linux-gnu/release/libhello.so
🔧 Building for windows...
✅ Built windows: target/x86_64-pc-windows-gnu/release/libhello.dll
🔧 Building for mac...
✅ Built mac: target/x86_64-apple-darwin/release/libhello.dylib
Install the Windows target:
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-apple-darwin
Use osxcross and set:
export PATH="$HOME/osxcross/target/bin:$PATH"
export CC=o64-clang
export CXX=o64-clang++
Or install cargo-zigbuild:
cargo install cargo-zigbuild
modbuild
will detect this automatically.
- Calls
cargo build
orcargo zigbuild
for each target - Auto-detects macOS cross-compilation tools
- Outputs shared libraries to:
target/x86_64-unknown-linux-gnu/release/lib*.so
target/x86_64-pc-windows-gnu/release/lib*.dll
target/x86_64-apple-darwin/release/lib*.dylib
- Rust 1.74+
- TerraVox mods using
extern "C"
and theTerraVoxApi
- Works on Linux/macOS (Windows coming soon)
MIT - use freely, modify freely, just include the license.