blob: bb11e8252f38281f65c11ba6d5ed26690a5f1b09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/usr/bin/env bash
# Bitflash headless node/miner -- one-shot Linux build (Debian/Ubuntu).
# Builds the dependencies (libsecp256k1 with schnorrsig, RandomX) and then the
# node itself. Run from the project root (the directory that contains src/):
#
# bash build-linux.sh
#
# Result: src/bitflash-node . Run it with: ./src/bitflash-node -gen
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
# Use sudo only when not already root (a root login often has no sudo installed).
SUDO=""
if [ "$(id -u)" -ne 0 ]; then SUDO="sudo"; fi
echo "==> installing system packages"
if command -v apt-get >/dev/null 2>&1; then
$SUDO apt-get update
$SUDO apt-get install -y build-essential cmake git pkg-config autoconf libtool \
libssl-dev libdb5.3++-dev libsodium-dev nlohmann-json3-dev libboost-dev
else
echo "!! non-apt system: install manually -> g++ cmake git autoconf libtool"
echo " libssl-dev libdb++-dev libsodium-dev nlohmann-json (headers)"
fi
# ---- libsecp256k1 (Schnorr/BIP340 + extrakeys), static, installed to /usr/local
if [ ! -f /usr/local/lib/libsecp256k1.a ]; then
echo "==> building libsecp256k1"
rm -rf "$ROOT/secp256k1-build"
git clone --depth 1 https://github.com/bitcoin-core/secp256k1 "$ROOT/secp256k1-build"
cd "$ROOT/secp256k1-build"
./autogen.sh
./configure --enable-module-schnorrsig --enable-module-extrakeys \
--disable-shared --with-pic --disable-benchmark --disable-tests
make -j"$(nproc)"
$SUDO make install
$SUDO ldconfig
cd "$ROOT"
else
echo "==> libsecp256k1 already installed, skipping"
fi
# ---- RandomX (memory-hard CPU PoW), static lib
if [ ! -f "$HOME/RandomX/build/librandomx.a" ]; then
echo "==> building RandomX"
rm -rf "$HOME/RandomX"
git clone --depth 1 https://github.com/tevador/RandomX "$HOME/RandomX"
mkdir -p "$HOME/RandomX/build"
cd "$HOME/RandomX/build"
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j"$(nproc)" randomx
cd "$ROOT"
else
echo "==> RandomX already built, skipping"
fi
# ---- the node
echo "==> building bitflash-node"
cd "$ROOT/src"
make -f makefile.linux RANDOMX_DIR="$HOME/RandomX" -j"$(nproc)"
echo
echo "==================================================================="
echo " DONE. Binary: $ROOT/src/bitflash-node"
echo
echo " Mine: ./src/bitflash-node -gen"
echo " Custom data dir: ./src/bitflash-node -gen -datadir=\$HOME/.bitflash"
echo " Run as a service: see linux-node.service note in the README"
echo "==================================================================="
|