README_BUILD.md raw

Multi-Platform Build Scripts

This directory contains scripts for building and running ORLY relay binaries across multiple platforms.

Available Scripts

build-all-platforms.sh

Comprehensive build script that creates binaries for all supported platforms:

Usage:

./scripts/build-all-platforms.sh

Output: All binaries are placed in build/ directory with platform-specific names.

platform-detect.sh

Helper script for platform detection and binary/library name resolution.

Usage:

# Detect current platform
./scripts/platform-detect.sh detect
# Output: linux-amd64

# Get binary name for version
./scripts/platform-detect.sh binary v0.25.0
# Output: orly-v0.25.0-linux-amd64

# Get library name
./scripts/platform-detect.sh library
# Output: libsecp256k1-linux-amd64.so

run-orly.sh

Universal launcher that automatically selects and runs the correct binary for your platform.

Usage:

./scripts/run-orly.sh [arguments for orly]

Features:

Build Prerequisites

For Linux Host

# Install cross-compilation tools
sudo apt-get update
sudo apt-get install -y \
    gcc-mingw-w64-x86-64 \
    gcc-aarch64-linux-gnu \
    autoconf automake libtool

For Android (optional)

Download and install Android NDK, then:

export ANDROID_NDK_HOME=/path/to/android-ndk

Quick Start

  1. Build all platforms:

`bash ./scripts/build-all-platforms.sh `

  1. Run the binary:

`bash ./scripts/run-orly.sh `

  1. Or run specific platform binary:

`bash # Linux export LDLIBRARYPATH=./build:$LDLIBRARYPATH ./build/orly-v0.25.0-linux-amd64

# macOS ./build/orly-v0.25.0-darwin-arm64

# Windows set PATH=.\build;%PATH% .\build\orly-v0.25.0-windows-amd64.exe `

Platform Support Matrix

PlatformArchitectureCGOLibrary RequiredStatus
LinuxAMD64libsecp256k1.soFull Support
LinuxARM64libsecp256k1.soFull Support
macOSAMD64-Full Support
macOSARM64-Full Support
WindowsAMD64libsecp256k1.dllFull Support
AndroidARM64libsecp256k1.soExperimental
AndroidAMD64libsecp256k1.soExperimental

Note: macOS builds use pure Go (no CGO) for easier distribution. Crypto operations are slower but no library dependency is required.

Integration with Other Scripts

All deployment and test scripts have been updated to support platform detection:

CI/CD

GitHub Actions workflow (.github/workflows/go.yml) automatically:

File Naming Convention

Binaries:

Libraries:

Distribution

When distributing binaries, include:

  1. The platform-specific binary
  2. The corresponding library file (for CGO builds)
  3. SHA256SUMS file for verification

Example release structure:

release/
├── 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

Troubleshooting

Binary not found: Run ./scripts/build-all-platforms.sh to build binaries.

Library not found at runtime: Set the 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%

Cross-compilation fails: Install the required cross-compiler (see Build Prerequisites above).

Performance Comparison

Build TypeCrypto SpeedBinary SizeDistribution
CGO (Linux)Fast (2-3x)SmallerNeeds .so
Pure Go (Mac)SlowerLargerSelf-contained

For detailed documentation, see docs/BUILD_PLATFORMS.md.