This guide explains how to build ORLY binaries for multiple platforms.
Build for all platforms:
./scripts/build-all-platforms.sh
Run the platform-specific binary:
./scripts/run-orly.sh
Install cross-compilation tools:
# For Windows builds
sudo apt-get install gcc-mingw-w64-x86-64
# For ARM64 builds
sudo apt-get install gcc-aarch64-linux-gnu
# For Android builds (optional)
# Download Android NDK and set ANDROID_NDK_HOME
CGO cross-compilation for macOS from Linux requires osxcross, which is complex to set up. The build script builds macOS binaries without CGO by default (pure Go).
All binaries are placed in build/ directory:
build/
├── orly-v0.25.0-linux-amd64
├── orly-v0.25.0-linux-arm64
├── orly-v0.25.0-darwin-amd64
├── orly-v0.25.0-darwin-arm64
├── orly-v0.25.0-windows-amd64.exe
├── libsecp256k1-linux-amd64.so
├── libsecp256k1-linux-arm64.so
├── libsecp256k1-windows-amd64.dll
└── SHA256SUMS-v0.25.0.txt
The platform-detect.sh script automatically detects the current platform:
# Detect platform
./scripts/platform-detect.sh detect
# Output: linux-amd64
# Get binary name for current platform
./scripts/platform-detect.sh binary v0.25.0
# Output: orly-v0.25.0-linux-amd64
# Get library name for current platform
./scripts/platform-detect.sh library
# Output: libsecp256k1-linux-amd64.so
./scripts/run-orly.sh [arguments]
This automatically:
Linux:
export LD_LIBRARY_PATH=./build:$LD_LIBRARY_PATH
./build/orly-v0.25.0-linux-amd64
macOS:
export DYLD_LIBRARY_PATH=./build:$DYLD_LIBRARY_PATH
./build/orly-v0.25.0-darwin-arm64
Windows:
set PATH=.\build;%PATH%
.\build\orly-v0.25.0-windows-amd64.exe
All test and deployment scripts now support platform detection:
Test scripts automatically set up the library path:
scripts/test.sh - Sets LDLIBRARYPATH for testsscripts/runtests.sh - Sets LDLIBRARYPATH for benchmarksscripts/test_policy.sh - Sets LDLIBRARYPATH for policy testsscripts/deploy.sh - Builds with CGO and copies libraryscripts/run-orly.sh - Runs platform-specific binaryWhen distributing binaries, include both the executable and library:
For Linux:
orly-v0.25.0-linux-amd64
libsecp256k1-linux-amd64.so
For Windows:
orly-v0.25.0-windows-amd64.exe
libsecp256k1-windows-amd64.dll
Users can then run:
# Linux
chmod +x orly-v0.25.0-linux-amd64
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
./orly-v0.25.0-linux-amd64
# Windows
orly-v0.25.0-windows-amd64.exe
GitHub Actions workflow automatically:
Install the appropriate cross-compiler:
# Windows
sudo apt-get install gcc-mingw-w64-x86-64
# ARM64
sudo apt-get install gcc-aarch64-linux-gnu
Set the appropriate library path:
# Linux
export LD_LIBRARY_PATH=./build:$LD_LIBRARY_PATH
# macOS
export DYLD_LIBRARY_PATH=./build:$DYLD_LIBRARY_PATH
# Windows
set PATH=.\build;%PATH%
Ensure Android NDK is installed and ANDROID_NDK_HOME is set:
export ANDROID_NDK_HOME=/path/to/android-ndk
./scripts/build-all-platforms.sh