forked from Manbearpixel/Obsidian-Qt
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnew-build.sh
executable file
·103 lines (93 loc) · 2.83 KB
/
new-build.sh
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
#!/bin/bash
#################################################################
# Define functions necessary for building Obsidian #
#################################################################
NPROC=$(nproc)
cleandeps(){
rm -rf LATEST.tar.gz
rm -rf libsodium*
}
build_cli_dyn(){
make -j$NPROC -f makefile.unix
}
build_cli_static(){
STATIC=1 make -j$NPROC -f makefile.unix
}
build_gui_static(){
qmake "RELEASE=1"
make -j$NPROC
}
build_gui_dyn(){
qmake
make -j$NPROC
}
init(){
mkdir -p ~/.obsidian && touch $_/obsidian.conf
config=~/.obsidian/obsidian.conf
echo "(Required) RPC User: "
read user
echo "rpcuser=$user" >> $config
echo "(Required) RPC Password: "
unset password;
while IFS=$'\n' read -r -s -n1 pass; do
if [[ -z $pass ]]; then
echo
break
else
echo -n '*'
password+=$pass
fi
done
echo "rpcpassword=$password" >> $config
echo "(Optional) Email Address For Wallet Alerts: "
read email
echo "alertnotify=echo %s | mail -s 'Obsidian Alert' $email" >> $config
}
install_deps(){
#################################################################
# Update Ubuntu and install prerequisites for running Obsidian #
#################################################################
sudo apt-get update
#################################################################
# Build Obsidian from source #
#################################################################
NPROC=$(nproc)
echo "nproc: $NPROC"
#################################################################
# Install all necessary packages for building Obsidian #
#################################################################
sudo apt-get install -y qt4-qmake libqt4-dev libminiupnpc-dev libdb++-dev libdb-dev libcrypto++-dev libqrencode-dev libboost-all-dev build-essential libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libssl-dev ufw git
sudo add-apt-repository -y ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar -xvzf LATEST.tar.gz
cd libsodium*
./configure
make
make check
sudo make install
sudo ldconfig
sudo apt-get install -y libsodium
cd ..
}
install_deps
cleandeps
init
mkdir bin
if [[ "$1" == "--static" ]]
then
cd src
build_cli_static
mv obsidiand ../bin
cd ..
build_gui_static
mv Obsidian-Qt bin/
else
cd src
build_cli_dyn
mv obsidiand ../bin
cd ..
build_gui_dyn
mv Obsidian-Qt bin/
fi