aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>2023-08-08 15:08:27 +0000
committerĐoàn Trần Công Danh <sgn.danh@gmail.com>2023-08-30 06:24:12 +0000
commit6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9 (patch)
tree4fec01a967325bae43a68d7b8302b36307bc93ed /common
parent337d270447d62d4be99cfa062f6e7ac85df25bc3 (diff)
downloadvoid-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar.gz
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar.bz2
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar.lz
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar.xz
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.tar.zst
void-packages-6d6cf11a2b8ee2cb154600c9f5a233c6d2af25e9.zip
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.
Diffstat (limited to 'common')
-rw-r--r--common/hooks/post-install/98-shlib-provides.sh30
1 files changed, 24 insertions, 6 deletions
diff --git a/common/hooks/post-install/98-shlib-provides.sh b/common/hooks/post-install/98-shlib-provides.sh
index a09eb6f5c3b..ad1c31c72db 100644
--- a/common/hooks/post-install/98-shlib-provides.sh
+++ b/common/hooks/post-install/98-shlib-provides.sh
@@ -6,19 +6,30 @@ collect_sonames() {
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
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
rm -f ${_tmpfile}
+ rm -f ${_no_soname}
return 0
fi
+
# real pkg
find ${_destdir} -type f -name "*.so*" | while read f; do
_fname="${f##*/}"
case "$(file -bi "$f")" in
application/x-sharedlib*|application/x-pie-executable*)
# 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
# unversioned sonames only when in libdir.
if [[ ${_soname} =~ ${_versioned_pattern} ]] ||
@@ -27,6 +38,9 @@ collect_sonames() {
-e ${_destdir}/usr/lib32/${_fname} ) ]]; then
echo "${_soname}" >> ${_tmpfile}
echo " SONAME ${_soname} from ${f##${_destdir}}"
+ else
+ # register all shared lib for rt-deps between sub-pkg
+ echo "${_fname}" >>${_no_soname}
fi
;;
esac
@@ -38,6 +52,14 @@ collect_sonames() {
if [ -s "${_tmpfile}" ]; then
tr '\n' ' ' < "${_tmpfile}" > ${_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
rm -f ${_tmpfile}
}
@@ -45,12 +67,8 @@ collect_sonames() {
hook() {
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
- if [ -n "$noshlibprovides" ]; then
- return 0
- fi
-
# native pkg
- collect_sonames ${PKGDESTDIR}
+ collect_sonames ${PKGDESTDIR} yes
# 32bit pkg
collect_sonames ${_destdir32}
}