adjusted script to build bitcoind
This commit is contained in:
parent
e4b7f37805
commit
49808a64ac
@ -1,68 +1,67 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||||
cd "$root_dir"
|
cd "$root_dir"
|
||||||
|
|
||||||
os_dir=$(./platform/os.sh osdir)
|
os_dir=$(./platform/os.sh osdir)
|
||||||
|
|
||||||
if test -e "${os_dir}/libbitcoind.so"; then
|
if test -e "${os_dir}/libbitcoind.so" || test -e "${os_dir}/libbitcoind.dylib"; then
|
||||||
read -r -p 'libbitcoind.so already built. Rebuild? (Y/n): ' choice
|
read -r -p 'libbitcoind already built. Rebuild? (Y/n): ' choice
|
||||||
if test x"$choice" != x'y' -a x"$choice" != x'Y'; then
|
if test x"$choice" != x'y' -a x"$choice" != x'Y'; then
|
||||||
echo 'libbitcoind.so ready.'
|
echo 'libbitcoind ready.'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
rm -rf libbitcoind
|
rm -rf libbitcoind
|
||||||
rm -f "${os_dir}/libbitcoind.so"
|
rm -f "${os_dir}/libbitcoind.*"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$1"; then
|
if [ -d "${root_dir}/libbitcoind" ]; then
|
||||||
if test "$1" = 'remote'; then
|
read -r -p "libbitcoind (bitcoind repo) exists, would you like to remove it? (Y/n): " choice
|
||||||
echo 'git clone'
|
if [ "$choice" = "y" -o "$choice" = "Y" ]; then
|
||||||
git clone git://github.com/bitcoin/bitcoin.git libbitcoind || exit 1
|
rm -rf "${root_dir}/libbitcoind"
|
||||||
btc_dir="${root_dir}/libbitcoind"
|
|
||||||
else
|
else
|
||||||
btc_dir=$1
|
echo "ok you chose not to remove the bitcoin repo, exiting...bu bye!"
|
||||||
if ! test -d "$btc_dir"; then
|
|
||||||
"$0" remote
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
btc_dir="${HOME}/bitcoin"
|
|
||||||
if ! test -d "$btc_dir"; then
|
|
||||||
"$0" remote
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
#read the PATCH VERSION
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "attempting to checkout tag: $tag of bitcoin from github..."
|
||||||
|
git clone --depth 1 --branch "${tag}" git://github.com/bitcoin/bitcoin.git libbitcoind
|
||||||
|
btc_dir="${root_dir}/libbitcoind"
|
||||||
|
|
||||||
echo "Found BTC directory: $btc_dir"
|
echo "Found BTC directory: $btc_dir"
|
||||||
|
|
||||||
echo './patch-bitcoin.sh' "$btc_dir"
|
echo './patch-bitcoin.sh' "$btc_dir"
|
||||||
./bin/patch-bitcoin "$btc_dir" || exit 1
|
./bin/patch-bitcoin "$btc_dir"
|
||||||
|
|
||||||
cd "$btc_dir" || exit 1
|
cd "$btc_dir"
|
||||||
|
|
||||||
if ! test -d .git; then
|
if ! test -d .git; then
|
||||||
echo 'Please point this script to an upstream bitcoin git repo.'
|
echo 'Please point this script to an upstream bitcoin git repo.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo './autogen.sh'
|
echo './autogen.sh'
|
||||||
./autogen.sh || exit 1
|
./autogen.sh
|
||||||
if test -n "$1"; then
|
options=`cat ${root_dir}/bin/config_options.sh`
|
||||||
echo './configure --enable-daemonlib' "$@"
|
full_options="${options}${os_dir}"
|
||||||
./configure --enable-daemonlib "$@" || exit 1
|
echo "running the configure script with the following options:\n :::[\"${full_options}\"]:::"
|
||||||
else
|
$full_options
|
||||||
echo './configure --enable-daemonlib'
|
echo 'make V=1'
|
||||||
./configure --enable-daemonlib || exit 1
|
make V=1
|
||||||
fi
|
|
||||||
echo 'make'
|
|
||||||
make || exit 1
|
|
||||||
|
|
||||||
echo 'Copying libbitcoind.so to its appropriate location.'
|
echo 'Copying libbitcoind.{so|dylib} to its appropriate location.'
|
||||||
mv src/libbitcoind.so "${os_dir}/libbitcoind.so" || exit 1
|
if test -e "${os_dir}/libbitcoind.so"
|
||||||
|
mv src/libbitcoind.so "${os_dir}/libbitcoind.so"
|
||||||
|
elif test -e "${os_dir}/libbitcoind.dylib"; then
|
||||||
|
mv src/libbitcoind.dylib "${os_dir}/libbitcoind.dylib"
|
||||||
|
fi
|
||||||
|
|
||||||
echo 'Build finished successfully.'
|
echo 'Build finished successfully.'
|
||||||
exit 0
|
|
||||||
|
|||||||
2
bin/config_options.sh
Normal file
2
bin/config_options.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
./configure --enable-tests=no --enable-daemonlib --with-gui=no --without-qt --without-miniupnpc --without-bdb --enable-debug --disable-wallet --without-utils --prefix=
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user