Better library generation

This commit is contained in:
WolverinDEV 2020-01-25 15:05:48 +01:00
parent 0ef580477f
commit 52c20efff5
2 changed files with 15 additions and 17 deletions

View File

@ -1 +1 @@
env/libs env/libs/

View File

@ -33,51 +33,49 @@ cd env || { echo "failed to enter env"; exit 1; }
mkdir libs || { echo "failed to create lib directory"; exit 1; } mkdir libs || { echo "failed to create lib directory"; exit 1; }
cd libs || { echo "failed to enter lib directory"; exit 1; } cd libs || { echo "failed to enter lib directory"; exit 1; }
# Creating symbolic links # Creating copied
library_base=$(realpath ../../../../../libraries) library_base=$(realpath ../../../../../libraries)
# Setting up ssl # Setting up ssl
library_path=$(realpath "${library_base}/boringssl/${build_path}/ssl/libssl.so") library_path=$(realpath "${library_base}/boringssl/${build_path}/ssl/libssl.so")
ln -s "$library_path" . || { echo "failed to link libssl.so"; exit 1; } cp "$library_path" . || { echo "failed to copy libssl.so"; exit 1; }
# Setting up crypto # Setting up crypto
library_path=$(realpath "${library_base}/boringssl/${build_path}/crypto/libcrypto.so") library_path=$(realpath "${library_base}/boringssl/${build_path}/crypto/libcrypto.so")
ln -s "$library_path" . || { echo "failed to link libcrypto.so"; exit 1; } cp "$library_path" . || { echo "failed to copy libcrypto.so"; exit 1; }
# Setting up DataPipes # Setting up DataPipes
library_path=$(realpath "${library_base}//DataPipes/${build_path}/lib/libDataPipes.so") library_path=$(realpath "${library_base}//DataPipes/${build_path}/lib/libDataPipes.so")
ln -s "$library_path" . || { echo "failed to link libDataPipes.so"; exit 1; } cp "$library_path" . || { echo "failed to copy libDataPipes.so"; exit 1; }
# Setting up Sqlite3 # Setting up Sqlite3
query_system_link "libsqlite3.so.0" query_system_link "libsqlite3.so.0"
ln -s "${library_path}" . || { echo "failed to link libsqlite3.so.0"; exit 1; } cp "${library_path}" . || { echo "failed to copy libsqlite3.so.0"; exit 1; }
# Setting up jemalloc # Setting up jemalloc
query_system_link "libjemalloc.so.2" query_system_link "libjemalloc.so.2"
ln -s "${library_path}" . || { echo "failed to link libjemalloc.so.2"; exit 1; } cp "${library_path}" . || { echo "failed to copy libjemalloc.so.2"; exit 1; }
# Setting up TeaMusic # Setting up TeaMusic
library_path=$(realpath "../../../../MusicBot/libs/libTeaMusic.so") library_path=$(realpath "../../../../MusicBot/libs/libTeaMusic.so")
ln -s "$library_path" . || { echo "failed to link libTeaMusic.so"; exit 1; } cp "$library_path" . || { echo "failed to copy libTeaMusic.so"; exit 1; }
if ldd "../../../environment/TeaSpeakServer" | grep -q "libnice.so.10"; then if ldd "../../../environment/TeaSpeakServer" | grep -q "libnice.so.10"; then
echo "Adding web libraries" echo "Adding web libraries"
# Setting up libnice # Setting up libnice
library_path=$(realpath "${library_base}/libnice/${build_os_type}_${build_os_arch}/lib/libnice.so.10") library_path=$(realpath "${library_base}/libnice/${build_os_type}_${build_os_arch}/lib/libnice.so.10")
ln -s "$library_path" . || { echo "failed to link libnice.so.10"; exit 1; } cp "$library_path" . || { echo "failed to copy libnice.so.10"; exit 1; }
# Setting up libpcre # Setting up libpcre
query_system_link "libpcre.so.3" query_system_link "libpcre.so.3"
ln -s "${library_path}" . || { echo "failed to link libpcre.so.3"; exit 1; } cp "${library_path}" . || { echo "failed to copy libpcre.so.3"; exit 1; }
fi fi
# Validate setup # Fix rpaths
broken_links=$(find . -type l ! -exec test -e {} \; -print) for file in *.so*; do
[[ -n ${broken_links} ]] && { echo "Editing rpath for $file"
echo "Failed to setup all links. Some seem to be broken:" patchelf --set-rpath "./libs/:./" "$file"
echo "$broken_links" done
exit 1
}
echo "All libraries have been linked successfully" echo "All libraries have been linked successfully"