Date: Wed, 21 Jan 2015 22:59:54 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-projects@freebsd.org Subject: svn commit: r377632 - in projects/rework-dependency-registration/Mk: . Scripts Message-ID: <201501212259.t0LMxs1Z083389@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Wed Jan 21 22:59:53 2015 New Revision: 377632 URL: https://svnweb.freebsd.org/changeset/ports/377632 QAT: https://qat.redports.org/buildarchive/r377632/ Log: Extract the logical to find libraries from bsd.port.mk and move it into a script to be able to reuse it Added: projects/rework-dependency-registration/Mk/Scripts/find-lib.sh (contents, props changed) Modified: projects/rework-dependency-registration/Mk/bsd.port.mk Added: projects/rework-dependency-registration/Mk/Scripts/find-lib.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/rework-dependency-registration/Mk/Scripts/find-lib.sh Wed Jan 21 22:59:53 2015 (r377632) @@ -0,0 +1,22 @@ +#!/bin/sh +# MAINTAINER: portmgr@FreeBSD.org +# $FreeBSD$ + +if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then + echo "LIB_DIRS, LOCALBASE required in environment." >&2 + exit 1 +fi + +if [ $# -ne 1 ]; then + echo "$0: no argument provided." >&2 +fi + +lib=$1 +dirs="${LIB_DIRS} `cat ${LOCALABSE}/libdata/ldconfig/* 2>/dev/null || :`" + +for libdir in ${dirs} ; do + test -f ${libdir}/${lib} || continue + libfile=`realpath ${libdir}/${lib}` + [ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue + echo $libfile +done Modified: projects/rework-dependency-registration/Mk/bsd.port.mk ============================================================================== --- projects/rework-dependency-registration/Mk/bsd.port.mk Wed Jan 21 22:58:16 2015 (r377631) +++ projects/rework-dependency-registration/Mk/bsd.port.mk Wed Jan 21 22:59:53 2015 (r377632) @@ -4473,18 +4473,8 @@ lib-depends: target="${DEPENDS_TARGET}"; \ depends_args="${DEPENDS_ARGS}"; \ ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $${lib}" ; \ - found=0 ; \ - dirs="${LIB_DIRS} `${CAT} ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || : `" ; \ - for libdir in $$dirs; do \ - test -f $${libdir}/$${lib} || continue; \ - if [ -x /usr/bin/file ]; then \ - _LIB_FILE=`realpath $${libdir}/$${lib}`; \ - [ `file -b -L --mime-type $${_LIB_FILE}` = "application/x-sharedlib" ] || continue ; \ - fi ; \ - found=1 ; \ - ${ECHO_MSG} -n " - found ($${_LIB_FILE})"; \ - done ; \ - if [ $${found} -eq 0 ]; then \ + libfile=`LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}` ; \ + if [ -z "$${libfile}" ]; then \ ${ECHO_MSG} " - not found"; \ ${ECHO_MSG} "===> Verifying for $$lib in $$dir"; \ if [ ! -d "$$dir" ] ; then \ @@ -4493,7 +4483,7 @@ lib-depends: ${_INSTALL_DEPENDS} \ fi ; \ else \ - ${ECHO_MSG}; \ + ${ECHO_MSG} " - found ($${libfile})"; \ fi ; \ done .endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501212259.t0LMxs1Z083389>