blockchain/docker/build-all-platforms.sh
Claude a6773abaca
Some checks are pending
Build & Release / Linux x86_64 (push) Waiting to run
Build & Release / macOS ARM64 (push) Waiting to run
Build & Release / Create Release (push) Blocked by required conditions
fix(pos): add --rpc-ignore-offline to all daemon configs
PoS mining requires this flag when the daemon has no peers. Without it,
the daemon's get_pos_mining_details RPC returns DISCONNECTED status and
the wallet refuses to mint.

First PoS blocks minted on testnet at height 12,382.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-03 13:53:07 +01:00

77 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
# Build Lethean binaries for all platforms
# Requires: Docker with buildx for multi-arch
#
# Usage:
# ./build-all-platforms.sh testnet # testnet binaries
# ./build-all-platforms.sh mainnet # mainnet binaries
#
# Outputs to: ../build/packages/
set -e
TARGET=${1:-testnet}
TESTNET=$( [ "$TARGET" = "testnet" ] && echo 1 || echo 0 )
VERSION=$(grep 'BUILD_VERSION:=' ../Makefile | cut -d= -f2)
OUTDIR="../build/packages"
echo "Building Lethean $TARGET v$VERSION for all platforms"
mkdir -p "$OUTDIR"
# === Linux x86_64 (Docker) ===
echo ""
echo "=== Linux x86_64 ==="
docker build -f Dockerfile.cross-build \
--build-arg TESTNET=$TESTNET \
--target linux-x64 \
-o "$OUTDIR/linux-x64" \
.. 2>&1 | tail -5
if ls "$OUTDIR/linux-x64/lethean-"* > /dev/null 2>&1; then
PKG="lethean-${TARGET}-linux-x86_64-v${VERSION}"
mkdir -p "$OUTDIR/$PKG"
cp "$OUTDIR/linux-x64/lethean-"* "$OUTDIR/$PKG/"
cd "$OUTDIR" && tar czf "${PKG}.tar.gz" "$PKG/" && cd -
echo " Package: $OUTDIR/${PKG}.tar.gz"
else
echo " Build failed — check Docker output"
fi
# === Linux ARM64 (needs Docker buildx with QEMU) ===
echo ""
echo "=== Linux ARM64 ==="
if docker buildx ls 2>/dev/null | grep -q "linux/arm64"; then
echo " ARM64 builder available — building..."
docker buildx build -f ../utils/docker/lthn-chain/Dockerfile \
--platform linux/arm64 \
--build-arg BUILD_TESTNET=$TESTNET \
--build-arg BUILD_THREADS=4 \
--target build-artifacts \
-o "$OUTDIR/linux-arm64" \
.. 2>&1 | tail -5
else
echo " SKIP: Docker buildx ARM64 emulation not configured"
echo " To enable: docker run --privileged --rm tonistiigi/binfmt --install arm64"
fi
# === macOS (needs native build or osxcross) ===
echo ""
echo "=== macOS ==="
echo " SKIP: macOS builds require native macOS environment or osxcross toolchain"
echo " Build on Cladius (M3 Ultra): cd blockchain && make $TARGET"
echo " Or use GitHub Actions with macos-latest runner"
# === Windows (needs MSVC or mingw-w64) ===
echo ""
echo "=== Windows ==="
echo " SKIP: Windows builds require MSVC or mingw-w64 cross-compiler"
echo " Recommended: GitHub Actions with windows-latest runner"
echo " Or: Docker with dockcross/windows-shared-x64 image"
# === Summary ===
echo ""
echo "=== Build Summary ==="
ls -lh "$OUTDIR"/*.tar.gz 2>/dev/null || echo "No packages built yet"
echo ""
echo "For macOS/Windows, use CI/CD:"
echo " .forgejo/workflows/build-release.yml (push a tag to trigger)"