1 # This hook executes the following tasks:
2 # - generates shlib-provides file for xbps-create(1)
5 local _destdir
="$1" f _soname _fname _pattern
6 local _pattern
="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
7 local _versioned_pattern
="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
8 local _tmpfile
=$
(mktemp
) ||
exit 1
10 local _shlib_dir
="${XBPS_STATEDIR}/shlib-provides"
11 local _no_soname
=$
(mktemp
) ||
exit 1
13 mkdir
-p "${_shlib_dir}" ||
exit 1
14 if [ ! -d ${_destdir} ]; then
22 find ${_destdir} -type f
-name "*.so*" |
while read f
; do
24 case "$(file -bi "$f")" in
25 application
/x-sharedlib
*|application
/x-pie-executable
*)
27 _soname
=$
(${OBJDUMP} -p "$f"|
awk '/SONAME/{print $2}')
28 if [ -n "$noshlibprovides" ]; then
29 # register all shared lib for rt-deps between sub-pkg
30 echo "${_fname}" >>${_no_soname}
33 # Register all versioned sonames, and
34 # unversioned sonames only when in libdir.
35 if [[ ${_soname} =~
${_versioned_pattern} ]] ||
36 [[ ${_soname} =~
${_pattern} &&
37 ( -e ${_destdir}/usr
/lib
/${_fname} ||
38 -e ${_destdir}/usr
/lib32
/${_fname} ) ]]; then
39 echo "${_soname}" >> ${_tmpfile}
40 echo " SONAME ${_soname} from ${f##${_destdir}}"
42 # register all shared lib for rt-deps between sub-pkg
43 echo "${_fname}" >>${_no_soname}
49 for f
in ${shlib_provides}; do
50 echo "$f" >> ${_tmpfile}
52 if [ -s "${_tmpfile}" ]; then
53 tr '\n' ' ' < "${_tmpfile}" > ${_destdir}/shlib-provides
54 echo >> ${_destdir}/shlib-provides
55 if [ "$_mainpkg" ]; then
56 cp "${_tmpfile}" "${_shlib_dir}/${pkgname}.soname"
59 if [ "$_mainpkg" ] && [ -s "${_no_soname}" ]; then
60 mv "${_no_soname}" "${_shlib_dir}/${pkgname}.nosoname"
68 local _destdir32
=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
74 _pkgname
=${pkgname%-32bit}
75 for _pkg
in $sourcepkg $subpackages; do
76 if [ "$_pkg" = "$_pkgname" ]; then
85 collect_sonames
${PKGDESTDIR} $_mainpkg
87 collect_sonames
${_destdir32}