2015-01-30 11:20:00 +00:00
|
|
|
# This hook executes the following tasks:
|
|
|
|
# - generates shlib-provides file for xbps-create(8)
|
|
|
|
|
|
|
|
collect_sonames() {
|
|
|
|
local _destdir="$1" f _soname _fname _pattern
|
2015-10-06 18:15:44 +00:00
|
|
|
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
|
|
|
|
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
|
2019-06-17 15:38:07 +00:00
|
|
|
local _tmpfile=$(mktemp) || exit 1
|
2015-01-30 11:20:00 +00:00
|
|
|
|
|
|
|
if [ ! -d ${_destdir} ]; then
|
|
|
|
rm -f ${_tmpfile}
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# real pkg
|
2015-03-26 03:13:03 +00:00
|
|
|
find ${_destdir} -type f -name "*.so*" | while read f; do
|
2015-09-11 05:55:40 +00:00
|
|
|
_fname="${f##*/}"
|
2015-01-30 11:20:00 +00:00
|
|
|
case "$(file -bi "$f")" in
|
2018-04-16 19:37:48 +00:00
|
|
|
application/x-sharedlib*|application/x-pie-executable*)
|
2015-01-30 11:20:00 +00:00
|
|
|
# shared library
|
|
|
|
_soname=$(${OBJDUMP} -p "$f"|grep SONAME|awk '{print $2}')
|
2015-10-06 18:15:44 +00:00
|
|
|
# Register all versioned sonames, and
|
|
|
|
# unversioned sonames only when in libdir.
|
|
|
|
if [[ ${_soname} =~ ${_versioned_pattern} ]] ||
|
|
|
|
[[ ${_soname} =~ ${_pattern} &&
|
|
|
|
( -e ${_destdir}/usr/lib/${_fname} ||
|
|
|
|
-e ${_destdir}/usr/lib32/${_fname} ) ]]; then
|
2015-01-30 11:20:00 +00:00
|
|
|
echo "${_soname}" >> ${_tmpfile}
|
|
|
|
echo " SONAME ${_soname} from ${f##${_destdir}}"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in ${shlib_provides}; do
|
|
|
|
echo "$f" >> ${_tmpfile}
|
|
|
|
done
|
|
|
|
if [ -s "${_tmpfile}" ]; then
|
2019-04-13 16:48:09 +00:00
|
|
|
tr '\n' ' ' < "${_tmpfile}" > ${_destdir}/shlib-provides
|
2015-01-30 11:20:00 +00:00
|
|
|
echo >> ${_destdir}/shlib-provides
|
|
|
|
fi
|
|
|
|
rm -f ${_tmpfile}
|
|
|
|
}
|
|
|
|
|
|
|
|
hook() {
|
|
|
|
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
|
|
|
|
|
2015-12-03 09:04:16 +00:00
|
|
|
if [ -z "$shlib_provides" -a "${archs// /}" = "noarch" -o -n "$noshlibprovides" ]; then
|
2015-01-30 11:20:00 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# native pkg
|
|
|
|
collect_sonames ${PKGDESTDIR}
|
|
|
|
# 32bit pkg
|
|
|
|
collect_sonames ${_destdir32}
|
|
|
|
}
|