From e0cf86be4e84e136e8601d945c37ac1767e12050 Mon Sep 17 00:00:00 2001 From: k Date: Mon, 6 Jul 2015 18:38:09 -0400 Subject: [PATCH] fixed threading path and the os dir path. --- bin/build-libbitcoind | 14 +++++++++++--- binding.gyp | 4 ++-- platform/os.sh | 33 ++++++++++++++------------------- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/bin/build-libbitcoind b/bin/build-libbitcoind index 5fdc4417..e7c5720a 100755 --- a/bin/build-libbitcoind +++ b/bin/build-libbitcoind @@ -2,10 +2,13 @@ set -e root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." -cd "$root_dir" +cd "${root_dir}" os_dir=$(./platform/os.sh osdir) +#set the LD_LIBRARY_PATH for the linux clients. +export LD_LIBRARY_PATH="${root_dir}/libbitcoind/src/leveldb":"${os_dir}":$LD_LIBRARY_PATH + if test -e "${os_dir}/libbitcoind.so" || test -e "${os_dir}/libbitcoind.dylib"; then read -r -p 'libbitcoind already built. Rebuild? (Y/n): ' choice if test x"$choice" != x'y' -a x"$choice" != x'Y'; then @@ -59,9 +62,14 @@ make V=1 echo 'Copying libbitcoind.{so|dylib} to its appropriate location.' if test -e "${os_dir}/libbitcoind.so" - mv src/libbitcoind.so "${os_dir}/libbitcoind.so" + mv src/libbitcoind.so "${os_dir}/libbitcoind.so.0.0.0" + cd "${os_dir}" + ln -s libbitcoind.so.0.0.0 libbitcoind.so.0 + ln -s libbitcoind.so.0.0.0 libbitcoind.so elif test -e "${os_dir}/libbitcoind.dylib"; then - mv src/libbitcoind.dylib "${os_dir}/libbitcoind.dylib" + mv src/libbitcoind.dylib "${os_dir}/libbitcoind.0.dylib" + cd "${os_dir}" + ln -s libbitcoind.0.dylib libbitcoind.dylib fi echo 'Build finished successfully.' diff --git a/binding.gyp b/binding.gyp index 26ec53ca..3ae06f37 100644 --- a/binding.gyp +++ b/binding.gyp @@ -27,8 +27,8 @@ ], 'libraries': [ '-lboost_filesystem', - '-lboost_thread', - '-lbitcoind' + ' /dev/null -btcdir() { - if test -d "$(pwd)/libbitcoind"; then - BITCOIN_DIR="$(pwd)/libbitcoind" - elif test -d "${HOME}/bitcoin"; then - BITCOIN_DIR="${HOME}/bitcoin" - fi -} - -if test x"$1" = x'btcdir'; then - btcdir - echo $BITCOIN_DIR - exit 0 -fi - +root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." +BITCOIN_DIR="${root_dir}/libbitcoind" os= ext=so +thread=-lboost_thread if test -f /etc/centos-release \ || grep -q 'CentOS' /etc/redhat-release \ @@ -31,6 +20,7 @@ elif test -f /etc/redhat_release \ elif uname -a | grep -q '^Darwin'; then os=osx ext=dylib + thread=-lboost_thread-mt elif test -f /etc/SuSE-release; then os=suse elif test -f /etc/mandrake-release \ @@ -56,8 +46,9 @@ elif test -d /system && test -d /data/data; then os=android fi +os_dir=${root_dir}/platform/${os} + if test -z "$os" -o x"$os" = x'android' -o x"$os" = x'aix'; then - # Maybe someday... if test "$os" = 'android' -o "$os" = 'aix'; then echo 'Android or AIX detected!' >& 2 fi @@ -69,12 +60,16 @@ if test x"$1" = x'osdir'; then echo -n "$(pwd)/platform/${os}" exit 0 fi + +if test -z "$1" -o x"$1" = x'thread'; then + echo -n "${thread}" +fi + if test -z "$1" -o x"$1" = x'lib'; then - btcdir - if test -n "${BITCOIN_DIR}" -a -e "${BITCOIN_DIR}/src/.libs/libbitcoind.${ext}"; then - echo -n "${BITCOIN_DIR}/src/.libs/libbitcoind.${ext}" - else + if test -e "${os_dir}/libbitcoind.${ext}"; then echo -n "$(pwd)/platform/${os}/libbitcoind.${ext}" + else + echo -n "${BITCOIN_DIR}/src/.libs/libbitcoind.${ext}" fi exit 0 fi