9
9
#
10
10
# Script options:
11
11
# --build-boost Builds Boost libraries.
12
- # --build-zmq Build ZeroMQ libraries.
12
+ # --build-zmq Builds ZeroMQ libraries.
13
13
# --build-dir=<path> Location of downloaded and intermediate files.
14
14
# --prefix=<absolute-path> Library install location (defaults to /usr/local).
15
15
# --disable-shared Disables shared library builds.
16
16
# --disable-static Disables static library builds.
17
+ # --help Display usage, overriding script execution.
17
18
#
18
19
# Verified on Ubuntu 14.04, requires gcc-4.8 or newer.
19
20
# Verified on OSX 10.10, using MacPorts and Homebrew repositories, requires
@@ -44,6 +45,14 @@ BOOST_ARCHIVE="boost_1_62_0.tar.bz2"
44
45
45
46
# Define utility functions.
46
47
# ==============================================================================
48
+ configure_links ()
49
+ {
50
+ # Configure dynamic linker run-time bindings when installing to system.
51
+ if [[ ($OS == Linux) && ($PREFIX == " /usr/local" ) ]]; then
52
+ ldconfig
53
+ fi
54
+ }
55
+
47
56
configure_options ()
48
57
{
49
58
display_message " configure options:"
@@ -56,14 +65,6 @@ configure_options()
56
65
./configure " $@ "
57
66
}
58
67
59
- configure_links ()
60
- {
61
- # Configure dynamic linker run-time bindings when installing to system.
62
- if [[ ($OS == Linux) && ($PREFIX == " /usr/local" ) ]]; then
63
- ldconfig
64
- fi
65
- }
66
-
67
68
create_directory ()
68
69
{
69
70
local DIRECTORY=" $1 "
@@ -91,6 +92,8 @@ display_error()
91
92
92
93
initialize_git ()
93
94
{
95
+ display_heading_message " Initialize git"
96
+
94
97
# Initialize git repository at the root of the current directory.
95
98
git init
96
99
git config user.name anonymous
@@ -161,13 +164,59 @@ push_directory()
161
164
pushd " $DIRECTORY " > /dev/null
162
165
}
163
166
167
+ display_help ()
168
+ {
169
+ display_message " Usage: ./install.sh [OPTION]..."
170
+ display_message " Manage the installation of libbitcoin-protocol."
171
+ display_message " Script options:"
172
+ display_message " --build-boost Builds Boost libraries."
173
+ display_message " --build-zmq Build ZeroMQ libraries."
174
+ display_message " --build-dir=<path> Location of downloaded and intermediate files."
175
+ display_message " --prefix=<absolute-path> Library install location (defaults to /usr/local)."
176
+ display_message " --disable-shared Disables shared library builds."
177
+ display_message " --disable-static Disables static library builds."
178
+ display_message " --help Display usage, overriding script execution."
179
+ display_message " "
180
+ display_message " All unrecognized options provided shall be passed as configuration options for "
181
+ display_message " all dependencies."
182
+ }
164
183
165
184
# Initialize the build environment.
166
185
# ==============================================================================
167
186
# Exit this script on the first build error.
168
187
# ------------------------------------------------------------------------------
169
188
set -e
170
189
190
+ # Parse command line options that are handled by this script.
191
+ # ------------------------------------------------------------------------------
192
+ for OPTION in " $@ " ; do
193
+ case $OPTION in
194
+ # Standard script options.
195
+ (--help) DISPLAY_HELP=" yes" ;;
196
+
197
+ # Standard build options.
198
+ (--prefix=* ) PREFIX=" ${OPTION#* =} " ;;
199
+ (--disable-shared) DISABLE_SHARED=" yes" ;;
200
+ (--disable-static) DISABLE_STATIC=" yes" ;;
201
+
202
+ # Common project options.
203
+ (--with-icu) WITH_ICU=" yes" ;;
204
+ (--with-png) WITH_PNG=" yes" ;;
205
+ (--with-qrencode) WITH_QRENCODE=" yes" ;;
206
+
207
+ # Custom build options (in the form of --build-<option>).
208
+ (--build-icu) BUILD_ICU=" yes" ;;
209
+ (--build-zlib) BUILD_ZLIB=" yes" ;;
210
+ (--build-png) BUILD_PNG=" yes" ;;
211
+ (--build-qrencode) BUILD_QRENCODE=" yes" ;;
212
+ (--build-zmq) BUILD_ZMQ=" yes" ;;
213
+ (--build-boost) BUILD_BOOST=" yes" ;;
214
+
215
+ # Unique script options.
216
+ (--build-dir=* ) BUILD_DIR=" ${OPTION#* =} " ;;
217
+ esac
218
+ done
219
+
171
220
# Configure build parallelism.
172
221
# ------------------------------------------------------------------------------
173
222
SEQUENTIAL=1
@@ -180,6 +229,9 @@ elif [[ ($OS == Darwin) || ($OS == OpenBSD) ]]; then
180
229
PARALLEL=` sysctl -n hw.ncpu`
181
230
else
182
231
display_error " Unsupported system: $OS "
232
+ display_error " Explicit shell-definition of PARALLEL will avoid system detection."
233
+ display_error " "
234
+ display_help
183
235
exit 1
184
236
fi
185
237
@@ -205,32 +257,6 @@ if [[ ($OS == Linux && $CC == "clang") || ($OS == OpenBSD) ]]; then
205
257
export CXXFLAGS=" -stdlib=lib$STDLIB $CXXFLAGS "
206
258
fi
207
259
208
- # Parse command line options that are handled by this script.
209
- # ------------------------------------------------------------------------------
210
- for OPTION in " $@ " ; do
211
- case $OPTION in
212
- # Custom build options (in the form of --build-<option>).
213
- (--build-icu) BUILD_ICU=" yes" ;;
214
- (--build-zlib) BUILD_ZLIB=" yes" ;;
215
- (--build-png) BUILD_PNG=" yes" ;;
216
- (--build-qrencode) BUILD_QRENCODE=" yes" ;;
217
- (--build-zmq) BUILD_ZMQ=" yes" ;;
218
- (--build-boost) BUILD_BOOST=" yes" ;;
219
- (--build-dir=* ) BUILD_DIR=" ${OPTION#* =} " ;;
220
-
221
- # Standard build options.
222
- (--prefix=* ) PREFIX=" ${OPTION#* =} " ;;
223
- (--disable-shared) DISABLE_SHARED=" yes" ;;
224
- (--disable-static) DISABLE_STATIC=" yes" ;;
225
- (--with-icu) WITH_ICU=" yes" ;;
226
- (--with-png) WITH_PNG=" yes" ;;
227
- (--with-qrencode) WITH_QRENCODE=" yes" ;;
228
-
229
- # Standard script options.
230
- (--help) DISPLAY_HELP=" yes" ;;
231
- esac
232
- done
233
-
234
260
# Normalize of static and shared options.
235
261
# ------------------------------------------------------------------------------
236
262
if [[ $DISABLE_SHARED ]]; then
279
305
280
306
display_configuration ()
281
307
{
282
- display_message " Libbitcoin installer configuration."
308
+ display_message " libbitcoin-protocol installer configuration."
283
309
display_message " --------------------------------------------------------------------"
284
310
display_message " OS : $OS "
285
311
display_message " PARALLEL : $PARALLEL "
@@ -290,61 +316,17 @@ display_configuration()
290
316
display_message " CXXFLAGS : $CXXFLAGS "
291
317
display_message " LDFLAGS : $LDFLAGS "
292
318
display_message " LDLIBS : $LDLIBS "
293
- display_message " WITH_ICU : $WITH_ICU "
294
- display_message " WITH_PNG : $WITH_PNG "
295
- display_message " WITH_QRENCODE : $WITH_QRENCODE "
296
- display_message " BUILD_ICU : $BUILD_ICU "
297
- display_message " BUILD_ZLIB : $BUILD_ZLIB "
298
- display_message " BUILD_PNG : $BUILD_PNG "
299
- display_message " BUILD_QRENCODE : $BUILD_QRENCODE "
300
319
display_message " BUILD_ZMQ : $BUILD_ZMQ "
301
320
display_message " BUILD_BOOST : $BUILD_BOOST "
302
- display_message " PREFIX : $PREFIX "
303
321
display_message " BUILD_DIR : $BUILD_DIR "
322
+ display_message " PREFIX : $PREFIX "
304
323
display_message " DISABLE_SHARED : $DISABLE_SHARED "
305
324
display_message " DISABLE_STATIC : $DISABLE_STATIC "
306
325
display_message " with_boost : ${with_boost} "
307
326
display_message " with_pkgconfigdir : ${with_pkgconfigdir} "
308
327
display_message " --------------------------------------------------------------------"
309
328
}
310
- display_install_help ()
311
- {
312
- display_message " Usage: ./install.sh [OPTION]..."
313
- display_message " Manage the installation of libbitcoin-protocol."
314
- display_message " Script options:"
315
- display_message " --with-icu Compile with International Components for Unicode."
316
- display_message " Since the addition of BIP-39 and later BIP-38 "
317
- display_message " support, libbitcoin conditionally incorporates ICU "
318
- display_message " to provide BIP-38 and BIP-39 passphrase "
319
- display_message " normalization features. Currently "
320
- display_message " libbitcoin-explorer is the only other library that "
321
- display_message " accesses this feature, so if you do not intend to "
322
- display_message " use passphrase normalization this dependency can "
323
- display_message " be avoided."
324
- display_message " --with-qrencode Compile with QR Code Support"
325
- display_message " Since the addition of qrcode support, libbitcoin "
326
- display_message " conditionally incorporates qrencode. Currently "
327
- display_message " libbitcoin-explorer is the only other library that "
328
- display_message " accesses this feature, so if you do not intend to "
329
- display_message " use qrcode this dependency can be avoided."
330
- display_message " --with-png Compile with QR Code PNG Output Support"
331
- display_message " Since the addition of png support, libbitcoin "
332
- display_message " conditionally incorporates libpng (which in turn "
333
- display_message " requires zlib). Currently libbitcoin-explorer is "
334
- display_message " the only other library that accesses this feature, "
335
- display_message " so if you do not intend to use png this dependency "
336
- display_message " can be avoided."
337
- display_message " --build-boost Builds Boost libraries."
338
- display_message " --build-zmq Build ZeroMQ libraries."
339
- display_message " --build-dir=<path> Location of downloaded and intermediate files."
340
- display_message " --prefix=<absolute-path> Library install location (defaults to /usr/local)."
341
- display_message " --disable-shared Disables shared library builds."
342
- display_message " --disable-static Disables static library builds."
343
- display_message " --help Display usage, overriding script execution."
344
- display_message " "
345
- display_message " All unrecognized options provided shall be passed as configuration options for "
346
- display_message " all dependencies."
347
- }
329
+
348
330
349
331
# Define build options.
350
332
# ==============================================================================
@@ -387,7 +369,6 @@ BITCOIN_PROTOCOL_OPTIONS=(
387
369
388
370
# Define build functions.
389
371
# ==============================================================================
390
-
391
372
# Because PKG_CONFIG_PATH doesn't get updated by Homebrew or MacPorts.
392
373
initialize_icu_packages ()
393
374
{
@@ -737,7 +718,7 @@ build_all()
737
718
# Build the primary library and all dependencies.
738
719
# ==============================================================================
739
720
if [[ $DISPLAY_HELP ]]; then
740
- display_install_help
721
+ display_help
741
722
else
742
723
display_configuration
743
724
create_directory " $BUILD_DIR "
0 commit comments