diff --git a/.travis.yml b/.travis.yml index 452c878d..86d0f69a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,4 @@ script: - _mocha -R spec --recursive cache: directories: - - libbitcoind - cache diff --git a/RELEASE.md b/RELEASE.md index ca46c42e..8acb7d23 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,8 +1,3 @@ -Bitcore Node -======= - -A Node.js module that adds a native interface to Bitcoin Core for querying information about the Bitcoin blockchain. Bindings are linked to Bitcore Core compiled as a static library. - ## Release Notes Binaries for the C++ binding file (which includes libbitcoind statically linked in) are distributed with the help of node-pre-gyp. Node-pre-gyp publishes pre-built binaries to S3 for later download and installation. Source files can also be built if binaries are not desired. diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index c39f4079..53c8b380 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -40,19 +40,13 @@ compare_patch () { matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"` } -prepare_for_caching () { - cp -r $("${root_dir}"/bin/variables.sh bitcoind) /tmp/bitcoind.tmp - cp -r $("${root_dir}"/bin/variables.sh libsecp256k1) /tmp/libsecp256k1.tmp - cp -r $("${root_dir}"/bin/variables.sh memenv) /tmp/libmemenv.tmp - cp -r $("${root_dir}"/bin/variables.sh leveldb) /tmp/leveldb.tmp +cache_files () { + cache_file="${root_dir}"/cache/cache.tar pushd "${btc_dir}" - make clean - mkdir -p "${btc_dir}"/src/.libs - mkdir -p "${btc_dir}"/src/secp256k1/.libs - cp -r /tmp/bitcoind.tmp $("${root_dir}"/bin/variables.sh bitcoind) - cp -r /tmp/libsecp256k1.tmp $("${root_dir}"/bin/variables.sh libsecp256k1) - cp -r /tmp/libmemenv.tmp $("${root_dir}"/bin/variables.sh memenv) - cp -r /tmp/leveldb.tmp $("${root_dir}"/bin/variables.sh leveldb) + find . -type f \( -name "*.h" -or -name "*.hpp" -or -name \ +"*.ipp" -or -name "*.a" \) | tar -cf "${cache_file}" -T - + tar xf "${cache_file}" -C "${root_dir}"/cache + rm -fr "${cache_file}" popd } @@ -149,7 +143,7 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): " echo "Creating the sha marker for the patching in libbitcoind..." echo "Writing patch sha file to: \"${patch_sha}\"" echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${patch_sha}" - prepare_for_caching + cache_files echo 'Build finished successfully.' else echo 'Using existing static library.' diff --git a/bin/variables.sh b/bin/variables.sh index 7ff215ce..77202be2 100755 --- a/bin/variables.sh +++ b/bin/variables.sh @@ -3,14 +3,16 @@ exec 2> /dev/null root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." -BITCOIN_DIR="${root_dir}/libbitcoind" +bitcoin_dir="${root_dir}"/libbitcoind +cache_dir="${root_dir}"/cache -host=`uname -m`-`uname -a | awk '{print tolower($1)}'` -depends_dir="${BITCOIN_DIR}"/depends +platform=`uname -a | awk '{print tolower($1)}'` +arch=`uname -m` +host="${arch}"-"${platform}" mac_response= check_mac_build_system () { - if [ "${ext}" == "dylib" ]; then + if [ "${platform}" == "darwin" ]; then if [ ! -d "/usr/include" ]; then if hash xcode-select 2>/dev/null; then mac_response="Please run 'xcode-select --install' from the command line because it seems that you've got Xcode, but not the Xcode command line tools that are required for compiling this project from source..." @@ -21,19 +23,28 @@ check_mac_build_system () { fi } +depends_dir="${bitcoin_dir}"/depends +thread="${cache_dir}"/depends/"${host}"/lib/libboost_thread-mt.a +filesystem="${cache_dir}"/depends/"${host}"/lib/libboost_filesystem-mt.a +chrono="${cache_dir}"/depends/"${host}"/lib/libboost_chrono-mt.a +program_options="${cache_dir}"/depends/"${host}"/lib/libboost_program_options-mt.a +system="${cache_dir}"/depends/"${host}"/lib/libboost_system-mt.a +leveldb="${cache_dir}"/src/leveldb/libleveldb.a +memenv="${cache_dir}"/src/leveldb/libmemenv.a +libsecp256k1="${cache_dir}"/src/secp256k1/.libs/libsecp256k1.a -thread="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_thread-mt.a -filesystem="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_filesystem-mt.a -chrono="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_chrono-mt.a -program_options="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_program_options-mt.a -system="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_system-mt.a -leveldb="${BITCOIN_DIR}"/src/leveldb/libleveldb.a -memenv="${BITCOIN_DIR}"/src/leveldb/libmemenv.a -libsecp256k1="${BITCOIN_DIR}"/src/secp256k1/.libs/libsecp256k1.a +if test x"$1" = x'anl'; then + if [ "${platform}" != "darwin" ]; then + echo -n "-lanl" + fi +fi + +if test x"$1" = x'cache_dir'; then + echo -n "${cache_dir}" +fi if test x"$1" = x'btcdir'; then - echo -n "${BITCOIN_DIR}" - exit 0 + echo -n "${bitcoin_dir}" fi if test -z "$1" -o x"$1" = x'thread'; then @@ -78,7 +89,7 @@ fi if test -z "$1" -o x"$1" = x'bdb'; then if [ "${BITCORENODE_ENV}" == "test" ]; then - echo -n "${BITCOIN_DIR}"/depends/"${host}"/lib/libdb_cxx.a + echo -n "${cache_dir}"/depends/"${host}"/lib/libdb_cxx.a fi fi @@ -90,7 +101,7 @@ if test -z "$1" -o x"$1" = x'load_archive'; then if [ "${os}" == "osx" ]; then echo -n "-Wl,-all_load -Wl,--no-undefined" else - echo -n "-Wl,--whole-archive ${filesystem} ${thread} "${BITCOIN_DIR}"/src/.libs/libbitcoind.a -Wl,--no-whole-archive" + echo -n "-Wl,--whole-archive ${filesystem} ${thread} "${cache_dir}"/src/.libs/libbitcoind.a -Wl,--no-whole-archive" fi fi @@ -100,5 +111,5 @@ if test -z "$1" -o x"$1" = x'mac_dependencies'; then fi if test -z "$1" -o x"$1" = x'bitcoind'; then - echo -n "${BITCOIN_DIR}"/src/.libs/libbitcoind.a + echo -n "${cache_dir}"/src/.libs/libbitcoind.a fi diff --git a/binding.gyp b/binding.gyp index ccd650ca..48deb620 100755 --- a/binding.gyp +++ b/binding.gyp @@ -4,9 +4,9 @@ "target_name": "<(module_name)", "include_dirs" : [ "