blob: ad8b9803118ed2c6bd9d4dbfdafe456317c243a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# This hook executes the following tasks:
# - generates shlib-provides file for xbps-create(8)
collect_sonames() {
local _destdir="$1" f _soname _fname _pattern
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
local _tmpfile="$(mktemp)"
if [ ! -d ${_destdir} ]; then
rm -f ${_tmpfile}
return 0
fi
# real pkg
find ${_destdir} -type f | while read f; do
_fname=$(basename "$f")
case "$(file -bi "$f")" in
application/x-sharedlib*)
# shared library
_soname=$(${OBJDUMP} -p "$f"|grep SONAME|awk '{print $2}')
if [[ ${_soname} =~ ${_pattern} ]]; then
if [ ! -e ${_destdir}/usr/lib/${_fname} -a \
! -e ${_destdir}/usr/lib32/${_fname} ]; then
continue
fi
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
cat ${_tmpfile} | tr '\n' ' ' > ${_destdir}/shlib-provides
echo >> ${_destdir}/shlib-provides
fi
rm -f ${_tmpfile}
}
hook() {
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
if [ -z "$shlib_provides" -o -n "$noarch" -o -n "$noshlibprovides" ]; then
return 0
fi
# native pkg
collect_sonames ${PKGDESTDIR}
# 32bit pkg
collect_sonames ${_destdir32}
}
|