41 lines
2.1 KiB
Bash
Executable file
41 lines
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Runs ON the builder VM (Debian 12 or Ubuntu 22.04 and newer, x86_64) as root. Installs the toolchain, builds
|
|
# igneumd and igneum-miner with the real lottery hash (--features igneum-pow), leaves the binaries in /root/out/.
|
|
# Input: /root/src.tar.gz from make-source.sh. Idempotent; a second run only rebuilds what changed.
|
|
set -euo pipefail
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
log() { printf '%s %s\n' "$(date -u +%H:%M:%S)" "$*"; }
|
|
|
|
if ! command -v cargo >/dev/null 2>&1 && [ ! -x "$HOME/.cargo/bin/cargo" ]; then
|
|
log "installing build dependencies"
|
|
apt-get update -qq
|
|
# rocksdb (librocksdb-sys) needs clang + libclang for bindgen and a C++ compiler; the gRPC and p2p crates run protoc.
|
|
apt-get install -y -qq build-essential clang libclang-dev llvm-dev pkg-config libssl-dev protobuf-compiler libprotobuf-dev curl git >/dev/null
|
|
log "installing rust (stable) with rustup"
|
|
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable >/dev/null
|
|
fi
|
|
# shellcheck disable=SC1091
|
|
. "$HOME/.cargo/env"
|
|
|
|
cd /root
|
|
if [ -f src.tar.gz ]; then
|
|
rm -rf src; tar -xzf src.tar.gz; find src -type f -exec touch {} +; log "unpacked src.tar.gz (sources re-stamped: cargo rebuilds by mtime)"
|
|
fi
|
|
[ -d src/vendor/igneum-node ] || { echo "no src/vendor/igneum-node"; exit 1; }
|
|
cd src/vendor/igneum-node
|
|
|
|
log "building igneumd and igneum-miner (release, --features igneum-pow); about 500 crates, 10 to 25 minutes on 8 vCPU (approximate)"
|
|
start=$(date +%s)
|
|
( while sleep 60; do printf '%s build running, %s s\n' "$(date -u +%H:%M:%S)" "$(( $(date +%s) - start ))"; done ) & ticker=$!
|
|
trap 'kill $ticker 2>/dev/null || true' EXIT
|
|
cargo build --release -p kaspad -p igneum-miner --features igneum-pow 2>&1 | tail -n 30
|
|
kill $ticker 2>/dev/null || true
|
|
log "build finished in $(( $(date +%s) - start )) s"
|
|
|
|
mkdir -p /root/out
|
|
cp target/release/igneumd target/release/igneum-miner /root/out/
|
|
strip /root/out/igneumd /root/out/igneum-miner 2>/dev/null || true
|
|
/root/out/igneumd --version | head -1 | tee /root/out/version.txt
|
|
git -C /root/src/vendor/igneum-node rev-parse --short HEAD >> /root/out/version.txt 2>/dev/null || true
|
|
ls -la /root/out
|