mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-07 23:53:51 +02:00
hooks/shlib-provides: record shared libraries without SONAME
In a later change, we would like to generate runtime-deps between sub-packages. In order to do that, we can add everything into etc/shlibs or we can look into other subpackages directly. The former is cumbersome if such package has lot of shared-objects. The latter requires traversing and checking a lot of files. Furtunately, we can speed up the latter one by storing all shared-objects' information in a centralised place.
This commit is contained in:
parent
337d270447
commit
6d6cf11a2b
1 changed files with 24 additions and 6 deletions
|
@ -6,19 +6,30 @@ collect_sonames() {
|
||||||
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
|
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
|
||||||
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
|
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
|
||||||
local _tmpfile=$(mktemp) || exit 1
|
local _tmpfile=$(mktemp) || exit 1
|
||||||
|
local _mainpkg="$2"
|
||||||
|
local _shlib_dir="${XBPS_STATEDIR}/shlib-provides"
|
||||||
|
local _no_soname=$(mktemp) || exit 1
|
||||||
|
|
||||||
|
mkdir -p "${_shlib_dir}" || exit 1
|
||||||
if [ ! -d ${_destdir} ]; then
|
if [ ! -d ${_destdir} ]; then
|
||||||
rm -f ${_tmpfile}
|
rm -f ${_tmpfile}
|
||||||
|
rm -f ${_no_soname}
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# real pkg
|
# real pkg
|
||||||
find ${_destdir} -type f -name "*.so*" | while read f; do
|
find ${_destdir} -type f -name "*.so*" | while read f; do
|
||||||
_fname="${f##*/}"
|
_fname="${f##*/}"
|
||||||
case "$(file -bi "$f")" in
|
case "$(file -bi "$f")" in
|
||||||
application/x-sharedlib*|application/x-pie-executable*)
|
application/x-sharedlib*|application/x-pie-executable*)
|
||||||
# shared library
|
# shared library
|
||||||
_soname=$(${OBJDUMP} -p "$f"|grep SONAME|awk '{print $2}')
|
_soname=$(${OBJDUMP} -p "$f"|awk '/SONAME/{print $2}')
|
||||||
|
if [ -n "$noshlibprovides" ]; then
|
||||||
|
# register all shared lib for rt-deps between sub-pkg
|
||||||
|
echo "${_fname}" >>${_no_soname}
|
||||||
|
continue
|
||||||
|
fi
|
||||||
# Register all versioned sonames, and
|
# Register all versioned sonames, and
|
||||||
# unversioned sonames only when in libdir.
|
# unversioned sonames only when in libdir.
|
||||||
if [[ ${_soname} =~ ${_versioned_pattern} ]] ||
|
if [[ ${_soname} =~ ${_versioned_pattern} ]] ||
|
||||||
|
@ -27,6 +38,9 @@ collect_sonames() {
|
||||||
-e ${_destdir}/usr/lib32/${_fname} ) ]]; then
|
-e ${_destdir}/usr/lib32/${_fname} ) ]]; then
|
||||||
echo "${_soname}" >> ${_tmpfile}
|
echo "${_soname}" >> ${_tmpfile}
|
||||||
echo " SONAME ${_soname} from ${f##${_destdir}}"
|
echo " SONAME ${_soname} from ${f##${_destdir}}"
|
||||||
|
else
|
||||||
|
# register all shared lib for rt-deps between sub-pkg
|
||||||
|
echo "${_fname}" >>${_no_soname}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -38,6 +52,14 @@ collect_sonames() {
|
||||||
if [ -s "${_tmpfile}" ]; then
|
if [ -s "${_tmpfile}" ]; then
|
||||||
tr '\n' ' ' < "${_tmpfile}" > ${_destdir}/shlib-provides
|
tr '\n' ' ' < "${_tmpfile}" > ${_destdir}/shlib-provides
|
||||||
echo >> ${_destdir}/shlib-provides
|
echo >> ${_destdir}/shlib-provides
|
||||||
|
if [ "$_mainpkg" ]; then
|
||||||
|
cp "${_tmpfile}" "${_shlib_dir}/${pkgname}.soname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$_mainpkg" ] && [ -s "${_no_soname}" ]; then
|
||||||
|
mv "${_no_soname}" "${_shlib_dir}/${pkgname}.nosoname"
|
||||||
|
else
|
||||||
|
rm -f ${_no_soname}
|
||||||
fi
|
fi
|
||||||
rm -f ${_tmpfile}
|
rm -f ${_tmpfile}
|
||||||
}
|
}
|
||||||
|
@ -45,12 +67,8 @@ collect_sonames() {
|
||||||
hook() {
|
hook() {
|
||||||
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
|
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
|
||||||
|
|
||||||
if [ -n "$noshlibprovides" ]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# native pkg
|
# native pkg
|
||||||
collect_sonames ${PKGDESTDIR}
|
collect_sonames ${PKGDESTDIR} yes
|
||||||
# 32bit pkg
|
# 32bit pkg
|
||||||
collect_sonames ${_destdir32}
|
collect_sonames ${_destdir32}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue