1313# --prefix=<absolute-path> Library install location (defaults to /usr/local).
1414# --disable-shared Disables shared library builds.
1515# --disable-static Disables static library builds.
16+ # --help Display usage, overriding script execution.
1617#
1718# Verified on Ubuntu 14.04, requires gcc-4.8 or newer.
1819# Verified on OSX 10.10, using MacPorts and Homebrew repositories, requires
@@ -38,6 +39,14 @@ BOOST_ARCHIVE="boost_1_57_0.tar.bz2"
3839
3940# Define utility functions.
4041# ==============================================================================
42+ configure_links ()
43+ {
44+ # Configure dynamic linker run-time bindings when installing to system.
45+ if [[ ($OS == Linux) && ($PREFIX == " /usr/local" ) ]]; then
46+ ldconfig
47+ fi
48+ }
49+
4150configure_options ()
4251{
4352 display_message " configure options:"
@@ -50,14 +59,6 @@ configure_options()
5059 ./configure " $@ "
5160}
5261
53- configure_links ()
54- {
55- # Configure dynamic linker run-time bindings when installing to system.
56- if [[ ($OS == Linux) && ($PREFIX == " /usr/local" ) ]]; then
57- ldconfig
58- fi
59- }
60-
6162create_directory ()
6263{
6364 local DIRECTORY=" $1 "
@@ -85,6 +86,8 @@ display_error()
8586
8687initialize_git ()
8788{
89+ display_heading_message " Initialize git"
90+
8891 # Initialize git repository at the root of the current directory.
8992 git init
9093 git config user.name anonymous
@@ -155,13 +158,58 @@ push_directory()
155158 pushd " $DIRECTORY " > /dev/null
156159}
157160
161+ display_help ()
162+ {
163+ display_message " Usage: ./install.sh [OPTION]..."
164+ display_message " Manage the installation of libbitcoin-node."
165+ display_message " Script options:"
166+ display_message " --build-boost Builds Boost libraries."
167+ display_message " --build-dir=<path> Location of downloaded and intermediate files."
168+ display_message " --prefix=<absolute-path> Library install location (defaults to /usr/local)."
169+ display_message " --disable-shared Disables shared library builds."
170+ display_message " --disable-static Disables static library builds."
171+ display_message " --help Display usage, overriding script execution."
172+ display_message " "
173+ display_message " All unrecognized options provided shall be passed as configuration options for "
174+ display_message " all dependencies."
175+ }
158176
159177# Initialize the build environment.
160178# ==============================================================================
161179# Exit this script on the first build error.
162180# ------------------------------------------------------------------------------
163181set -e
164182
183+ # Parse command line options that are handled by this script.
184+ # ------------------------------------------------------------------------------
185+ for OPTION in " $@ " ; do
186+ case $OPTION in
187+ # Standard script options.
188+ (--help) DISPLAY_HELP=" yes" ;;
189+
190+ # Standard build options.
191+ (--prefix=* ) PREFIX=" ${OPTION#* =} " ;;
192+ (--disable-shared) DISABLE_SHARED=" yes" ;;
193+ (--disable-static) DISABLE_STATIC=" yes" ;;
194+
195+ # Common project options.
196+ (--with-icu) WITH_ICU=" yes" ;;
197+ (--with-png) WITH_PNG=" yes" ;;
198+ (--with-qrencode) WITH_QRENCODE=" yes" ;;
199+
200+ # Custom build options (in the form of --build-<option>).
201+ (--build-icu) BUILD_ICU=" yes" ;;
202+ (--build-zlib) BUILD_ZLIB=" yes" ;;
203+ (--build-png) BUILD_PNG=" yes" ;;
204+ (--build-qrencode) BUILD_QRENCODE=" yes" ;;
205+ (--build-zmq) BUILD_ZMQ=" yes" ;;
206+ (--build-boost) BUILD_BOOST=" yes" ;;
207+
208+ # Unique script options.
209+ (--build-dir=* ) BUILD_DIR=" ${OPTION#* =} " ;;
210+ esac
211+ done
212+
165213# Configure build parallelism.
166214# ------------------------------------------------------------------------------
167215SEQUENTIAL=1
@@ -174,6 +222,9 @@ elif [[ ($OS == Darwin) || ($OS == OpenBSD) ]]; then
174222 PARALLEL=` sysctl -n hw.ncpu`
175223else
176224 display_error " Unsupported system: $OS "
225+ display_error " Explicit shell-definition of PARALLEL will avoid system detection."
226+ display_error " "
227+ display_help
177228 exit 1
178229fi
179230
@@ -199,32 +250,6 @@ if [[ ($OS == Linux && $CC == "clang") || ($OS == OpenBSD) ]]; then
199250 export CXXFLAGS=" -stdlib=lib$STDLIB $CXXFLAGS "
200251fi
201252
202- # Parse command line options that are handled by this script.
203- # ------------------------------------------------------------------------------
204- for OPTION in " $@ " ; do
205- case $OPTION in
206- # Custom build options (in the form of --build-<option>).
207- (--build-icu) BUILD_ICU=" yes" ;;
208- (--build-zlib) BUILD_ZLIB=" yes" ;;
209- (--build-png) BUILD_PNG=" yes" ;;
210- (--build-qrencode) BUILD_QRENCODE=" yes" ;;
211- (--build-zmq) BUILD_ZMQ=" yes" ;;
212- (--build-boost) BUILD_BOOST=" yes" ;;
213- (--build-dir=* ) BUILD_DIR=" ${OPTION#* =} " ;;
214-
215- # Standard build options.
216- (--prefix=* ) PREFIX=" ${OPTION#* =} " ;;
217- (--disable-shared) DISABLE_SHARED=" yes" ;;
218- (--disable-static) DISABLE_STATIC=" yes" ;;
219- (--with-icu) WITH_ICU=" yes" ;;
220- (--with-png) WITH_PNG=" yes" ;;
221- (--with-qrencode) WITH_QRENCODE=" yes" ;;
222-
223- # Standard script options.
224- (--help) DISPLAY_HELP=" yes" ;;
225- esac
226- done
227-
228253# Normalize of static and shared options.
229254# ------------------------------------------------------------------------------
230255if [[ $DISABLE_SHARED ]]; then
273298
274299display_configuration ()
275300{
276- display_message " Libbitcoin installer configuration."
301+ display_message " libbitcoin-node installer configuration."
277302 display_message " --------------------------------------------------------------------"
278303 display_message " OS : $OS "
279304 display_message " PARALLEL : $PARALLEL "
@@ -284,60 +309,16 @@ display_configuration()
284309 display_message " CXXFLAGS : $CXXFLAGS "
285310 display_message " LDFLAGS : $LDFLAGS "
286311 display_message " LDLIBS : $LDLIBS "
287- display_message " WITH_ICU : $WITH_ICU "
288- display_message " WITH_PNG : $WITH_PNG "
289- display_message " WITH_QRENCODE : $WITH_QRENCODE "
290- display_message " BUILD_ICU : $BUILD_ICU "
291- display_message " BUILD_ZLIB : $BUILD_ZLIB "
292- display_message " BUILD_PNG : $BUILD_PNG "
293- display_message " BUILD_QRENCODE : $BUILD_QRENCODE "
294- display_message " BUILD_ZMQ : $BUILD_ZMQ "
295312 display_message " BUILD_BOOST : $BUILD_BOOST "
296- display_message " PREFIX : $PREFIX "
297313 display_message " BUILD_DIR : $BUILD_DIR "
314+ display_message " PREFIX : $PREFIX "
298315 display_message " DISABLE_SHARED : $DISABLE_SHARED "
299316 display_message " DISABLE_STATIC : $DISABLE_STATIC "
300317 display_message " with_boost : ${with_boost} "
301318 display_message " with_pkgconfigdir : ${with_pkgconfigdir} "
302319 display_message " --------------------------------------------------------------------"
303320}
304- display_install_help ()
305- {
306- display_message " Usage: ./install.sh [OPTION]..."
307- display_message " Manage the installation of libbitcoin-node."
308- display_message " Script options:"
309- display_message " --with-icu Compile with International Components for Unicode."
310- display_message " Since the addition of BIP-39 and later BIP-38 "
311- display_message " support, libbitcoin conditionally incorporates ICU "
312- display_message " to provide BIP-38 and BIP-39 passphrase "
313- display_message " normalization features. Currently "
314- display_message " libbitcoin-explorer is the only other library that "
315- display_message " accesses this feature, so if you do not intend to "
316- display_message " use passphrase normalization this dependency can "
317- display_message " be avoided."
318- display_message " --with-qrencode Compile with QR Code Support"
319- display_message " Since the addition of qrcode support, libbitcoin "
320- display_message " conditionally incorporates qrencode. Currently "
321- display_message " libbitcoin-explorer is the only other library that "
322- display_message " accesses this feature, so if you do not intend to "
323- display_message " use qrcode this dependency can be avoided."
324- display_message " --with-png Compile with QR Code PNG Output Support"
325- display_message " Since the addition of png support, libbitcoin "
326- display_message " conditionally incorporates libpng (which in turn "
327- display_message " requires zlib). Currently libbitcoin-explorer is "
328- display_message " the only other library that accesses this feature, "
329- display_message " so if you do not intend to use png this dependency "
330- display_message " can be avoided."
331- display_message " --build-boost Builds Boost libraries."
332- display_message " --build-dir=<path> Location of downloaded and intermediate files."
333- display_message " --prefix=<absolute-path> Library install location (defaults to /usr/local)."
334- display_message " --disable-shared Disables shared library builds."
335- display_message " --disable-static Disables static library builds."
336- display_message " --help Display usage, overriding script execution."
337- display_message " "
338- display_message " All unrecognized options provided shall be passed as configuration options for "
339- display_message " all dependencies."
340- }
321+
341322
342323# Define build options.
343324# ==============================================================================
@@ -410,7 +391,6 @@ BITCOIN_NODE_OPTIONS=(
410391
411392# Define build functions.
412393# ==============================================================================
413-
414394# Because PKG_CONFIG_PATH doesn't get updated by Homebrew or MacPorts.
415395initialize_icu_packages ()
416396{
@@ -763,7 +743,7 @@ build_all()
763743# Build the primary library and all dependencies.
764744# ==============================================================================
765745if [[ $DISPLAY_HELP ]]; then
766- display_install_help
746+ display_help
767747else
768748 display_configuration
769749 create_directory " $BUILD_DIR "
0 commit comments