From e7965f1caeba4097cdb1c09ce9ab70eaadd35ef7 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 5 Jul 2013 14:10:55 +0000 Subject: 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 --- Mk/bsd.port.mk | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'Mk/bsd.port.mk') diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 361fed521a63..bb4cc800d4b7 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -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#*:}; \ -- cgit v1.2.3