From 6c395cb76e8d05f782fb750be573ba4737af4fea Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 30 Jan 2015 12:20:00 +0100 Subject: [PATCH] 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. --- .../post-install/06-strip-and-debug-pkgs.sh | 19 ------- common/hooks/pre-pkg/06-shlib-provides.sh | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 common/hooks/pre-pkg/06-shlib-provides.sh diff --git a/common/hooks/post-install/06-strip-and-debug-pkgs.sh b/common/hooks/post-install/06-strip-and-debug-pkgs.sh index a10ddd38032..19320c6e1c1 100644 --- a/common/hooks/post-install/06-strip-and-debug-pkgs.sh +++ b/common/hooks/post-install/06-strip-and-debug-pkgs.sh @@ -1,7 +1,6 @@ # This hook executes the following tasks: # - strips ELF binaries/libraries # - generates -dbg pkgs -# - generates shlib-provides file for xbps-create(8) make_debug() { local dname= fname= dbgfile= @@ -111,14 +110,6 @@ hook() { return 1 fi 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" ;; application/x-archive*) @@ -131,16 +122,6 @@ hook() { echo " Stripped static library: ${f#$PKGDESTDIR}";; esac 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 return $? } diff --git a/common/hooks/pre-pkg/06-shlib-provides.sh b/common/hooks/pre-pkg/06-shlib-provides.sh new file mode 100644 index 00000000000..e29c676f2a9 --- /dev/null +++ b/common/hooks/pre-pkg/06-shlib-provides.sh @@ -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} +}