-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathbuild_mac.sh
executable file
·145 lines (129 loc) · 4.4 KB
/
build_mac.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
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
#!/bin/sh
# mac_installation_guide
# befor compile, make sure you have installed dependent packages in your system
# for MacOs systems, do as following
# mac
# pre-installation:
# install denpendancy packages
# >>>> brew install automake autoconf libtool autotools cmake git openssl readline curl
# brew link --force openssl readline curl
#-------------------------------------------------------------------------------------------
# NOTE: Manually install Boost 1.59 and openssl 1.0.2k into default /usr/local directory
# 1). install boost 1.59
# curl -LO http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
# tar -zxvf boost_1_59_0.tar.gz
# cd boost_1_59_0
# ./bootstrap.sh --prefix=/usr/local/boost
# ./b2 cxxflags="-arch x86_64" linkflags="-arch x86_64"
# sudo ./b2 install
# 2). install openssl 1.0.2k
# curl -LO https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz
# tar -zxvf openssl-1.0.2k.tar.gz
# cd openssl-1.0.2k
# ./Configure darwin64-x86_64-cc --prefix=/usr/local/openssl
# make depend
# sudo make install
# details please refer to the WIKI(https://wiki.openssl.org/index.php/Compilation_and_Installation#OS_X)
#--------------------------------------------------------------------------------------------
#
echo "Warning: make sure you have installed dependent packages in your system"
echo "if not, pls read the buildall.sh and run the comment scripts in the beginning"
echo
while true; do
read -p "Do you wish to continue building the program?[y/n] " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please enter yes or no.";;
esac
done
if [ "$1" != "download" ]
then
echo "Do not download sourcecode. Isdownload=Nodownload"
Isdownload=Nodownload
else
Isdownload=$1
fi
currentpath=$(pwd)
leveldbpath=$currentpath/leveldb-1.20/
miniupnpcpath=$currentpath/miniupnpc-1.8.20131209/
leveldbtar=$currentpath/v1.20.tar.gz
miniupnpctar=$currentpath/miniupnpc-1.8.20131209.tar.gz
fc=$currentpath/fast-compile
blockchain=$currentpath/src/Chain
echo "build and install the leveldb [1.18 or later]"
if [ "$Isdownload" = "download" ]
then
echo "download leveldb version 1.20 [https://github.com/google/leveldb/releases]"
curl -Lo v1.20.tar.gz https://github.com/google/leveldb/archive/v1.20.tar.gz
else
echo "Do not download leveldb source files"
fi
echo
if [ -f $leveldbtar ]; then
echo "unzip leveldb source files"
tar -zxvf v1.20.tar.gz
else
echo
fi
if [ -d "$leveldbpath" ]; then
cd $leveldbpath
make
sudo scp out-static/lib* /usr/local/lib/
cd ..
else
echo "Error: there are no related leveldb files, pls check ..."
fi
echo "build and install the miniupnpc [ 1.8 ]"
if [ "$Isdownload" = "download" ] ; then
echo "download http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.20131209.tar.gz"
curl -Lo miniupnpc-1.8.20131209.tar.gz http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.20131209.tar.gz
else
echo "Do not download miniupnpc files"
fi
if [ -f $miniupnpctar ]; then
echo "unzip miniupnpc..."
tar -zxvf miniupnpc-1.8.20131209.tar.gz
else
echo
fi
if [ -d "$miniupnpcpath" ]; then
cd $miniupnpcpath
cmake .
make
sudo make install
cd ..
else
echo "Error: there are no related miniupnpc files, pls check ..."
fi
echo "build fast-compile library..."
if [ "$Isdownload" = "download" ] ; then
git clone https://github.com/Achain-Dev/fast-compile.git
cd fast-compile
git submodule update --init --recursive
git checkout static_variant_string_tag
else
echo
fi
if [ -d "$fc" ]; then
cd $fc
cmake . #[ -DOPENSSL_ROOT_DIR=/usr/local/openssl -DBOOST_ROOT=/usr/local/boost]
make
sudo cp libfc.a /usr/local/lib/
sudo cp $fc/vendor/secp256k1-zkp/src/project_secp256k1-build/.libs/libsecp256k1.a /usr/local/lib
cd ..
else
echo "Error: no related fast-compile files, pls check..."
fi
echo
echo "build Achain linux code..."
echo
if [ -d "$blockchain" ]; then
cd $blockchain
cmake . #[ -DOPENSSL_ROOT_DIR=/usr/local/openssl -DBOOST_ROOT=/usr/local/boost]
make
cd ..
else
echo "Error: no related Achain_linux files, pls check..."
fi
echo "Info: finished building work, pls move $blockchain/Achain to the running directory "