Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2013 14:10:56 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r322328 - head/Mk
Message-ID:  <201307051410.r65EAuHw051690@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Fri Jul  5 14:10:55 2013
New Revision: 322328
URL: http://svnweb.freebsd.org/changeset/ports/322328

Log:
  Add new LIB_DEPENDS syntax:
  libname.so:${PORTSDIR}/devel/name
  libname.so.0.1.2:${PORTSDIR}/devel/name
  
  This syntax is support to replace the old syntax and code which has multiple weakness:
  It was replying on ldconfig -r which arbritrary limited our valid library to name of the following form:
  libname.so[.X] where X can be a number
  foo.3 could match both libfoo.3.do and libfoo.so.3
  
  Reviewed by:	bdrewery, danfe, miwi

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Fri Jul  5 13:53:33 2013	(r322327)
+++ head/Mk/bsd.port.mk	Fri Jul  5 14:10:55 2013	(r322328)
@@ -1128,6 +1128,7 @@ _DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
 INDEXDIR?=		${PORTSDIR}
 SRC_BASE?=		/usr/src
 USESDIR?=		${PORTSDIR}/Mk/Uses
+LIB_DIRS?=		/lib /usr/lib ${LOCALBASE}/lib
 
 # make sure bmake treats -V as expected 
 .MAKE.EXPAND_VARIABLES= yes
@@ -5056,7 +5057,34 @@ ${deptype:L}-depends:
 
 lib-depends:
 .if defined(LIB_DEPENDS) && !defined(NO_DEPENDS)
-	@set -e ; for i in ${LIB_DEPENDS}; do \
+	@set -e ; \
+	for i in ${LIB_DEPENDS:M*.so*\:*}; do \
+		lib=$${i%%:*} ; \
+		dir=$${i#*:}  ; \
+		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 \
+				[ `file -b -L --mime-type $${libdir}/$${lib}` = "application/x-sharedlib" ] || continue ; \
+			fi ; \
+			found=1 ; \
+			${ECHO_MSG} " - found"; \
+		done ; \
+		if [ $${found} -eq 0 ]; then \
+			${ECHO_MSG} " - not found"; \
+			${ECHO_MSG} "===>    Verifying for $$lib in $$dir"; \
+			if [ ! -d "$$dir" ] ; then \
+				${ECHO_MSG} "    => No directory for $$lib.  Skipping.."; \
+			else \
+				${_INSTALL_DEPENDS} \
+			fi ; \
+		fi ; \
+	done
+	@set -e ; for i in ${LIB_DEPENDS:N*.so*\:*}; do \
 		lib=$${i%%:*}; \
 		pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"\
 		dir=$${i#*:}; \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307051410.r65EAuHw051690>