99#
1010# Script options:
1111# --build-boost Builds Boost libraries.
12- # --build-zmq Build ZeroMQ libraries.
12+ # --build-zmq Builds ZeroMQ libraries.
1313# --build-dir=<path> Location of downloaded and intermediate files.
1414# --prefix=<absolute-path> Library install location (defaults to /usr/local).
1515# --disable-shared Disables shared library builds.
1616# --disable-static Disables static library builds.
17+ # --help Display usage, overriding script execution.
1718#
1819# Verified on Ubuntu 14.04, requires gcc-4.8 or newer.
1920# Verified on OSX 10.10, using MacPorts and Homebrew repositories, requires
@@ -44,6 +45,14 @@ BOOST_ARCHIVE="boost_1_57_0.tar.bz2"
4445
4546# Define utility functions.
4647# ==============================================================================
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+
4756configure_options ()
4857{
4958 display_message " configure options:"
@@ -56,14 +65,6 @@ configure_options()
5665 ./configure " $@ "
5766}
5867
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-
6768create_directory ()
6869{
6970 local DIRECTORY=" $1 "
@@ -91,6 +92,8 @@ display_error()
9192
9293initialize_git ()
9394{
95+ display_heading_message " Initialize git"
96+
9497 # Initialize git repository at the root of the current directory.
9598 git init
9699 git config user.name anonymous
@@ -161,13 +164,59 @@ push_directory()
161164 pushd " $DIRECTORY " > /dev/null
162165}
163166
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+ }
164183
165184# Initialize the build environment.
166185# ==============================================================================
167186# Exit this script on the first build error.
168187# ------------------------------------------------------------------------------
169188set -e
170189
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+
171220# Configure build parallelism.
172221# ------------------------------------------------------------------------------
173222SEQUENTIAL=1
@@ -180,6 +229,9 @@ elif [[ ($OS == Darwin) || ($OS == OpenBSD) ]]; then
180229 PARALLEL=` sysctl -n hw.ncpu`
181230else
182231 display_error " Unsupported system: $OS "
232+ display_error " Explicit shell-definition of PARALLEL will avoid system detection."
233+ display_error " "
234+ display_help
183235 exit 1
184236fi
185237
@@ -205,32 +257,6 @@ if [[ ($OS == Linux && $CC == "clang") || ($OS == OpenBSD) ]]; then
205257 export CXXFLAGS=" -stdlib=lib$STDLIB $CXXFLAGS "
206258fi
207259
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-
234260# Normalize of static and shared options.
235261# ------------------------------------------------------------------------------
236262if [[ $DISABLE_SHARED ]]; then
279305
280306display_configuration ()
281307{
282- display_message " Libbitcoin installer configuration."
308+ display_message " libbitcoin-protocol installer configuration."
283309 display_message " --------------------------------------------------------------------"
284310 display_message " OS : $OS "
285311 display_message " PARALLEL : $PARALLEL "
@@ -290,61 +316,17 @@ display_configuration()
290316 display_message " CXXFLAGS : $CXXFLAGS "
291317 display_message " LDFLAGS : $LDFLAGS "
292318 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 "
300319 display_message " BUILD_ZMQ : $BUILD_ZMQ "
301320 display_message " BUILD_BOOST : $BUILD_BOOST "
302- display_message " PREFIX : $PREFIX "
303321 display_message " BUILD_DIR : $BUILD_DIR "
322+ display_message " PREFIX : $PREFIX "
304323 display_message " DISABLE_SHARED : $DISABLE_SHARED "
305324 display_message " DISABLE_STATIC : $DISABLE_STATIC "
306325 display_message " with_boost : ${with_boost} "
307326 display_message " with_pkgconfigdir : ${with_pkgconfigdir} "
308327 display_message " --------------------------------------------------------------------"
309328}
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+
348330
349331# Define build options.
350332# ==============================================================================
@@ -387,7 +369,6 @@ BITCOIN_PROTOCOL_OPTIONS=(
387369
388370# Define build functions.
389371# ==============================================================================
390-
391372# Because PKG_CONFIG_PATH doesn't get updated by Homebrew or MacPorts.
392373initialize_icu_packages ()
393374{
@@ -737,7 +718,7 @@ build_all()
737718# Build the primary library and all dependencies.
738719# ==============================================================================
739720if [[ $DISPLAY_HELP ]]; then
740- display_install_help
721+ display_help
741722else
742723 display_configuration
743724 create_directory " $BUILD_DIR "
0 commit comments