#!/usr/bin/env bash # Build inside Docker container for Ubuntu 20.04 compatibility set -eu -o pipefail cd /hush3 # Clean previous build artifacts that may be from the host make clean 2>/dev/null || true # Clean host-built depends (native binaries won't work in container) rm -rf depends/built depends/x86_64-unknown-linux-gnu depends/work make -C depends clean 2>/dev/null || true # Limit parallelism to avoid OOM kills inside Docker. # Each C++ compilation can use 1-2 GB RAM; cap at ~half of nproc. JOBS=$(( $(nproc) / 2 )) [ "$JOBS" -lt 1 ] && JOBS=1 # Build RandomX for Linux (clean, since host build is different arch/libc) cd src/RandomX rm -rf build-linux mkdir -p build-linux && cd build-linux cmake -DARCH=native .. make -j"$JOBS" cd /hush3 # Run the normal build ./util/build.sh --disable-tests -j"$JOBS" # Package release echo "Creating Linux release package..." VERSION=$(grep -oP 'define\(_CLIENT_VERSION.*?,\s*\K[0-9]+' configure.ac | head -3 | tr '\n' '.' | sed 's/\.$//') VERSION=${VERSION:-3.10.5} RELEASE_DIR="release/${VERSION}-linux-amd64" mkdir -p "$RELEASE_DIR" strip -s src/hushd src/hush-cli src/hush-tx cp src/hushd src/hush-cli src/hush-tx "$RELEASE_DIR/" cp asmap.dat sapling-spend.params sapling-output.params "$RELEASE_DIR/" 2>/dev/null || true cp contrib/scripts/hush-arrakis-chain contrib/scripts/dragonxd contrib/scripts/dragonx-cli "$RELEASE_DIR/" cp contrib/bootstrap/bootstrap-dragonx.sh "$RELEASE_DIR/" # Create ZIP inside release dir (matches --win-release layout) rm -f "$RELEASE_DIR/${VERSION}-linux-amd64.zip" cd "$RELEASE_DIR" zip -9 "${VERSION}-linux-amd64.zip" * cd ../.. echo "Release package created: $RELEASE_DIR/${VERSION}-linux-amd64.zip" ls -lh "$RELEASE_DIR/${VERSION}-linux-amd64.zip" # Fix ownership of all files created by root so host user can access them if [ -n "${HOST_UID:-}" ] && [ -n "${HOST_GID:-}" ]; then echo "Fixing file ownership to ${HOST_UID}:${HOST_GID}..." chown -R "${HOST_UID}:${HOST_GID}" /hush3 fi