This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-core/meta/packLibs.sh
2019-04-01 20:48:17 +02:00

34 lines
631 B
Bash
Executable File

#!/bin/bash
function packLib()
{
echo -e "\nCopy dependencies for ${1}"
deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1 ~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/')
#Check if the paths are vaild
[[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1
[[ -d $2 ]] || echo -e "No such directory $2 "&& mkdir -pv "$2"
#Copy the deps
for dep in $deps
do
cp -v "$dep" "$2"
done
}
#################################################
if [ -z $1 ]; then
echo "usage: $0 <prefix>"
exit 1
fi
if [ -d $1 ]; then
echo "Clean dependency folder"
rm -rf $1/*
fi
packLib $1/usr/lib/libguh.so $1
packLib $1/usr/bin/guhd $1