This directory contains build scripts for cross-platform compilation.
Install build tools for cross-compilation:
For Linux/macOS/Windows (non-MSVC):
cargo install cross --git https://github.com/cross-rs/crossFor Windows MSVC:
cargo install cargo-xwinNote:
- Docker is required for
crosscompilation cargo-xwinallows building Windows MSVC targets from Linux/macOS without Docker
This project builds two binaries:
- server - VPN server
- client - VPN client
Builds both server and client for all supported platforms:
./build.sh [version]Supported targets:
- Linux x86_64 (glibc)
- Linux ARM64 (glibc)
- Linux x86_64 (musl, static)
- Linux ARM64 (musl, static)
- macOS Intel
- macOS Apple Silicon
- Windows x86_64 (MSVC)
Output:
build/- Unpacked binaries with examplesdist/- Compressed archives (.tar.gz/.zip)dist/SHA256SUMS- Checksums for verification
Example:
./build.sh v1.0.0Quick build for both server and client on current platform:
./build-quick.sh [version]Build only server or client for current platform:
./build-single.sh [version] <server|client>Examples:
./build-single.sh v1.0.0 server # Build only server
./build-single.sh v1.0.0 client # Build only clientUse cases:
- Local testing
- Fast iteration
- CI builds for specific platforms
Each archive contains:
server- Server binaryclient- Client binaryREADME.md- Documentationserver.toml.example- Server configuration exampleroutes.json.example- Client routes example
name: Release Build
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: ./build.sh ${{ github.ref_name }}
- uses: actions/upload-artifact@v3
with:
name: binaries
path: dist/*Linux/macOS targets:
# Install target
rustup target add x86_64-unknown-linux-musl
# Build with cross
cross build --release --target x86_64-unknown-linux-muslWindows MSVC target:
# Install target
rustup target add x86_64-pc-windows-msvc
# Build with cargo-xwin
cargo xwin build --release --target x86_64-pc-windows-msvcDocker errors with cross:
- Ensure Docker is running
- Try:
docker pull ghcr.io/cross-rs/x86_64-unknown-linux-gnu:latest
cargo-xwin errors:
- Ensure cargo-xwin is installed:
cargo install cargo-xwin - The tool automatically downloads Windows SDK headers
macOS targets on Linux:
- macOS cross-compilation requires osxcross or macOS host
- Consider building macOS binaries on macOS runners in CI
Missing dependencies:
# Install all required tools
cargo install cross --git https://github.com/cross-rs/cross
cargo install cargo-xwin