Bindings as one shared library

- libbitcoind is now linked statically into the binding file versus being its own shared library
- the build script now copies the .a file into libs
This commit is contained in:
Chris Kleeschulte 2015-08-03 18:37:47 -04:00
parent 8a5d4b014f
commit c6f2a87158
3 changed files with 62 additions and 18 deletions

View File

@ -20,7 +20,12 @@ copy_header_files () {
echo "Copying headers for caching purposes, this can take a while (but will only be done once), please wait..." echo "Copying headers for caching purposes, this can take a while (but will only be done once), please wait..."
find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include find libbitcoind -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.ipp" \) -print0 | xargs -0 -I{} rsync -R {} "${artifacts_dir}"/include
mkdir -p "${artifacts_dir}/lib" > /dev/null 2>&1 mkdir -p "${artifacts_dir}/lib" > /dev/null 2>&1
cp -r "${h_and_a_dir}"/lib/libboost_filesystem-mt.a "${h_and_a_dir}"/lib/libboost_thread-mt.a "${artifacts_dir}"/lib/ cp -r "${h_and_a_dir}"/lib/libboost_filesystem-mt.a "${h_and_a_dir}"/lib/libboost_thread-mt.a "${h_and_a_dir}"/lib/libboost_chrono-mt.a \
"${h_and_a_dir}"/lib/libboost_program_options-mt.a "${h_and_a_dir}"/lib/libboost_system-mt.a "${btc_dir}"/src/secp256k1/.libs/libsecp256k1.a \
"${btc_dir}"/src/.libs/libbitcoind.a "${btc_dir}"/src/leveldb/libleveldb.a "${btc_dir}"/src/leveldb/libmemenv.a "${artifacts_dir}"/lib/
if [ "${test}" = true ]; then
cp -r "${h_and_a_dir}"/lib/libdb* "${artifacts_dir}"/lib/
fi
popd popd
fi fi
} }
@ -159,24 +164,15 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
make V=1 make V=1
echo 'Copying libbitcoind.{so|dylib} to its appropriate location.' echo 'Copying libbitcoind.{so|dylib} to its appropriate location.'
if test -e "${btc_dir}/src/.libs/libbitcoind.${ext}"; then if test -e "${btc_dir}/src/.libs/libbitcoind.a"; then
if [ "$ext" = "dylib" ]; then mkdir -p "${artifacts_dir}"
if [ ! -d "${os_dir}/lib" ]; then cp -R "${btc_dir}"/src/.libs/libbitcoind.a "${artifacts_dir}"
mkdir -p "${os_dir}/lib"
fi
cp -R "${btc_dir}"/src/.libs/libbitcoind.*dylib "${os_dir}/lib/"
else
if [ ! -d "${os_dir}" ]; then
mkdir -p "${os_dir}"
fi
cp -P "${btc_dir}"/src/.libs/libbitcoind.so* "${os_dir}/"
fi
echo "Creating the sha marker for the patching in libbitcoind..." echo "Creating the sha marker for the patching in libbitcoind..."
echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${artifacts_dir}"/patch_sha.txt echo -n `shasum -a 256 "${root_dir}"/etc/bitcoin.patch | awk '{print $1}'` > "${artifacts_dir}"/patch_sha.txt
echo "Copying the header files in order to be cached..." echo "Copying the header files in order to be cached..."
copy_header_files copy_header_files
else else
echo "Could not find the shared libraries after they should have been built, please run make clean inside the libbitcoind dir and run npm install again." echo "Could not find the libraries after they should have been built, please run make clean inside the libbitcoind dir and run npm install again."
exit 1 exit 1
fi fi
echo 'Build finished successfully.' echo 'Build finished successfully.'

View File

@ -27,12 +27,20 @@
], ],
'link_settings': { 'link_settings': {
'libraries': [ 'libraries': [
'<!(./platform/os.sh bitcoind)',
'<!(./platform/os.sh filesystem)', '<!(./platform/os.sh filesystem)',
'<!(./platform/os.sh thread)', '<!(./platform/os.sh thread)',
'<!(./platform/os.sh lib)' '<!(./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)',
'-lssl',
'-lcrypto'
], ],
'ldflags': [ 'ldflags': [
'-Wl,-rpath,<!(./platform/os.sh osdir)',
'<!(./platform/os.sh load_archive)' '<!(./platform/os.sh load_archive)'
] ]
} }

View File

@ -71,6 +71,12 @@ fi
thread="${artifacts_dir}"/lib/libboost_thread-mt.a thread="${artifacts_dir}"/lib/libboost_thread-mt.a
filesystem="${artifacts_dir}"/lib/libboost_filesystem-mt.a filesystem="${artifacts_dir}"/lib/libboost_filesystem-mt.a
chrono="${artifacts_dir}"/lib/libboost_chrono-mt.a
program_options="${artifacts_dir}"/lib/libboost_program_options-mt.a
system="${artifacts_dir}"/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 -z "$os" -o x"$os" = x'android' -o x"$os" = x'aix'; then if test -z "$os" -o x"$os" = x'android' -o x"$os" = x'aix'; then
if test "$os" = 'android' -o "$os" = 'aix'; then if test "$os" = 'android' -o "$os" = 'aix'; then
@ -102,10 +108,34 @@ if test -z "$1" -o x"$1" = x'filesystem'; then
echo -n "${filesystem}" echo -n "${filesystem}"
fi fi
if test -z "$1" -o x"$1" = x'program_options'; then
echo -n "${program_options}"
fi
if test -z "$1" -o x"$1" = x'system'; then
echo -n "${system}"
fi
if test -z "$1" -o x"$1" = x'chrono'; then
echo -n "${chrono}"
fi
if test -z "$1" -o x"$1" = x'depends_dir'; then if test -z "$1" -o x"$1" = x'depends_dir'; then
echo -n "${depends_dir}" echo -n "${depends_dir}"
fi fi
if test -z "$1" -o x"$1" = x'leveldb'; then
echo -n "${leveldb}"
fi
if test -z "$1" -o x"$1" = x'memenv'; then
echo -n "${memenv}"
fi
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 if test -z "$1" -o x"$1" = x'h_and_a_dir'; then
echo -n "${h_and_a_dir}" echo -n "${h_and_a_dir}"
fi fi
@ -114,11 +144,17 @@ if test -z "$1" -o x"$1" = x'host'; then
echo -n "${host}" echo -n "${host}"
fi fi
if test -z "$1" -o x"$1" = x'bdb'; then
if [ "${BITCOINDJS_ENV}" == "test" ]; then
echo -n "${artifacts_dir}/lib/libdb_cxx.a"
fi
fi
if test -z "$1" -o x"$1" = x'load_archive'; then if test -z "$1" -o x"$1" = x'load_archive'; then
if [ "${os}" == "osx" ]; then if [ "${os}" == "osx" ]; then
echo -n "-Wl,-all_load" echo -n "-Wl,-all_load -Wl,--no-undefined"
else else
echo -n "-Wl,--whole-archive ${filesystem} ${thread} -Wl,--no-whole-archive" echo -n "-Wl,--whole-archive ${filesystem} ${thread} "${BITCOIN_DIR}"/src/.libs/libbitcoind.a -Wl,--no-whole-archive"
fi fi
fi fi
@ -131,6 +167,10 @@ if test -z "$1" -o x"$1" = x'mac_dependencies'; then
echo -n "${mac_response}" echo -n "${mac_response}"
fi fi
if test -z "$1" -o x"$1" = x'bitcoind'; then
echo -n "${BITCOIN_DIR}"/src/.libs/libbitcoind.a
fi
if test -z "$1" -o x"$1" = x'lib'; then if test -z "$1" -o x"$1" = x'lib'; then
if test -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then if test -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then
if test -e "${os_dir}/lib/libbitcoind.${ext}"; then if test -e "${os_dir}/lib/libbitcoind.${ext}"; then