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
cache:
directories:
- libbitcoind
- 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
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"`
}
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.'

View File

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

View File

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

2
cache/.gitignore vendored
View File

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