From c53b47890b182340fb723a0098600e20b714d686 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 24 Jul 2015 15:31:06 -0400 Subject: [PATCH 01/16] Added support for using internal dependencies (boost). --- .travis.yml | 4 ---- binding.gyp | 5 ++--- example/index.js | 1 - platform/os.sh | 17 +++++++++++++++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index d050d692..05d147ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,6 @@ env: node_js: - "0.12" before_install: - - sudo apt-get install libboost1.48-all-dev - - sudo add-apt-repository -y ppa:bitcoin/bitcoin - - sudo apt-get update - - sudo apt-get install libdb4.8-dev libdb4.8++-dev - git config --global user.email "dev@bitpay.com" - git config --global user.name "BitPay, Inc." script: diff --git a/binding.gyp b/binding.gyp index 8dfff9e8..947966a5 100644 --- a/binding.gyp +++ b/binding.gyp @@ -28,13 +28,12 @@ ], 'link_settings': { 'libraries': [ - '-lboost_filesystem', - '-L/usr/local/lib', + ' Date: Mon, 27 Jul 2015 09:54:39 -0400 Subject: [PATCH 02/16] Added function to build dependencies. --- bin/build-libbitcoind | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 6ba69f21..46575ec5 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -5,6 +5,16 @@ options=`cat ${root_dir}/bin/config_options.sh` os_dir=$(./platform/os.sh osdir) +build_dependencies () { + if [ -d "${btc_dir}" ]; then + pushd "${btc_dir}"/depends + host=`uname -m`-`uname -a | awk '{print tolower($1)}'` + echo "using host for dependencies: ${host}" + make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 #host is arch-os, e.g. x86_64-linux + popd + fi +} + get_patch_file () { if test -e "${root_dir/PATCH_VERSION}"; then tag=`cat "${root_dir}/PATCH_VERSION" | xargs` @@ -87,7 +97,7 @@ if [ "${only_make}" = false ]; then fi fi - +build_dependencies echo './autogen.sh' ./autogen.sh full_options="${options}${os_dir}" From 7efa84fa862849f9f8ac48c1813c61901bd8e93e Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 27 Jul 2015 14:03:14 -0400 Subject: [PATCH 03/16] Generalized the static building of boost. --- bin/build-libbitcoind | 3 +- binding.gyp | 3 +- etc/bitcoin.patch | 120 +++++++++++++++++++++++++++++------------- platform/os.sh | 21 ++++++-- 4 files changed, 102 insertions(+), 45 deletions(-) mode change 100644 => 100755 binding.gyp diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 46575ec5..98f6d3ab 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -4,11 +4,10 @@ cd "${root_dir}" options=`cat ${root_dir}/bin/config_options.sh` os_dir=$(./platform/os.sh osdir) - +host=$(./platform/os.sh host) build_dependencies () { if [ -d "${btc_dir}" ]; then pushd "${btc_dir}"/depends - host=`uname -m`-`uname -a | awk '{print tolower($1)}'` echo "using host for dependencies: ${host}" make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 #host is arch-os, e.g. x86_64-linux popd diff --git a/binding.gyp b/binding.gyp old mode 100644 new mode 100755 index 947966a5..6fd8b87d --- a/binding.gyp +++ b/binding.gyp @@ -33,7 +33,8 @@ '\"$($(package)_cxxflags) $($(package)_cppflags)\" \"$($(package)_ldflags)\" \"$(boost_archiver_$(host_os))\" \"$(host_STRIP)\" \"$(host_RANLIB)\" \"$(host_WINDRES)\" : ;" > user-config.jam + endef + diff --git a/src/Makefile.am b/src/Makefile.am -index 1c2f770..ddcae0f 100644 +old mode 100644 +new mode 100755 +index 1c2f770..427bb14 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -1,6 +1,8 @@ +@@ -1,6 +1,10 @@ DIST_SUBDIRS = secp256k1 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) +lib_LTLIBRARIES = +libbitcoind_la_LIBADD = ++libbitcoind_la_LDFLAGS = ++STATIC_BOOST_LIBS = if EMBEDDED_LEVELDB LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include -@@ -15,6 +17,10 @@ $(LIBLEVELDB) $(LIBMEMENV): +@@ -15,6 +19,7 @@ $(LIBLEVELDB) $(LIBMEMENV): @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \ CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \ OPT="$(CXXFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS" -+ -+LIBLEVELDB_SHARED: -+ @echo "Building the LevelDB shared library..." && $(MAKE) -C ./leveldb + endif BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config -@@ -49,16 +55,16 @@ BITCOIN_INCLUDES += $(BDB_CPPFLAGS) +@@ -49,16 +54,16 @@ BITCOIN_INCLUDES += $(BDB_CPPFLAGS) EXTRA_LIBRARIES += libbitcoin_wallet.a endif @@ -127,7 +177,7 @@ index 1c2f770..ddcae0f 100644 if BUILD_BITCOIND bin_PROGRAMS += bitcoind endif -@@ -66,6 +72,9 @@ endif +@@ -66,6 +71,9 @@ endif if BUILD_BITCOIN_UTILS bin_PROGRAMS += bitcoin-cli bitcoin-tx endif @@ -137,18 +187,20 @@ index 1c2f770..ddcae0f 100644 .PHONY: FORCE # bitcoin core # -@@ -169,8 +178,9 @@ obj/build.h: FORCE +@@ -169,8 +177,11 @@ obj/build.h: FORCE @$(MKDIR_P) $(builddir)/obj @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ $(abs_top_srcdir) -libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h ++ARCH_PLATFORM = $(shell ../../platform/os.sh host) ++ +libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h +clientversion.cpp: obj/build.h # server: shared between bitcoind and bitcoin-qt libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) libbitcoin_server_a_SOURCES = \ -@@ -309,9 +319,18 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h +@@ -309,9 +320,18 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h bitcoind_SOURCES = bitcoind.cpp bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES) bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) @@ -167,7 +219,7 @@ index 1c2f770..ddcae0f 100644 endif bitcoind_LDADD = \ -@@ -326,9 +345,19 @@ bitcoind_LDADD = \ +@@ -326,10 +346,20 @@ bitcoind_LDADD = \ if ENABLE_WALLET bitcoind_LDADD += libbitcoin_wallet.a @@ -175,18 +227,20 @@ index 1c2f770..ddcae0f 100644 +libbitcoind_la_SOURCES += $(libbitcoin_wallet_a_SOURCES) endif -+MEMOBJ = helpers/memenv/memenv.lo -+$(MEMOBJ): -+ @echo "Building the Memenv shared library..." && $(MAKE) -C ./leveldb $@ ++STATIC_BOOST_LIBS += ../depends/$(ARCH_PLATFORM)/lib/libboost_filesystem-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_system-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_chrono-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_thread-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_program_options-mt.a + bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) -+libbitcoind_la_LIBADD += $(BOOST_LIBS) $(SSL_LIBS) $(LIBSECP256K1) $(CRYPTO_LIBS) leveldb/$(MEMOBJ) +-# ++libbitcoind_la_LIBADD += $(SSL_LIBS) $(LIBSECP256K1) $(CRYPTO_LIBS) $(LIBLEVELDB) $(LIBMEMENV) $(STATIC_BOOST_LIBS) +libbitcoind_la_CPPFLAGS = $(BITCOIN_INCLUDES) -+libbitcoind_la_LDFLAGS = -lleveldb -L./leveldb $(RELDFLAGS) -no-undefined -+libbitcoind_la_DEPENDENCIES = $(LIBSECP256K1) LIBLEVELDB_SHARED $(MEMOBJ) - # ++if TARGET_DARWIN ++libbitcoind_la_LDFLAGS += -Wl,-all_load ++else ++libbitcoind_la_LDFLAGS += -Wl,--whole-archive $(BOOST_LIBS) -Wl,--no-whole-archive ++endif # bitcoin-cli binary # + bitcoin_cli_SOURCES = bitcoin-cli.cpp diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index cce687a..0f162ff 100644 --- a/src/bitcoind.cpp @@ -232,28 +286,20 @@ index dcb2b29..5ce68ba 100644 bool ShutdownRequested(); void Shutdown(); diff --git a/src/leveldb/Makefile b/src/leveldb/Makefile -index 2bd2cad..490ba66 100644 +index 2bd2cad..a85d3ca 100644 --- a/src/leveldb/Makefile +++ b/src/leveldb/Makefile -@@ -103,7 +103,7 @@ check: all $(PROGRAMS) $(TESTS) - for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done +@@ -16,10 +16,9 @@ OPT ?= -O2 -DNDEBUG - clean: -- -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk -+ -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.lo helpers/memenv/.deps/*.Plo helpers/memenv/.deps/*.Tpo */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk - -rm -rf ios-x86/* ios-arm/* - - $(LIBRARY): $(LIBOBJECTS) -@@ -192,6 +192,10 @@ $(MEMENVLIBRARY) : $(MEMENVOBJECTS) - rm -f $@ - $(AR) -rs $@ $(MEMENVOBJECTS) - -+helpers/memenv/memenv.lo: helpers/memenv/memenv.cc -+ -mkdir -p helpers/memenv/.deps -+ /bin/bash ../../libtool --tag=CXX --mode=compile $(CXX) $(CXXFLAGS) $(CFLAGS) -fPIC -MT $@ -MD -MP -MF helpers/memenv/.deps/memenv.Tpo -c -o $@ $< -+ - memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) - $(CXX) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LIBS) + # detect what platform we're building on + $(shell CC="$(CC)" CXX="$(CXX)" TARGET_OS="$(TARGET_OS)" \ +- ./build_detect_platform build_config.mk ./) ++ ./build_detect_platform build_config.mk .) + # this file is generated by the previous line to set build flags and sources + include build_config.mk +- + CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) + CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) diff --git a/src/leveldbwrapper.h b/src/leveldbwrapper.h index c65e842..0e44bb5 100644 diff --git a/platform/os.sh b/platform/os.sh index 11a29804..b6e8afbe 100755 --- a/platform/os.sh +++ b/platform/os.sh @@ -7,9 +7,10 @@ BITCOIN_DIR="${root_dir}/libbitcoind" os= ext=so -boost_dir="${root_dir}"/libbitcoind/depends/x86_64-linux/lib -thread="${boost_dir}"/libboost_thread-mt.so -filesystem="${boost_dir}"/libboost_filesystem.so +host=`uname -m`-`uname -a | awk '{print tolower($1)}'` +boost_dir="${root_dir}"/libbitcoind/depends/${host}/lib +thread="${boost_dir}"/libboost_thread-mt.a +filesystem="${boost_dir}"/libboost_filesystem-mt.a if test -f /etc/centos-release \ || grep -q 'CentOS' /etc/redhat-release \ @@ -24,8 +25,6 @@ elif uname -a | grep -q '^Darwin'; then os=osx ext=dylib boost_dir="${root_dir}"/libbitcoind/depends/x86_64-darwin/lib - thread="${boost_dir}"/libboost_thread-mt.dylib - filesystem="${boost_dir}"/libboost_filesystem.dylib elif test -f /etc/SuSE-release; then os=suse elif test -f /etc/mandrake-release \ @@ -87,6 +86,18 @@ if test -z "$1" -o x"$1" = x'boost_dir'; then echo -n "${boost_dir}" fi +if test -z "$1" -o x"$1" = x'host'; then + echo -n "${host}" +fi + +if test -z "$1" -o x"$1" = x'load_archive'; then + if [ "${os}" == "osx" ]; then + echo -n "-Wl,-all_load" + else + echo -n "-Wl,--whole-archive ${filesystem} ${thread} -Wl,--no-whole-archive" + fi +fi + if test -z "$1" -o x"$1" = x'lib'; then if test -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then if test -e "${os_dir}/lib/libbitcoind.${ext}"; then From 248bf1d52cbf4de6acfbd45082e578d1d1dbf1ab Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 27 Jul 2015 17:39:20 -0400 Subject: [PATCH 04/16] Included the wallet option for building while under test env. --- bin/build-libbitcoind | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 98f6d3ab..057e42bc 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -9,7 +9,11 @@ build_dependencies () { if [ -d "${btc_dir}" ]; then pushd "${btc_dir}"/depends echo "using host for dependencies: ${host}" - make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 #host is arch-os, e.g. x86_64-linux + if [ "${test}" = true ]; then + make HOST=${host} NO_QT=1 NO_UPNP=1 + else + make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 + fi popd fi } @@ -40,6 +44,7 @@ fi test= if [ "${BITCOINDJS_ENV}" == "test" ]; then + test=true options=`cat ${root_dir}/bin/config_options_test.sh` fi From 9a18d37011313e0e51d9288abe8988a6db5fe53f Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 27 Jul 2015 18:19:36 -0400 Subject: [PATCH 05/16] Updated the patch to compile the BDB static libs correctly. --- .travis.yml | 2 ++ bin/build-libbitcoind | 1 + etc/bitcoin.patch | 45 +++++++++++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05d147ef..bc5381ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ +sudo: false language: node_js env: - BITCOINDJS_ENV=test +- BITCOINDJS_ASSUME_YES=true node_js: - "0.12" before_install: diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 057e42bc..4795013e 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -104,6 +104,7 @@ fi build_dependencies echo './autogen.sh' ./autogen.sh +export CPPFLAGS="-I${btc_dir}/depends/${host}/include/boost -I${btc_dir}/depends/${host}/include -L${btc_dir}/depends/${host}/lib" full_options="${options}${os_dir}" echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::" ${full_options} diff --git a/etc/bitcoin.patch b/etc/bitcoin.patch index ef26a16c..be835ca3 100644 --- a/etc/bitcoin.patch +++ b/etc/bitcoin.patch @@ -79,10 +79,20 @@ index 37fe47e..83cfe70 100644 LEVELDB_CPPFLAGS= LIBLEVELDB= LIBMEMENV= +diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk +index 68841af..65a105b 100644 +--- a/depends/packages/bdb.mk ++++ b/depends/packages/bdb.mk +@@ -9,6 +9,7 @@ define $(package)_set_vars + $(package)_config_opts=--disable-shared --enable-cxx --disable-replication + $(package)_config_opts_mingw32=--enable-mingw + $(package)_config_opts_linux=--with-pic ++$(package)_cxxflags_darwin=-stdlib=libc++ + endef + + define $(package)_preprocess_cmds diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk -old mode 100644 -new mode 100755 -index e7aa48d..8447e79 +index e7aa48d..df0f7ae 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -1,9 +1,8 @@ @@ -129,23 +139,23 @@ index e7aa48d..8447e79 endef diff --git a/src/Makefile.am b/src/Makefile.am -old mode 100644 -new mode 100755 -index 1c2f770..427bb14 +index 1c2f770..d2eca15 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -1,6 +1,10 @@ +@@ -1,6 +1,12 @@ DIST_SUBDIRS = secp256k1 AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) +lib_LTLIBRARIES = +libbitcoind_la_LIBADD = -+libbitcoind_la_LDFLAGS = ++libbitcoind_la_LDFLAGS = -no-undefined +STATIC_BOOST_LIBS = ++STATIC_BDB_LIBS = ++STATIC_EXTRA_LIBS = $(STATIC_BOOST_LIBS) $(LIBLEVELDB) $(LIBMEMENV) if EMBEDDED_LEVELDB LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include -@@ -15,6 +19,7 @@ $(LIBLEVELDB) $(LIBMEMENV): +@@ -15,6 +21,7 @@ $(LIBLEVELDB) $(LIBMEMENV): @echo "Building LevelDB ..." && $(MAKE) -C $(@D) $(@F) CXX="$(CXX)" \ CC="$(CC)" PLATFORM=$(TARGET_OS) AR="$(AR)" $(LEVELDB_TARGET_FLAGS) \ OPT="$(CXXFLAGS) $(CPPFLAGS) -D__STDC_LIMIT_MACROS" @@ -153,7 +163,7 @@ index 1c2f770..427bb14 endif BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config -@@ -49,16 +54,16 @@ BITCOIN_INCLUDES += $(BDB_CPPFLAGS) +@@ -49,16 +56,16 @@ BITCOIN_INCLUDES += $(BDB_CPPFLAGS) EXTRA_LIBRARIES += libbitcoin_wallet.a endif @@ -177,7 +187,7 @@ index 1c2f770..427bb14 if BUILD_BITCOIND bin_PROGRAMS += bitcoind endif -@@ -66,6 +71,9 @@ endif +@@ -66,6 +73,9 @@ endif if BUILD_BITCOIN_UTILS bin_PROGRAMS += bitcoin-cli bitcoin-tx endif @@ -187,7 +197,7 @@ index 1c2f770..427bb14 .PHONY: FORCE # bitcoin core # -@@ -169,8 +177,11 @@ obj/build.h: FORCE +@@ -169,8 +179,11 @@ obj/build.h: FORCE @$(MKDIR_P) $(builddir)/obj @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ $(abs_top_srcdir) @@ -200,7 +210,7 @@ index 1c2f770..427bb14 # server: shared between bitcoind and bitcoin-qt libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) libbitcoin_server_a_SOURCES = \ -@@ -309,9 +320,18 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h +@@ -309,9 +322,18 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h bitcoind_SOURCES = bitcoind.cpp bitcoind_CPPFLAGS = $(BITCOIN_INCLUDES) bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) @@ -219,24 +229,25 @@ index 1c2f770..427bb14 endif bitcoind_LDADD = \ -@@ -326,10 +346,20 @@ bitcoind_LDADD = \ +@@ -326,10 +348,21 @@ bitcoind_LDADD = \ if ENABLE_WALLET bitcoind_LDADD += libbitcoin_wallet.a -+libbitcoind_la_LIBADD += $(BDB_LIBS) ++STATIC_EXTRA_LIBS += $(STATIC_BDB_LIBS) +libbitcoind_la_SOURCES += $(libbitcoin_wallet_a_SOURCES) endif +STATIC_BOOST_LIBS += ../depends/$(ARCH_PLATFORM)/lib/libboost_filesystem-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_system-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_chrono-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_thread-mt.a ../depends/$(ARCH_PLATFORM)/lib/libboost_program_options-mt.a ++STATIC_BDB_LIBS += ../depends/$(ARCH_PLATFORM)/lib/libdb_cxx.a + bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) -# -+libbitcoind_la_LIBADD += $(SSL_LIBS) $(LIBSECP256K1) $(CRYPTO_LIBS) $(LIBLEVELDB) $(LIBMEMENV) $(STATIC_BOOST_LIBS) ++libbitcoind_la_LIBADD += $(SSL_LIBS) $(LIBSECP256K1) $(CRYPTO_LIBS) $(STATIC_EXTRA_LIBS) +libbitcoind_la_CPPFLAGS = $(BITCOIN_INCLUDES) +if TARGET_DARWIN +libbitcoind_la_LDFLAGS += -Wl,-all_load +else -+libbitcoind_la_LDFLAGS += -Wl,--whole-archive $(BOOST_LIBS) -Wl,--no-whole-archive ++libbitcoind_la_LDFLAGS += -Wl,--whole-archive $(STATIC_EXTRA_LIBS) -Wl,--no-whole-archive +endif # bitcoin-cli binary # From 20bbe650c65e26996ff359ba2d908e4811539702 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Mon, 27 Jul 2015 21:15:51 -0400 Subject: [PATCH 06/16] Removed cruft. --- binding.gyp | 3 +-- platform/os.sh | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/binding.gyp b/binding.gyp index 6fd8b87d..223d1e9c 100755 --- a/binding.gyp +++ b/binding.gyp @@ -3,8 +3,7 @@ 'target_name': 'bitcoindjs', 'include_dirs' : [ ' Date: Tue, 28 Jul 2015 10:51:39 -0400 Subject: [PATCH 07/16] Fixed the dependency on system-installed boost libs. --- bin/build-libbitcoind | 16 ++++++++++------ bin/config_options.sh | 2 +- bin/config_options_debug.sh | 2 +- bin/config_options_test.sh | 2 +- binding.gyp | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 4795013e..14b79850 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -1,10 +1,12 @@ #!/bin/bash root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." -cd "${root_dir}" options=`cat ${root_dir}/bin/config_options.sh` - +depends_dir=$($root_dir/platform/os.sh depends_dir) os_dir=$(./platform/os.sh osdir) host=$(./platform/os.sh host) + +cd "${root_dir}" + build_dependencies () { if [ -d "${btc_dir}" ]; then pushd "${btc_dir}"/depends @@ -35,8 +37,6 @@ compare_patch () { matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"` } #set the LD_LIBRARY_PATH for the linux clients. -export LD_LIBRARY_PATH="${root_dir}/libbitcoind/src/leveldb":"${os_dir}":$LD_LIBRARY_PATH - debug= if [ "${BITCOINDJS_ENV}" == "debug" ]; then options=`cat ${root_dir}/bin/config_options_debug.sh` @@ -104,10 +104,14 @@ fi build_dependencies echo './autogen.sh' ./autogen.sh -export CPPFLAGS="-I${btc_dir}/depends/${host}/include/boost -I${btc_dir}/depends/${host}/include -L${btc_dir}/depends/${host}/lib" -full_options="${options}${os_dir}" + +export CPPFLAGS="-I${depends_dir}/include/boost -I${depends_dir}/include -L${depends_dir}/lib" +boost_libdir="--with-boost-libdir=${depends_dir}/lib" + +full_options="${options} ${boost_libdir} --prefix=${os_dir}" echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::" ${full_options} + echo 'make V=1' make V=1 diff --git a/bin/config_options.sh b/bin/config_options.sh index 248bcb6a..d51d99a0 100644 --- a/bin/config_options.sh +++ b/bin/config_options.sh @@ -1,2 +1,2 @@ -./configure --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --disable-wallet --without-utils --prefix= +./configure --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --disable-wallet --without-utils diff --git a/bin/config_options_debug.sh b/bin/config_options_debug.sh index afacbc9f..fb5845e0 100644 --- a/bin/config_options_debug.sh +++ b/bin/config_options_debug.sh @@ -1,2 +1,2 @@ -./configure --enable-debug --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --disable-wallet --without-utils --prefix= +./configure --enable-debug --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --disable-wallet --without-utils diff --git a/bin/config_options_test.sh b/bin/config_options_test.sh index 225f7aa0..3ee83701 100644 --- a/bin/config_options_test.sh +++ b/bin/config_options_test.sh @@ -1,2 +1,2 @@ -./configure --enable-debug --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --prefix= +./configure --enable-debug --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc diff --git a/binding.gyp b/binding.gyp index 223d1e9c..5230924b 100755 --- a/binding.gyp +++ b/binding.gyp @@ -3,7 +3,7 @@ 'target_name': 'bitcoindjs', 'include_dirs' : [ ' Date: Tue, 28 Jul 2015 15:37:10 -0400 Subject: [PATCH 08/16] Added the cleanup script so that we can keep the cache to a bare minimum. --- .travis.yml | 4 ++++ bin/build-libbitcoind | 52 ++++++++++++++++++++++++++----------------- binding.gyp | 2 +- platform/os.sh | 11 ++++++--- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc5381ed..baa3d418 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,7 @@ before_install: script: - _mocha -R spec integration/regtest.js - _mocha -R spec --recursive +cache: + directories: + - platform/ubuntu + diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 14b79850..1091300f 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -1,20 +1,33 @@ #!/bin/bash root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." options=`cat ${root_dir}/bin/config_options.sh` +h_and_a_dir=$($root_dir/platform/os.sh h_and_a_dir) depends_dir=$($root_dir/platform/os.sh depends_dir) -os_dir=$(./platform/os.sh osdir) -host=$(./platform/os.sh host) +os_dir=$(${root_dir}/platform/os.sh osdir) +host=$(${root_dir}/platform/os.sh host) +btc_dir="${root_dir}/libbitcoind" +echo "Using BTC directory: ${btc_dir}" cd "${root_dir}" build_dependencies () { if [ -d "${btc_dir}" ]; then - pushd "${btc_dir}"/depends + pushd "${depends_dir}" echo "using host for dependencies: ${host}" - if [ "${test}" = true ]; then - make HOST=${host} NO_QT=1 NO_UPNP=1 + boost_files_count=`find "${h_and_a_dir}"/lib -iname "libboost_*-mt.a" | wc -l | xargs` + db_files_count=`find "${h_and_a_dir}"/lib -iname "libdb*.a" | wc -l | xargs` + should_rebuild=false + if [[ "${boost_files_count}" -lt 5 || ( "${db_files_count}" -lt 1 && "${test}" = true ) ]]; then + should_rebuild=true + fi + if [ "${should_rebuild}" = true ]; then + if [ "${test}" = true ]; then + make HOST=${host} NO_QT=1 NO_UPNP=1 + else + make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 + fi else - make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1 + echo "Looks like libs are already built, so we won't rebuild them. Incidentally, we found: ${boost_files_count} boost libraries and: ${db_files_count} Berkeley DB libraries and you have test mode set to: ${test}" fi popd fi @@ -30,30 +43,26 @@ get_patch_file () { } compare_patch () { - cd "${root_dir}/libbitcoind" + cd "${btc_dir}" get_patch_file echo "running the diff command from HEAD to ${tag}" git diff ${tag}..HEAD > /tmp/tmp.patch #uncommitted changes won't affect things here matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"` } -#set the LD_LIBRARY_PATH for the linux clients. + debug= if [ "${BITCOINDJS_ENV}" == "debug" ]; then options=`cat ${root_dir}/bin/config_options_debug.sh` fi -test= +test=false if [ "${BITCOINDJS_ENV}" == "test" ]; then test=true options=`cat ${root_dir}/bin/config_options_test.sh` fi -btc_dir="${root_dir}/libbitcoind" -echo "Using BTC directory: ${btc_dir}" - -rm -f "${os_dir}/libbitcoind.*" only_make=false -if [ -d "${root_dir}/libbitcoind" ]; then +if [ -d "${btc_dir}" ]; then echo "running compare patch..." compare_patch repatch=false @@ -70,8 +79,9 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " fi if [[ "${input}" =~ ^y|^Y ]]; then repatch=true - echo "Removing directory: \"${root_dir}/libbitcoind\" and starting over!" - rm -fr "${root_dir}"/libbitcoind + rm -f "${os_dir}/libbitcoind.*" + echo "Removing directory: \"${btc_dir}\" and starting over!" + rm -fr "${btc_dir}" fi fi if [ "${repatch}" = false ]; then @@ -105,8 +115,8 @@ build_dependencies echo './autogen.sh' ./autogen.sh -export CPPFLAGS="-I${depends_dir}/include/boost -I${depends_dir}/include -L${depends_dir}/lib" -boost_libdir="--with-boost-libdir=${depends_dir}/lib" +export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -L${h_and_a_dir}/lib" +boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib" full_options="${options} ${boost_libdir} --prefix=${os_dir}" echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::" @@ -117,17 +127,17 @@ make V=1 ext=$($root_dir/platform/os.sh ext) echo 'Copying libbitcoind.{so|dylib} to its appropriate location.' -if test -e "${root_dir}/libbitcoind/src/.libs/libbitcoind.${ext}"; then +if test -e "${btc_dir}/src/.libs/libbitcoind.${ext}"; then if [ "$ext" = "dylib" ]; then if [ ! -d "${os_dir}/lib" ]; then mkdir -p "${os_dir}/lib" fi - cp -R "${root_dir}"/libbitcoind/src/.libs/libbitcoind.*dylib "${os_dir}/lib/" + cp -R "${btc_dir}"/src/.libs/libbitcoind.*dylib "${os_dir}/lib/" else if [ ! -d "${os_dir}" ]; then mkdir -p "${os_dir}" fi - cp -P "${root_dir}"/libbitcoind/src/.libs/libbitcoind.so* "${os_dir}/" + cp -P "${btc_dir}"/src/.libs/libbitcoind.so* "${os_dir}/" fi fi diff --git a/binding.gyp b/binding.gyp index 5230924b..e14e98b9 100755 --- a/binding.gyp +++ b/binding.gyp @@ -3,7 +3,7 @@ 'target_name': 'bitcoindjs', 'include_dirs' : [ ' Date: Tue, 28 Jul 2015 16:32:53 -0400 Subject: [PATCH 09/16] Fixed env variables. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index baa3d418..45957147 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ sudo: false language: node_js env: -- BITCOINDJS_ENV=test -- BITCOINDJS_ASSUME_YES=true +- BITCOINDJS_ENV=test BITCOINDJS_ASSUME_YES=true node_js: - "0.12" before_install: From b798ea918db15dfd2f2b0cbe80c8c8987db61a94 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Tue, 28 Jul 2015 18:13:14 -0400 Subject: [PATCH 10/16] Skipped building if the patch's sha matches the previously written patch's sha. --- bin/build-libbitcoind | 157 +++++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 70 deletions(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 1091300f..beb45d08 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -6,6 +6,7 @@ depends_dir=$($root_dir/platform/os.sh depends_dir) os_dir=$(${root_dir}/platform/os.sh osdir) host=$(${root_dir}/platform/os.sh host) btc_dir="${root_dir}/libbitcoind" +ext=$($root_dir/platform/os.sh ext) echo "Using BTC directory: ${btc_dir}" cd "${root_dir}" @@ -61,84 +62,100 @@ if [ "${BITCOINDJS_ENV}" == "test" ]; then options=`cat ${root_dir}/bin/config_options_test.sh` fi -only_make=false -if [ -d "${btc_dir}" ]; then - echo "running compare patch..." - compare_patch - repatch=false - if [[ "${matching_patch}" =~ [^\s\\] ]]; then - echo "Warning! libbitcoind is not patched with:\ - ${root_dir}/etc/bitcoin.patch." - echo -n "Would you like to remove the current patch, checkout the tag: ${tag} and \ +patch_file_sha=$(shasum -a 256 "${root_dir}/etc/bitcoin.patch" | awk '{print $1}') +if [ "${ext}" == "dylib" ]; then + last_patch_file_sha=$(cat "${os_dir}"/lib/patch_sha.txt) +else + last_patch_file_sha=$(cat "${os_dir}"/patch_sha.txt) +fi +shared_file_built=false +if [ "${last_patch_file_sha}" == "${patch_file_sha}" ]; then + shared_file_built=true +fi + +if [ "${shared_file_built}" = false ]; then + only_make=false + if [ -d "${btc_dir}" ]; then + echo "running compare patch..." + compare_patch + repatch=false + if [[ "${matching_patch}" =~ [^\s\\] ]]; then + echo "Warning! libbitcoind is not patched with:\ + ${root_dir}/etc/bitcoin.patch." + echo -n "Would you like to remove the current patch, checkout the tag: ${tag} and \ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " - if [ "${BITCOINDJS_ASSUME_YES}" = true ]; then - input=y - echo "" - else - read input + if [ "${BITCOINDJS_ASSUME_YES}" = true ]; then + input=y + echo "" + else + read input + fi + if [[ "${input}" =~ ^y|^Y ]]; then + repatch=true + rm -f "${os_dir}/libbitcoind.*" + echo "Removing directory: \"${btc_dir}\" and starting over!" + rm -fr "${btc_dir}" + fi fi - if [[ "${input}" =~ ^y|^Y ]]; then - repatch=true - rm -f "${os_dir}/libbitcoind.*" - echo "Removing directory: \"${btc_dir}\" and starting over!" - rm -fr "${btc_dir}" + if [ "${repatch}" = false ]; then + echo "Running make inside libbitcoind (assuming you've previously patched and configured libbitcoind)..." + cd "${btc_dir}" + only_make=true fi fi - if [ "${repatch}" = false ]; then - echo "Running make inside libbitcoind (assuming you've previously patched and configured libbitcoind)..." + + set -e + + if [ "${only_make}" = false ]; then + echo "Cloning, patching, and building libbitcoind..." + get_patch_file + echo "attempting to checkout tag: ${tag} of bitcoin from github..." + cd "${root_dir}" + git clone --depth 1 --branch "${tag}" https://github.com/bitcoin/bitcoin.git libbitcoind + cd "${btc_dir}" - only_make=true - fi -fi -set -e + echo '../patch-bitcoin.sh' "${btc_dir}" + ../bin/patch-bitcoin "${btc_dir}" -if [ "${only_make}" = false ]; then - echo "Removing cloning, patching, and building libbitcoind..." - get_patch_file - echo "attempting to checkout tag: ${tag} of bitcoin from github..." - cd "${root_dir}" - git clone --depth 1 --branch "${tag}" https://github.com/bitcoin/bitcoin.git libbitcoind - - cd "${btc_dir}" - - echo '../patch-bitcoin.sh' "${btc_dir}" - ../bin/patch-bitcoin "${btc_dir}" - - if ! test -d .git; then - echo 'Please point this script to an upstream bitcoin git repo.' - exit 1 - fi - -fi -build_dependencies -echo './autogen.sh' -./autogen.sh - -export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -L${h_and_a_dir}/lib" -boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib" - -full_options="${options} ${boost_libdir} --prefix=${os_dir}" -echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::" -${full_options} - -echo 'make V=1' -make V=1 - -ext=$($root_dir/platform/os.sh ext) -echo 'Copying libbitcoind.{so|dylib} to its appropriate location.' -if test -e "${btc_dir}/src/.libs/libbitcoind.${ext}"; then - if [ "$ext" = "dylib" ]; then - if [ ! -d "${os_dir}/lib" ]; then - mkdir -p "${os_dir}/lib" - fi - cp -R "${btc_dir}"/src/.libs/libbitcoind.*dylib "${os_dir}/lib/" - else - if [ ! -d "${os_dir}" ]; then - mkdir -p "${os_dir}" + if ! test -d .git; then + echo 'Please point this script to an upstream bitcoin git repo.' + exit 1 fi - cp -P "${btc_dir}"/src/.libs/libbitcoind.so* "${os_dir}/" + fi + build_dependencies + echo './autogen.sh' + ./autogen.sh + + export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -L${h_and_a_dir}/lib" + boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib" + + full_options="${options} ${boost_libdir} --prefix=${os_dir}" + echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::" + ${full_options} + + echo 'make V=1' + make V=1 + + echo 'Copying libbitcoind.{so|dylib} to its appropriate location.' + if test -e "${btc_dir}/src/.libs/libbitcoind.${ext}"; then + if [ "$ext" = "dylib" ]; then + if [ ! -d "${os_dir}/lib" ]; then + mkdir -p "${os_dir}/lib" + fi + cp -R "${btc_dir}"/src/.libs/libbitcoind.*dylib "${os_dir}/lib/" + else + if [ ! -d "${os_dir}" ]; then + mkdir -p "${os_dir}" + fi + cp -P "${btc_dir}"/src/.libs/libbitcoind.so* "${os_dir}/" + fi + echo "Creating the sha marker for the patching in libbitcoind..." + echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${os_dir}"/patch_sha.txt + fi + echo 'Build finished successfully.' +else + echo 'Using existing shared library.' fi -echo 'Build finished successfully.' From a7506471d51a6b05a21801e5e230ee375ab78d55 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 29 Jul 2015 12:05:01 -0400 Subject: [PATCH 11/16] Copied headers. --- bin/build-libbitcoind | 18 ++++++++++++++---- binding.gyp | 6 +++--- platform/os.sh | 8 ++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index beb45d08..afbd35f7 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -7,10 +7,20 @@ os_dir=$(${root_dir}/platform/os.sh osdir) host=$(${root_dir}/platform/os.sh host) btc_dir="${root_dir}/libbitcoind" ext=$($root_dir/platform/os.sh ext) +artifacts_dir=$($root_dir/platform/os.sh artifacts_dir) echo "Using BTC directory: ${btc_dir}" cd "${root_dir}" +copy_header_files () { + if [[ -d "${artifacts_dir}" && -d "${h_and_a_dir}" && -d "${btc_dir}" ]]; then + mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1 + pushd "${root_dir}" + find libbitcoind -name \*.h -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include + popd + fi +} + build_dependencies () { if [ -d "${btc_dir}" ]; then pushd "${depends_dir}" @@ -69,7 +79,7 @@ else last_patch_file_sha=$(cat "${os_dir}"/patch_sha.txt) fi shared_file_built=false -if [ "${last_patch_file_sha}" == "${patch_file_sha}" ]; then +if [[ "${last_patch_file_sha}" == "${patch_file_sha}" && -d "${artifacts_dir}/include" ]]; then shared_file_built=true fi @@ -104,8 +114,6 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " fi fi - set -e - if [ "${only_make}" = false ]; then echo "Cloning, patching, and building libbitcoind..." get_patch_file @@ -152,7 +160,9 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " cp -P "${btc_dir}"/src/.libs/libbitcoind.so* "${os_dir}/" fi echo "Creating the sha marker for the patching in libbitcoind..." - echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${os_dir}"/patch_sha.txt + echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${artifacts_dir}"/patch_sha.txt + echo "Copying the header files in order to be cached..." + copy_header_files fi echo 'Build finished successfully.' else diff --git a/binding.gyp b/binding.gyp index e14e98b9..61a90f6b 100755 --- a/binding.gyp +++ b/binding.gyp @@ -3,9 +3,9 @@ 'target_name': 'bitcoindjs', 'include_dirs' : [ ' Date: Wed, 29 Jul 2015 13:17:31 -0400 Subject: [PATCH 12/16] Fixed copy of headers to include .hpp files. --- .travis.yml | 3 --- bin/build-libbitcoind | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45957147..57c2e3e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,4 @@ before_install: script: - _mocha -R spec integration/regtest.js - _mocha -R spec --recursive -cache: - directories: - - platform/ubuntu diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index afbd35f7..0e06ad69 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -16,7 +16,7 @@ copy_header_files () { if [[ -d "${artifacts_dir}" && -d "${h_and_a_dir}" && -d "${btc_dir}" ]]; then mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1 pushd "${root_dir}" - find libbitcoind -name \*.h -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include + find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include popd fi } From 86dbc89ff332cbda8bc3cc2b6a05ccc31056aa16 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 29 Jul 2015 14:17:36 -0400 Subject: [PATCH 13/16] included ipp files in cache --- bin/build-libbitcoind | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 0e06ad69..1ec696a4 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -16,7 +16,7 @@ copy_header_files () { if [[ -d "${artifacts_dir}" && -d "${h_and_a_dir}" && -d "${btc_dir}" ]]; then mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1 pushd "${root_dir}" - find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include + find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include popd fi } From ead129411164c6727363c4a17944f1f1fd584273 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 29 Jul 2015 15:26:34 -0400 Subject: [PATCH 14/16] Added prebuilt libs to the cache directory so that the bindings can get to them. --- bin/build-libbitcoind | 5 +++++ binding.gyp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 1ec696a4..ac4ffe71 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -17,6 +17,8 @@ copy_header_files () { mkdir -p "${artifacts_dir}/include" > /dev/null 2>&1 pushd "${root_dir}" find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include + mkdir -p "${artifacts_dir}/lib" > /dev/null 2>&1 + cp -r "${h_and_a_dir}"/lib/libboost_filesystem-mt.a "${h_and_a_dir}"/lib/libboost_thread-mt.a "${artifacts_dir}"/lib/ popd fi } @@ -163,6 +165,9 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${artifacts_dir}"/patch_sha.txt echo "Copying the header files in order to be cached..." copy_header_files + else + echo "Could not find the shared libraries after they should have been built, please run make clean inside the libbitcoind dir and run npm install again." + exit 1 fi echo 'Build finished successfully.' else diff --git a/binding.gyp b/binding.gyp index 61a90f6b..2fd9e15f 100755 --- a/binding.gyp +++ b/binding.gyp @@ -5,7 +5,7 @@ ' Date: Wed, 29 Jul 2015 15:29:04 -0400 Subject: [PATCH 15/16] Added the cache back in. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 57c2e3e3..45957147 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,7 @@ before_install: script: - _mocha -R spec integration/regtest.js - _mocha -R spec --recursive +cache: + directories: + - platform/ubuntu From bfc7ab835929790b03f4f924a40d1eb0ed173190 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 29 Jul 2015 17:06:40 -0400 Subject: [PATCH 16/16] Fixed whole-archive builds for the bindings binary. --- binding.gyp | 4 ++-- platform/os.sh | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/binding.gyp b/binding.gyp index 2fd9e15f..08a19576 100755 --- a/binding.gyp +++ b/binding.gyp @@ -27,8 +27,8 @@ ], 'link_settings': { 'libraries': [ - '& 2 @@ -103,11 +110,7 @@ if test -z "$1" -o x"$1" = x'load_archive'; then fi if test -z "$1" -o x"$1" = x'artifacts_dir'; then - if [ "${os}" == "osx" ]; then - echo -n "${os_dir}/lib" - else - echo -n "${os_dir}" - fi + echo -n "${artifacts_dir}" fi if test -z "$1" -o x"$1" = x'lib'; then