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..."
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
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
fi
}
@ -159,24 +164,15 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
make V=1
echo 'Copying libbitcoind.{so|dylib} to its appropriate location.'
if test -e "${btc_dir}/src/.libs/libbitcoind.${ext}"; then
if [ "$ext" = "dylib" ]; then
if [ ! -d "${os_dir}/lib" ]; then
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
if test -e "${btc_dir}/src/.libs/libbitcoind.a"; then
mkdir -p "${artifacts_dir}"
cp -R "${btc_dir}"/src/.libs/libbitcoind.a "${artifacts_dir}"
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 "Copying the header files in order to be cached..."
copy_header_files
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
fi
echo 'Build finished successfully.'

View File

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

View File

@ -71,6 +71,12 @@ fi
thread="${artifacts_dir}"/lib/libboost_thread-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 "$os" = 'android' -o "$os" = 'aix'; then
@ -102,10 +108,34 @@ if test -z "$1" -o x"$1" = x'filesystem'; then
echo -n "${filesystem}"
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
echo -n "${depends_dir}"
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
echo -n "${h_and_a_dir}"
fi
@ -114,11 +144,17 @@ if test -z "$1" -o x"$1" = x'host'; then
echo -n "${host}"
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 [ "${os}" == "osx" ]; then
echo -n "-Wl,-all_load"
echo -n "-Wl,-all_load -Wl,--no-undefined"
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
@ -131,6 +167,10 @@ if test -z "$1" -o x"$1" = x'mac_dependencies'; then
echo -n "${mac_response}"
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 -e "${os_dir}/libbitcoind.${ext}" -o -e "${os_dir}/lib/libbitcoind.${ext}"; then
if test -e "${os_dir}/lib/libbitcoind.${ext}"; then