Compile
Compiling Stalwart Mail Server from the source has the main advantage that binaries are built with optimizations specific to your hardware which may result in better performance. Another advantage is that you may enable or disable features to suit your needs.
Install Rust
To compile Stalwart Mail Server you need the latest version of Rust. The fastest way to install rust is with rustup
. On Unix systems run the following in your terminal, then follow the onscreen instructions
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
If you are running Windows 64-bit, download and run rustup‑init.exe, then follow the onscreen instructions.
Clone Repo
Clone the Stalwart Mail Server repository:
$ git clone https://github.com/stalwartlabs/mail-server.git
$ cd mail-server
Install required dependencies
The following build dependencies are required:
gcc
clang
make
protoc
$ sudo apt-get install gcc clang make protobuf-compiler
- If you are compiling the Foundation DB backend, download and install the Foundation DB client library.
Compile
Compile Stalwart Mail Server with the default SQLite backend by executing:
$ cargo build --manifest-path=crates/main/Cargo.toml --release
Or, to compile the FoundationDB backend:
$ cargo build --manifest-path=crates/main/Cargo.toml --no-default-features --features foundationdb --release
Once the compilation process is completed, the Stalwart Mail Server
binary will be available under target/release/stalwart-mail
.