From owner-svn-ports-all@FreeBSD.ORG Wed Jan 21 22:59:54 2015 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF841FFB; Wed, 21 Jan 2015 22:59:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90FA4BFD; Wed, 21 Jan 2015 22:59:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0LMxs6c083394; Wed, 21 Jan 2015 22:59:54 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0LMxs1Z083389; Wed, 21 Jan 2015 22:59:54 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201501212259.t0LMxs1Z083389@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 21 Jan 2015 22:59:54 +0000 (UTC) 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 X-SVN-Group: ports-projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2015 22:59:54 -0000 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