Clean up
- Removed the platform directory - renamed the platform/os.sh script to varaibles.sh - realigned the calls to os.sh - changed where the patch_ha.txt was being written to - changed the name of the binary to bitcoind.node
This commit is contained in:
parent
761243c724
commit
da71c0ff2c
|
@ -28,4 +28,4 @@ libbitcoind
|
|||
**/*.creator
|
||||
libbitcoind.includes
|
||||
*.log
|
||||
platform/*
|
||||
cache/patch_sha.txt
|
||||
|
|
|
@ -13,3 +13,4 @@ script:
|
|||
cache:
|
||||
directories:
|
||||
- build
|
||||
- cache
|
||||
|
|
|
@ -7,8 +7,14 @@ cd "${root_dir}"
|
|||
debug=
|
||||
if test x"$1" = x'debug'; then
|
||||
debug=--debug
|
||||
cached_file="${root_dir}"/build/Debug/bitcoind.node
|
||||
else
|
||||
cached_file="${root_dir}"/build/Release/bitcoind.node
|
||||
fi
|
||||
|
||||
node-pre-gyp ${debug} rebuild --fallback-to-build
|
||||
|
||||
if [ ! -f "${cached_file}" ]; then
|
||||
node-pre-gyp ${debug} rebuild --fallback-to-build
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#!/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=$(${root_dir}/platform/os.sh osdir)
|
||||
host=$(${root_dir}/platform/os.sh host)
|
||||
depends_dir=$($root_dir/variables.sh depends_dir)
|
||||
host=$(${root_dir}/variables.sh host)
|
||||
btc_dir="${root_dir}/libbitcoind"
|
||||
ext=$($root_dir/platform/os.sh ext)
|
||||
export CPPFLAGS="-I${h_and_a_dir}/include/boost -I${h_and_a_dir}/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include -L${h_and_a_dir}/lib"
|
||||
patch_sha=$($root_dir/variables.sh patch_sha)
|
||||
export CPPFLAGS="-I${depends_dir}/${host}/include/boost -I${depends_dir}/${host}/include -L${depends_dir}/${host}/lib"
|
||||
echo "Using BTC directory: ${btc_dir}"
|
||||
|
||||
cd "${root_dir}"
|
||||
|
@ -16,20 +14,10 @@ build_dependencies () {
|
|||
if [ -d "${btc_dir}" ]; then
|
||||
pushd "${depends_dir}"
|
||||
echo "using host for dependencies: ${host}"
|
||||
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
|
||||
if [ "${test}" = true ]; then
|
||||
make HOST=${host} NO_QT=1 NO_UPNP=1
|
||||
else
|
||||
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}"
|
||||
make HOST=${host} NO_QT=1 NO_WALLET=1 NO_UPNP=1
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
|
@ -64,18 +52,20 @@ if [ "${BITCORENODE_ENV}" == "test" ]; then
|
|||
fi
|
||||
|
||||
patch_file_sha=$(shasum -a 256 "${root_dir}/etc/bitcoin.patch" | awk '{print $1}')
|
||||
patch_sha="${root_dir}"/etc/patch_sha.txt
|
||||
last_patch_file_sha=
|
||||
if [ -e "${patch_sha}" ]; then
|
||||
echo "Patch file sha exists, let's see if the patch has changed since last build..."
|
||||
last_patch_file_sha=$(cat "${patch_sha}")
|
||||
fi
|
||||
shared_file_built=false
|
||||
if [ "${last_patch_file_sha}" == "${patch_file_sha}" ]; then
|
||||
echo "Patch file contents matches the sha from the patch file itself, so no reason to rebuild the bindings unless there are no prebuilt bindings."
|
||||
shared_file_built=true
|
||||
fi
|
||||
|
||||
if [ "${shared_file_built}" = false ]; then
|
||||
mac_response=$($root_dir/platform/os.sh mac_dependencies)
|
||||
echo "Looks like the patch to bitcoin changed since last build -or- this is the first build, so rebuilding libbitcoind itself..."
|
||||
mac_response=$($root_dir/variables.sh mac_dependencies)
|
||||
if [ "${mac_response}" != "" ]; then
|
||||
echo "${mac_response}"
|
||||
exit -1
|
||||
|
@ -98,7 +88,6 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
|
|||
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
|
||||
|
@ -132,9 +121,9 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
|
|||
echo './autogen.sh'
|
||||
./autogen.sh
|
||||
|
||||
boost_libdir="--with-boost-libdir=${h_and_a_dir}/lib"
|
||||
boost_libdir="--with-boost-libdir=${depends_dir}/${host}/lib"
|
||||
|
||||
full_options="${options} ${boost_libdir} --prefix=${os_dir}"
|
||||
full_options="${options} ${boost_libdir}"
|
||||
echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::"
|
||||
${full_options}
|
||||
|
||||
|
@ -142,9 +131,9 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
|
|||
make V=1
|
||||
|
||||
echo "Creating the sha marker for the patching in libbitcoind..."
|
||||
echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${root_dir}"/etc/patch_sha.txt
|
||||
echo "Writing patch sha file to: \"${patch_sha}\""
|
||||
echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${patch_sha}"
|
||||
echo 'Build finished successfully.'
|
||||
else
|
||||
echo 'Using existing shared library.'
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
os_dir=$(${root_dir}/platform/os.sh osdir)
|
||||
cd "${root_dir}"
|
||||
|
||||
rm -fr libbitcoind
|
||||
rm -fr "${os_dir}"/*
|
||||
node-pre-gyp clean
|
||||
|
|
28
binding.gyp
28
binding.gyp
|
@ -3,9 +3,9 @@
|
|||
'target_name': "<(module_name)",
|
||||
'include_dirs' : [
|
||||
'<!(node -e "require(\'nan\')")',
|
||||
'<!(./platform/os.sh btcdir)/src',
|
||||
'<!(./platform/os.sh btcdir)/depends/<!(./platform/os.sh host)/include',
|
||||
'<!(./platform/os.sh btcdir)/src/leveldb/include'
|
||||
'<!(./variables.sh btcdir)/src',
|
||||
'<!(./variables.sh btcdir)/depends/<!(./variables.sh host)/include',
|
||||
'<!(./variables.sh btcdir)/src/leveldb/include'
|
||||
],
|
||||
'sources': [
|
||||
'./src/libbitcoind.cc',
|
||||
|
@ -27,21 +27,21 @@
|
|||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'<!(./platform/os.sh bitcoind)',
|
||||
'<!(./platform/os.sh filesystem)',
|
||||
'<!(./platform/os.sh thread)',
|
||||
'<!(./platform/os.sh program_options)',
|
||||
'<!(./platform/os.sh system)',
|
||||
'<!(./platform/os.sh chrono)',
|
||||
'<!(./platform/os.sh libsecp256k1)',
|
||||
'<!(./platform/os.sh leveldb)',
|
||||
'<!(./platform/os.sh memenv)',
|
||||
'<!(./platform/os.sh bdb)',
|
||||
'<!(./variables.sh bitcoind)',
|
||||
'<!(./variables.sh filesystem)',
|
||||
'<!(./variables.sh thread)',
|
||||
'<!(./variables.sh program_options)',
|
||||
'<!(./variables.sh system)',
|
||||
'<!(./variables.sh chrono)',
|
||||
'<!(./variables.sh libsecp256k1)',
|
||||
'<!(./variables.sh leveldb)',
|
||||
'<!(./variables.sh memenv)',
|
||||
'<!(./variables.sh bdb)',
|
||||
'-lssl',
|
||||
'-lcrypto'
|
||||
],
|
||||
'ldflags': [
|
||||
'<!(./platform/os.sh load_archive)'
|
||||
'<!(./variables.sh load_archive)'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -139,7 +139,7 @@ index e7aa48d..df0f7ae 100644
|
|||
endef
|
||||
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 1c2f770..4c87b26 100644
|
||||
index 1c2f770..85db1d3 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1,6 +1,12 @@
|
||||
|
@ -203,7 +203,7 @@ index 1c2f770..4c87b26 100644
|
|||
$(abs_top_srcdir)
|
||||
-libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||
|
||||
+ARCH_PLATFORM = $(shell ../../platform/os.sh host)
|
||||
+ARCH_PLATFORM = $(shell ../../variables.sh host)
|
||||
+
|
||||
+libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||
+clientversion.cpp: obj/build.h
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
8f9cdc31ef10317a01573c54509e6b8381c296aa49e7650185b3b3594ff8fa13
|
|
@ -63,7 +63,7 @@
|
|||
},
|
||||
"bundledDependencies": ["node-pre-gyp"],
|
||||
"binary": {
|
||||
"module_name" : "bitcoindjs",
|
||||
"module_name" : "bitcoind",
|
||||
"module_path" : "./build/{configuration}/{node_abi}-{platform}-{arch}/",
|
||||
"remote_path" : "./{module_name}/v{version}/{configuration}/",
|
||||
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
|
||||
|
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
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"
|
||||
os=
|
||||
ext=so
|
||||
|
||||
host=`uname -m`-`uname -a | awk '{print tolower($1)}'`
|
||||
depends_dir="${BITCOIN_DIR}"/depends
|
||||
h_and_a_dir="${depends_dir}"/"${host}"
|
||||
|
||||
mac_response=
|
||||
check_mac_build_system () {
|
||||
|
@ -24,44 +21,6 @@ check_mac_build_system () {
|
|||
fi
|
||||
}
|
||||
|
||||
if test -f /etc/centos-release \
|
||||
|| grep -q 'CentOS' /etc/redhat-release \
|
||||
|| rpm -q --queryformat '%{VERSION}' centos-release > /dev/null; then
|
||||
os=centos
|
||||
elif grep -q 'Fedora' /etc/system-release; then
|
||||
os=fedora
|
||||
elif test -f /etc/redhat_release \
|
||||
|| test -f /etc/redhat-release; then
|
||||
os=rhel
|
||||
elif uname -a | grep -q '^Darwin'; then
|
||||
os=osx
|
||||
ext=dylib
|
||||
elif test -f /etc/SuSE-release; then
|
||||
os=suse
|
||||
elif test -f /etc/mandrake-release \
|
||||
|| test -f /etc/mandriva-release; then
|
||||
os=mandriva
|
||||
elif grep -q 'Linux Mint' /etc/issue; then
|
||||
os=mint
|
||||
elif grep -q 'Ubuntu' /etc/issue \
|
||||
|| grep -q 'Ubuntu' /etc/lsb-release \
|
||||
|| uname -v | grep -q 'Ubuntu'; then
|
||||
os=ubuntu
|
||||
elif test -f /etc/debian_version \
|
||||
|| test -f /etc/debian-version; then
|
||||
os=debian
|
||||
elif grep -q 'Arch Linux' /etc/issue \
|
||||
|| test -d /lib/systemd -a "$(readlink /usr/bin/vi)" = 'ex'; then
|
||||
os=arch
|
||||
elif test "$(uname -s)" = 'SunOS'; then
|
||||
os=solaris
|
||||
elif test "$(uname -s)" = 'AIX'; then
|
||||
os=aix
|
||||
elif test -d /system && test -d /data/data; then
|
||||
os=android
|
||||
fi
|
||||
|
||||
os_dir=${root_dir}/platform/${os}
|
||||
|
||||
thread="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_thread-mt.a
|
||||
filesystem="${BITCOIN_DIR}"/depends/"${host}"/lib/libboost_filesystem-mt.a
|
||||
|
@ -72,28 +31,11 @@ leveldb="${BITCOIN_DIR}"/src/leveldb/libleveldb.a
|
|||
memenv="${BITCOIN_DIR}"/src/leveldb/libmemenv.a
|
||||
libsecp256k1="${BITCOIN_DIR}"/src/secp256k1/.libs/libsecp256k1.a
|
||||
|
||||
if test -z "$os" -o x"$os" = x'android' -o x"$os" = x'aix'; then
|
||||
if test "$os" = 'android' -o "$os" = 'aix'; then
|
||||
echo 'Android or AIX detected!' >& 2
|
||||
fi
|
||||
echo 'OS not supported.' >& 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test x"$1" = x'osdir'; then
|
||||
echo -n "$(pwd)/platform/${os}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test x"$1" = x'btcdir'; then
|
||||
echo -n "${BITCOIN_DIR}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'ext'; then
|
||||
echo -n "${ext}"
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'thread'; then
|
||||
echo -n "${thread}"
|
||||
fi
|
||||
|
@ -130,10 +72,6 @@ if test -z "$1" -o x"$1" = x'libsecp256k1'; then
|
|||
echo -n "${libsecp256k1}"
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'h_and_a_dir'; then
|
||||
echo -n "${h_and_a_dir}"
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'host'; then
|
||||
echo -n "${host}"
|
||||
fi
|
||||
|
@ -144,6 +82,10 @@ if test -z "$1" -o x"$1" = x'bdb'; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'patch_sha'; then
|
||||
echo -n "${root_dir}"/cache/patch_sha.txt
|
||||
fi
|
||||
|
||||
if test -z "$1" -o x"$1" = x'load_archive'; then
|
||||
if [ "${os}" == "osx" ]; then
|
||||
echo -n "-Wl,-all_load -Wl,--no-undefined"
|
Loading…
Reference in New Issue