xbps-src: create a new hook that collects shlib-provides.
This is necessary to be able to collect shlib-provides for 32bit pkgs, which are autogenerated. The strip-and-debug-pkgs hook now just does what its name mentions: strip binaries and create -dbg pkgs.
This commit is contained in:
parent
c3073185f6
commit
6c395cb76e
@ -1,7 +1,6 @@
|
|||||||
# This hook executes the following tasks:
|
# This hook executes the following tasks:
|
||||||
# - strips ELF binaries/libraries
|
# - strips ELF binaries/libraries
|
||||||
# - generates -dbg pkgs
|
# - generates -dbg pkgs
|
||||||
# - generates shlib-provides file for xbps-create(8)
|
|
||||||
|
|
||||||
make_debug() {
|
make_debug() {
|
||||||
local dname= fname= dbgfile=
|
local dname= fname= dbgfile=
|
||||||
@ -111,14 +110,6 @@ hook() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo " Stripped library: ${f#$PKGDESTDIR}"
|
echo " Stripped library: ${f#$PKGDESTDIR}"
|
||||||
_soname=$(${OBJDUMP} -p "$f"|grep SONAME|awk '{print $2}')
|
|
||||||
pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
|
|
||||||
if [[ ${_soname} =~ $pattern ]]; then
|
|
||||||
if [ ! -e ${PKGDESTDIR}/usr/lib/${fname} ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "${_soname}" >> ${PKGDESTDIR}/.shlib-provides
|
|
||||||
fi
|
|
||||||
attach_debug "$f"
|
attach_debug "$f"
|
||||||
;;
|
;;
|
||||||
application/x-archive*)
|
application/x-archive*)
|
||||||
@ -131,16 +122,6 @@ hook() {
|
|||||||
echo " Stripped static library: ${f#$PKGDESTDIR}";;
|
echo " Stripped static library: ${f#$PKGDESTDIR}";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in ${shlib_provides}; do
|
|
||||||
echo "$f" >> ${PKGDESTDIR}/.shlib-provides
|
|
||||||
done
|
|
||||||
if [ -s "$PKGDESTDIR/.shlib-provides" ]; then
|
|
||||||
cat $PKGDESTDIR/.shlib-provides | tr '\n' ' ' > $PKGDESTDIR/shlib-provides
|
|
||||||
echo >> $PKGDESTDIR/shlib-provides
|
|
||||||
rm -f $PKGDESTDIR/.shlib-provides
|
|
||||||
fi
|
|
||||||
|
|
||||||
create_debug_pkg
|
create_debug_pkg
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
54
common/hooks/pre-pkg/06-shlib-provides.sh
Normal file
54
common/hooks/pre-pkg/06-shlib-provides.sh
Normal file
@ -0,0 +1,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 [ -n "$noarch" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# native pkg
|
||||||
|
collect_sonames ${PKGDESTDIR}
|
||||||
|
# 32bit pkg
|
||||||
|
collect_sonames ${_destdir32}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user