Skip to content

Instantly share code, notes, and snippets.

@boltronics
Created May 19, 2014 14:21
Show Gist options
  • Save boltronics/ae905ee0757c8e76723d to your computer and use it in GitHub Desktop.
Save boltronics/ae905ee0757c8e76723d to your computer and use it in GitHub Desktop.
Find lua .so name
#!/bin/bash
declare lua_soname
declare -r distro="$(lsb_release -is)"
declare pms
declare package
if [ -n "${distro}" ]
then
case "${distro}" in
"Debian" | "Ubuntu" )
pms=dpkg
;;
"Fedora" | "openSUSE" )
pms=rpm
;;
esac
fi
if [ "${pms}" = "dpkg" ]
then
lua_soname="$(for package in $(dpkg -l | cut -d ' ' -f 3 | grep 'liblua')
do
dpkg -L "${package}"
done | grep '\.so$' | grep -v 'c\+\+' | sort -V | tail -n 1)"
elif [ "${pms}" = "rpm" ]
then
lua_soname="$(for package in $(rpm -l | grep lua)
do
rpm -ql "${package}"
done | grep '\.so$' | grep -v 'c\+\+' | sort -V | tail -n 1)"
else
{
echo "Autodetection of liblua5.1.so library failed."
echo
echo "Please manually specify the library. eg:"
echo " make lua_soname=/path/to/liblua5.1.so"
exit 1
} 1>&2
fi
echo ${lua_soname}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment