forked from digibyte/digibyte
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathbuild_digibyte_ubuntu.sh
More file actions
executable file
·228 lines (201 loc) · 8.34 KB
/
Copy pathbuild_digibyte_ubuntu.sh
File metadata and controls
executable file
·228 lines (201 loc) · 8.34 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/bash
# ============================================================================
# DigiByte Complete Build Script for Ubuntu
# ============================================================================
# This script builds DigiByte from source including Qt GUI.
#
# Usage: ./build_digibyte_ubuntu.sh
# or: curl -sSL <url> | bash
#
# Requirements: Ubuntu 22.04+ with sudo access
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
print_banner() {
echo -e "${CYAN}"
echo "╔═══════════════════════════════════════════════════════════════╗"
echo "║ ║"
echo "║ ██████╗ ██╗ ██████╗ ██╗██████╗ ██╗ ██╗████████╗███████╗ ║"
echo "║ ██╔══██╗██║██╔════╝ ██║██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝ ║"
echo "║ ██║ ██║██║██║ ███╗██║██████╔╝ ╚████╔╝ ██║ █████╗ ║"
echo "║ ██║ ██║██║██║ ██║██║██╔══██╗ ╚██╔╝ ██║ ██╔══╝ ║"
echo "║ ██████╔╝██║╚██████╔╝██║██████╔╝ ██║ ██║ ███████╗ ║"
echo "║ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚══════╝ ║"
echo "║ ║"
echo "║ Ubuntu Build Script ║"
echo "║ ║"
echo "╚═══════════════════════════════════════════════════════════════╝"
echo -e "${NC}"
}
print_banner
# Configuration
REPO_URL="https://github.com/DigiByte-Core/digibyte.git"
BRANCH="feature/digidollar-v1"
DIGIBYTE_DIR="$HOME/digibyte"
# Detect number of CPU cores for parallel compilation
NPROC=$(nproc 2>/dev/null || echo 2)
# Use fewer cores to avoid OOM on small VPS
if [ "$NPROC" -gt 2 ]; then
MAKE_JOBS=$((NPROC - 1))
else
MAKE_JOBS=$NPROC
fi
echo -e "${BLUE}Configuration:${NC}"
echo " Repository: $REPO_URL"
echo " Branch: $BRANCH"
echo " Install dir: $DIGIBYTE_DIR"
echo " Build jobs: $MAKE_JOBS"
echo ""
# ============================================================================
# Step 1: System Update & Dependencies
# ============================================================================
echo -e "\n${YELLOW}[1/4] Installing system dependencies...${NC}"
if command -v apt-get &> /dev/null; then
sudo apt-get update
sudo apt-get install -y \
build-essential \
libtool \
autotools-dev \
automake \
pkg-config \
bsdmainutils \
python3 \
libssl-dev \
libevent-dev \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-test-dev \
libboost-thread-dev \
libsqlite3-dev \
libzmq3-dev \
libminiupnpc-dev \
libnatpmp-dev \
libcurl4-openssl-dev \
libqt5gui5 \
libqt5core5a \
libqt5dbus5 \
qttools5-dev \
qttools5-dev-tools \
libqrencode-dev \
git \
curl
echo -e "${GREEN}Dependencies installed.${NC}"
else
echo -e "${RED}This script requires apt-get (Ubuntu/Debian). Please install dependencies manually.${NC}"
exit 1
fi
# ============================================================================
# Step 2: Clone Repository
# ============================================================================
echo -e "\n${YELLOW}[2/4] Cloning DigiByte repository...${NC}"
if [ -d "$DIGIBYTE_DIR" ]; then
echo "Directory exists, updating..."
cd "$DIGIBYTE_DIR"
git fetch origin
git checkout "$BRANCH"
git pull origin "$BRANCH"
else
echo "Cloning fresh repository..."
git clone "$REPO_URL" "$DIGIBYTE_DIR"
cd "$DIGIBYTE_DIR"
git checkout "$BRANCH"
fi
echo -e "${GREEN}Repository ready on branch: $BRANCH${NC}"
# ============================================================================
# Step 3: Build DigiByte (with Qt GUI)
# ============================================================================
echo -e "\n${YELLOW}[3/4] Building DigiByte with Qt GUI (this may take 15-45 minutes)...${NC}"
cd "$DIGIBYTE_DIR"
# Run autogen if configure doesn't exist
if [ ! -f "./configure" ]; then
echo "Running autogen.sh..."
./autogen.sh
fi
# Configure with Qt GUI enabled
echo "Running configure with Qt GUI..."
./configure \
--with-gui=qt5 \
--with-incompatible-bdb \
--enable-reduce-exports \
CXXFLAGS="-O2"
# Build
echo "Building with $MAKE_JOBS parallel jobs..."
make -j$MAKE_JOBS
# Verify binaries
MISSING_BINARIES=""
[ ! -f "$DIGIBYTE_DIR/src/digibyted" ] && MISSING_BINARIES="$MISSING_BINARIES digibyted"
[ ! -f "$DIGIBYTE_DIR/src/digibyte-cli" ] && MISSING_BINARIES="$MISSING_BINARIES digibyte-cli"
[ ! -f "$DIGIBYTE_DIR/src/qt/digibyte-qt" ] && MISSING_BINARIES="$MISSING_BINARIES digibyte-qt"
if [ -n "$MISSING_BINARIES" ]; then
echo -e "${RED}Error: Build failed. Missing binaries:$MISSING_BINARIES${NC}"
exit 1
fi
echo -e "${GREEN}Build complete!${NC}"
# ============================================================================
# Step 4: Create Helper Scripts
# ============================================================================
echo -e "\n${YELLOW}[4/4] Creating helper scripts...${NC}"
mkdir -p "$HOME/bin"
# digibyte-qt launcher
cat > "$HOME/bin/digibyte-qt" << EOF
#!/bin/bash
$DIGIBYTE_DIR/src/qt/digibyte-qt "\$@"
EOF
chmod +x "$HOME/bin/digibyte-qt"
# digibyted launcher
cat > "$HOME/bin/digibyted" << EOF
#!/bin/bash
$DIGIBYTE_DIR/src/digibyted "\$@"
EOF
chmod +x "$HOME/bin/digibyted"
# digibyte-cli launcher
cat > "$HOME/bin/digibyte-cli" << EOF
#!/bin/bash
$DIGIBYTE_DIR/src/digibyte-cli "\$@"
EOF
chmod +x "$HOME/bin/digibyte-cli"
# Add bin to PATH if not already
if ! grep -q 'HOME/bin' ~/.bashrc; then
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
fi
export PATH="$HOME/bin:$PATH"
# ============================================================================
# Print Summary
# ============================================================================
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ BUILD COMPLETE! ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${BLUE}Binaries built:${NC}"
echo " $DIGIBYTE_DIR/src/digibyted"
echo " $DIGIBYTE_DIR/src/digibyte-cli"
echo " $DIGIBYTE_DIR/src/qt/digibyte-qt"
echo ""
echo -e "${YELLOW}Quick Commands (after restarting shell or running 'source ~/.bashrc'):${NC}"
echo " digibyte-qt - Launch GUI wallet"
echo " digibyte-qt -testnet - Launch GUI wallet (testnet)"
echo " digibyted - Start daemon"
echo " digibyte-cli <command> - CLI interface"
echo ""
echo -e "${YELLOW}Network Ports:${NC}"
echo " Mainnet P2P: 12024 RPC: 14022"
echo " Testnet P2P: 12033 RPC: 14026"
echo ""
echo -e "${YELLOW}Data Directories:${NC}"
echo " Mainnet: ~/.digibyte"
echo " Testnet: ~/.digibyte/testnet26"
echo ""
echo -e "${CYAN}To enable DigiDollar features, add to digibyte.conf:${NC}"
echo " digidollar=1"
echo " txindex=1"
echo ""
echo -e "${GREEN}Run 'source ~/.bashrc' to update your PATH, then start with 'digibyte-qt'${NC}"
echo ""