forked from ciphrex/mSIGNA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all.sh
executable file
·208 lines (171 loc) · 3.91 KB
/
build-all.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
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
#!/bin/bash
for OPTION in $@
do
case $OPTION in
linux)
if [[ ! -z "$OS" ]]; then echo "OS cannot be set twice"; exit 1; fi
OS=linux
OPTIONS="OS=linux $OPTIONS"
;;
mingw64)
if [[ ! -z "$OS" ]]; then echo "OS cannot be set twice"; exit 1; fi
OS=mingw64
OPTIONS="OS=mingw64 $OPTIONS"
mingw64=true
;;
osx)
if [[ ! -z "$OS" ]]; then echo "OS cannot be set twice"; exit 1; fi
OS=osx
OPTIONS="OS=osx $OPTIONS"
;;
debug)
if [[ ! -z "$BUILD_TYPE" ]]; then echo "Build type cannot be set twice"; exit 2; fi
BUILD_TYPE=debug
OPTIONS="DEBUG=1 $OPTIONS"
;;
release)
if [[ ! -z "$BUILD_TYPE" ]]; then echo "Build type cannot be set twice"; exit 2; fi
BUILD_TYPE=release
;;
litecoin)
if [[ ! -z "$TARGET_NAME" ]]; then echo "Target name cannot be set twice"; exit 2; fi
TARGET_NAME=mSIGNA-ltc
;;
libs_only)
libs_only=true
;;
tools_only)
tools_only=true
;;
*)
OPTIONS="$OPTIONS $OPTION"
esac
done
if [[ -z "$OS" ]]
then
UNAME_S=$(uname -s)
if [[ "$UNAME_S" == "Linux" ]]
then
OS=linux
elif [[ "$UNAME_S" == "Darwin" ]]
then
OS=osx
fi
fi
# Set target platform parameters
if [ $mingw64 ]
then
if [[ -z "$QMAKE_PATH" ]]; then QMAKE_PATH="/usr/x86_64-w64-mingw32/host/bin/"; fi
SPEC="-spec win32-g++"
fi
# Use release as default build type
if [[ -z "$BUILD_TYPE" ]]
then
BUILD_TYPE=release
fi
# Use mSIGNA as default target name
if [[ -z "$TARGET_NAME" ]]
then
TARGET_NAME=mSIGNA
fi
if [[ -z $(git diff --shortstat) ]]
then
COMMIT_HASH=$(git rev-parse HEAD)
else
COMMIT_HASH="N/A"
fi
echo "Building using commit hash $COMMIT_HASH..."
echo "#pragma once" > BuildInfo.h.tmp
echo "#define COMMIT_HASH \"$COMMIT_HASH\"" >> BuildInfo.h.tmp
if [[ ! -f BuildInfo.h ]]
then
touch BuildInfo.h
fi
if [[ -z $(diff BuildInfo.h BuildInfo.h.tmp) ]]
then
rm BuildInfo.h.tmp
else
mv BuildInfo.h.tmp BuildInfo.h
fi
CURRENT_DIR=$(pwd)
set -x
set -e
cd deps/logger
make $OPTIONS
make install
cd ../Signals
make install
cd ../stdutils
make install
cd ../sysutils
make $OPTIONS
make install
cd ../CoinCore
make $OPTIONS
make install
cd ../CoinQ
make $OPTIONS
make install
cd ../CoinDB
make lib $OPTIONS
make install_lib $OPTIONS
if [ $libs_only ]
then
exit
fi
if [ $tools_only ]
then
make tools $OPTIONS
set +x
echo
echo "All dependencies built."
echo
echo "To install coindb and syncdb tools, run the following commands:"
echo " $ cd deps/CoinDB"
echo " $ sudo make install_tools"
echo
exit
fi
#cd ../WebSocketClient
#make libs OS=$OS $OPTIONS
#SYSROOT=../../sysroot make install
cd $CURRENT_DIR
#TODO: Automatically detect whether the following units need recompilation
# Always recompile coinparams
if [[ -e build/$BUILD_TYPE/obj/coinparams.o ]]
then
rm build/$BUILD_TYPE/obj/coinparams.o
fi
# Always recompile splashscreen
if [[ -e build/$BUILD_TYPE/obj/splashscreen.o ]]
then
rm build/$BUILD_TYPE/obj/splashscreen.o
fi
# Always recompile main
if [[ -e build/$BUILD_TYPE/obj/main.o ]]
then
rm build/$BUILD_TYPE/obj/main.o
fi
# The following units also need to be recompiled
# accountmodel.o
# createtxdialog.o
# mainwindow.o
# scriptmodel.o
# txmodel.o
# For OS X, remove any existing instance of the app bundle
if [[ "$OS" == "osx" ]]
then
if [[ -e build/$BUILD_TYPE/$TARGET_NAME.app ]]
then
rm -rf build/$BUILD_TYPE/$TARGET_NAME.app
fi
fi
${QMAKE_PATH}qmake $SPEC CONFIG+=$BUILD_TYPE $TARGET_NAME.pro && make $OPTIONS
if [[ "$OS" == "osx" ]]
then
if [[ -e build/$BUILD_TYPE/$TARGET_NAME.app/Contents/Resources/qt.conf ]]
then
rm build/$BUILD_TYPE/$TARGET_NAME.app/Contents/Resources/qt.conf
fi
${MACDEPLOYQT_PATH}macdeployqt $(find ./build/$BUILD_TYPE -name $TARGET_NAME.app)
fi