Cache strategy changes

- Fixed wording in README
- changed caching directory again
- realigning include and lib directories
This commit is contained in:
Chris Kleeschulte 2015-08-05 16:26:55 -04:00
parent a62410da67
commit d6d87e7964
6 changed files with 41 additions and 39 deletions

View File

@ -12,5 +12,4 @@ script:
- _mocha -R spec --recursive - _mocha -R spec --recursive
cache: cache:
directories: directories:
- libbitcoind
- cache - cache

View File

@ -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 ## 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. 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.

View File

@ -40,19 +40,13 @@ compare_patch () {
matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"` matching_patch=`diff -w /tmp/tmp.patch "${root_dir}/etc/bitcoin.patch"`
} }
prepare_for_caching () { cache_files () {
cp -r $("${root_dir}"/bin/variables.sh bitcoind) /tmp/bitcoind.tmp cache_file="${root_dir}"/cache/cache.tar
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
pushd "${btc_dir}" pushd "${btc_dir}"
make clean find . -type f \( -name "*.h" -or -name "*.hpp" -or -name \
mkdir -p "${btc_dir}"/src/.libs "*.ipp" -or -name "*.a" \) | tar -cf "${cache_file}" -T -
mkdir -p "${btc_dir}"/src/secp256k1/.libs tar xf "${cache_file}" -C "${root_dir}"/cache
cp -r /tmp/bitcoind.tmp $("${root_dir}"/bin/variables.sh bitcoind) rm -fr "${cache_file}"
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)
popd 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 "Creating the sha marker for the patching in libbitcoind..."
echo "Writing patch sha file to: \"${patch_sha}\"" echo "Writing patch sha file to: \"${patch_sha}\""
echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${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.' echo 'Build finished successfully.'
else else
echo 'Using existing static library.' echo 'Using existing static library.'

View File

@ -3,14 +3,16 @@
exec 2> /dev/null exec 2> /dev/null
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." 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)}'` platform=`uname -a | awk '{print tolower($1)}'`
depends_dir="${BITCOIN_DIR}"/depends arch=`uname -m`
host="${arch}"-"${platform}"
mac_response= mac_response=
check_mac_build_system () { check_mac_build_system () {
if [ "${ext}" == "dylib" ]; then if [ "${platform}" == "darwin" ]; then
if [ ! -d "/usr/include" ]; then if [ ! -d "/usr/include" ]; then
if hash xcode-select 2>/dev/null; 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..." 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 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 if test x"$1" = x'anl'; then
filesystem="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_filesystem-mt.a if [ "${platform}" != "darwin" ]; then
chrono="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_chrono-mt.a echo -n "-lanl"
program_options="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_program_options-mt.a fi
system="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_system-mt.a fi
leveldb="${BITCOIN_DIR}"/src/leveldb/libleveldb.a
memenv="${BITCOIN_DIR}"/src/leveldb/libmemenv.a if test x"$1" = x'cache_dir'; then
libsecp256k1="${BITCOIN_DIR}"/src/secp256k1/.libs/libsecp256k1.a echo -n "${cache_dir}"
fi
if test x"$1" = x'btcdir'; then if test x"$1" = x'btcdir'; then
echo -n "${BITCOIN_DIR}" echo -n "${bitcoin_dir}"
exit 0
fi fi
if test -z "$1" -o x"$1" = x'thread'; then 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 test -z "$1" -o x"$1" = x'bdb'; then
if [ "${BITCORENODE_ENV}" == "test" ]; 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
fi fi
@ -90,7 +101,7 @@ if test -z "$1" -o x"$1" = x'load_archive'; then
if [ "${os}" == "osx" ]; then if [ "${os}" == "osx" ]; then
echo -n "-Wl,-all_load -Wl,--no-undefined" echo -n "-Wl,-all_load -Wl,--no-undefined"
else 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
fi fi
@ -100,5 +111,5 @@ if test -z "$1" -o x"$1" = x'mac_dependencies'; then
fi fi
if test -z "$1" -o x"$1" = x'bitcoind'; then 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 fi

View File

@ -4,9 +4,9 @@
"target_name": "<(module_name)", "target_name": "<(module_name)",
"include_dirs" : [ "include_dirs" : [
"<!(node -e \"require('nan')\")", "<!(node -e \"require('nan')\")",
"<!(./bin/variables.sh btcdir)/src", "<!(./bin/variables.sh cache_dir)/src",
"<!(./bin/variables.sh btcdir)/depends/<!(./bin/variables.sh host)/include", "<!(./bin/variables.sh cache_dir)/depends/<!(./bin/variables.sh host)/include",
"<!(./bin/variables.sh btcdir)/src/leveldb/include" "<!(./bin/variables.sh cache_dir)/src/leveldb/include"
], ],
"sources": [ "sources": [
"./src/libbitcoind.cc", "./src/libbitcoind.cc",
@ -40,6 +40,7 @@
"<!(./bin/variables.sh leveldb)", "<!(./bin/variables.sh leveldb)",
"<!(./bin/variables.sh memenv)", "<!(./bin/variables.sh memenv)",
"<!(./bin/variables.sh bdb)", "<!(./bin/variables.sh bdb)",
"<!(./bin/variables.sh anl)",
"-lssl", "-lssl",
"-lcrypto" "-lcrypto"
], ],

2
cache/.gitignore vendored
View File

@ -1 +1,3 @@
patch_sha.txt patch_sha.txt
src/*
depends/*