bitcore-node-zcash/bin/build-libbitcoind

87 lines
2.7 KiB
Plaintext
Raw Normal View History

2014-12-09 13:29:32 -08:00
#!/bin/bash
set -e
2014-12-06 16:43:53 -08:00
2014-12-09 13:24:24 -08:00
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
cd "${root_dir}"
2015-07-02 11:59:14 -07:00
2014-12-07 02:02:51 -08:00
os_dir=$(./platform/os.sh osdir)
2014-12-06 17:18:12 -08:00
#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 test x"$1" = x'debug'; then
debug=--enable-debug
2014-12-07 00:02:31 -08:00
fi
only_make=false
libbitcoind=`find "${os_dir}" -iname "libbitcoind*"`
if [ "$libbitcoind" != "" ]; then
read -r -p 'libbitcoind already built. Remove and reinstall/Re-make only/Do Nothing? (r/m/D): ' choice
if test x"$choice" = x'r' -o x"$choice" = x'R'; then
echo "Removing libbitcoind and recloning, patching, and building..."
2015-07-02 14:13:03 -07:00
rm -rf "${root_dir}/libbitcoind"
rm -f "${os_dir}/libbitcoind.*"
elif test x"$choice" = x'm' -o x"$choice" = x'M'; then
echo "Running make inside libbitcoind..."
rm -f "${os_dir}/libbitcoind.*"
if [ -d "${root_dir}/libbitcoind" ]; then
only_make=true
else
echo "can not seem to find the build directory, we must do the whole shebang, bummer..."
fi
2014-12-06 17:18:12 -08:00
else
echo 'libbitcoind ready.'
exit 0
2014-12-06 17:18:12 -08:00
fi
2015-07-02 14:13:03 -07:00
fi
2014-12-06 16:43:53 -08:00
2015-07-02 14:13:03 -07:00
btc_dir="${root_dir}/libbitcoind"
echo "Found BTC directory: ${btc_dir}"
cd "${btc_dir}"
2015-07-02 14:13:03 -07:00
if [ "${only_make}" = false ]; then
if test -e "${root_dir/PATCH_VERSION}"; then
tag=`cat "${root_dir}/PATCH_VERSION" | xargs`
else
echo "no tag file found, please create it in the root of the project as so: 'echo \"v0.10.2\" > PATCH_VERSION'"
exit 0
fi
2014-12-07 00:56:43 -08:00
echo "attempting to checkout tag: ${tag} of bitcoin from github..."
git clone --depth 1 --branch "${tag}" git://github.com/bitcoin/bitcoin.git libbitcoind
2014-12-06 16:43:53 -08:00
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
2014-12-06 16:43:53 -08:00
echo './autogen.sh'
./autogen.sh
options=`cat ${root_dir}/bin/config_options.sh`
full_options="${options}${os_dir} ${debug}"
echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::"
${full_options}
2014-12-07 00:24:57 -08:00
fi
2015-07-02 14:13:03 -07:00
echo 'make V=1'
make V=1
2014-12-06 16:43:53 -08:00
2015-07-07 10:51:11 -07:00
ext=$($root_dir/platform/os.sh ext)
2015-07-02 14:13:03 -07:00
echo 'Copying libbitcoind.{so|dylib} to its appropriate location.'
if test -e "${root_dir}/libbitcoind/src/.libs/libbitcoind.${ext}"; then
2015-07-07 10:51:11 -07:00
if [ "$ext" = "dylib" ]; then
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.0.dylib" "${os_dir}/"
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.dylib" "${os_dir}/"
else
2015-07-07 12:36:17 -07:00
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so" "${os_dir}/"
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so.0" "${os_dir}/"
cp "${root_dir}/libbitcoind/src/.libs/libbitcoind.so.0.0.0" "${os_dir}/"
2015-07-07 10:51:11 -07:00
fi
2015-07-02 14:13:03 -07:00
fi
2014-12-06 17:18:12 -08:00
2014-12-06 16:43:53 -08:00
echo 'Build finished successfully.'