aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-02-09 17:16:43 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-02-09 17:16:43 +0000
commit90dc66b285360280a04251ede537fd1e6c415eac (patch)
tree1accbc5718ba226b572c3c571f100c05ef617996 /Mk
parentdac7c7d848ceea2557b6b53e6cc02cd9ed1d3bb5 (diff)
downloadports-90dc66b285360280a04251ede537fd1e6c415eac.tar.gz
ports-90dc66b285360280a04251ede537fd1e6c415eac.zip
Notes
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/actual-package-depends.sh72
-rw-r--r--Mk/Scripts/find-lib.sh62
-rw-r--r--Mk/bsd.port.mk33
3 files changed, 148 insertions, 19 deletions
diff --git a/Mk/Scripts/actual-package-depends.sh b/Mk/Scripts/actual-package-depends.sh
new file mode 100644
index 000000000000..7f157a946444
--- /dev/null
+++ b/Mk/Scripts/actual-package-depends.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+# MAINTAINER: portmgr@FeeeBSD.org
+# $FreeBSD$
+
+if [ -z "${PKG_BIN}" ]; then
+ echo "PKG_BIN required in environment." >&2
+ exit 1
+fi
+
+resolv_symlink() {
+ local file tgt
+ file=${1}
+ if [ ! -L ${file} ] ; then
+ echo ${file}
+ return
+ fi
+
+ tgt=`readlink ${file}`
+ case $tgt in
+ /*)
+ echo $tgt
+ return
+ ;;
+ esac
+
+ file=${file%/*}/${tgt}
+ absolute_path ${file}
+}
+
+absolute_path() {
+ local file myifs target
+ file=$1
+
+ myifs=${IFS}
+ IFS='/'
+ set -- ${file}
+ IFS=${myifs}
+ for el; do
+ case $el in
+ .) continue ;;
+ '') continue ;;
+ ..) target=${target%/*} ;;
+ *) target="${target}/${el}" ;;
+ esac
+ done
+ echo ${target}
+}
+
+find_dep() {
+ pattern=$1
+ case ${pattern} in
+ *\>*|*\<*|*=*)
+ ${PKG_BIN} info -Eg "${pattern}" 2>/dev/null
+ return
+ ;;
+ /*)
+ searchfile=$pattern
+ ;;
+ *)
+ searchfile=$(/usr/bin/which ${pattern} 2>/dev/null)
+ ;;
+ esac
+ if [ -n "${searchfile}" ]; then
+ echo $(resolv_symlink ${searchfile}) >&2
+ ${PKG_BIN} which -q ${searchfile} || ${PKG_BIN} which -q "$(resolv_symlink ${searchfile} 2>/dev/null)" ||
+ echo "actual-package-depends: dependency on ${searchfile} not registered (normal if it belongs to base)" >&2
+ fi
+}
+
+for lookup; do
+ ${PKG_BIN} query "\"%n\": {origin: \"%o\", version: \"%v\"}" "$(find_dep ${lookup})" || :
+done
diff --git a/Mk/Scripts/find-lib.sh b/Mk/Scripts/find-lib.sh
new file mode 100644
index 000000000000..5f8603298f29
--- /dev/null
+++ b/Mk/Scripts/find-lib.sh
@@ -0,0 +1,62 @@
+#!/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 ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :`"
+
+resolv_symlink() {
+ local file tgt
+ file=${1}
+ if [ ! -L ${file} ] ; then
+ echo ${file}
+ return
+ fi
+
+ tgt=`readlink ${file}`
+ case $tgt in
+ /*)
+ echo $tgt
+ return
+ ;;
+ esac
+
+ file=${file%/*}/${tgt}
+ absolute_path ${file}
+}
+
+absolute_path() {
+ local file myifs target
+ file=$1
+
+ myifs=${IFS}
+ IFS='/'
+ set -- ${file}
+ IFS=${myifs}
+ for el; do
+ case $el in
+ .) continue ;;
+ '') continue ;;
+ ..) target=${target%/*} ;;
+ *) target="${target}/${el}" ;;
+ esac
+ done
+ echo ${target}
+}
+
+for libdir in ${dirs} ; do
+ test -f ${libdir}/${lib} || continue
+ libfile=`resolv_symlink ${libdir}/${lib}`
+ [ `file -b -L --mime-type ${libfile}` = "application/x-sharedlib" ] || continue
+ echo $libfile
+ break
+done
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index b7e2d2f1efd1..3a81a359bc00 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1766,9 +1766,12 @@ RUN_DEPENDS+= ${LINUX_BASE_PORT}
PKG_IGNORE_DEPENDS?= 'this_port_does_not_exist'
_GL_gbm_LIB_DEPENDS= libgbm.so:${PORTSDIR}/graphics/gbm
-_GL_glesv2_LIB_DEPENDS= libGLESv2.so:${PORTSDIR}/graphics/libglesv2
-_GL_egl_LIB_DEPENDS= libEGL.so:${PORTSDIR}/graphics/libEGL
-_GL_gl_LIB_DEPENDS= libGL.so:${PORTSDIR}/graphics/libGL
+_GL_glesv2_BUILD_DEPENDS= libglesv2>0:${PORTSDIR}/graphics/libglesv2
+_GL_glesv2_RUN_DEPENDS= libglesv2>0:${PORTSDIR}/graphics/libglesv2
+_GL_egl_BUILD_DEPENDS= libEGL>0:${PORTSDIR}/graphics/libEGL
+_GL_egl_RUN_DEPENDS= libEGL>0:${PORTSDIR}/graphics/libEGL
+_GL_gl_BUILD_DEPENDS= libGL>0:${PORTSDIR}/graphics/libGL
+_GL_gl_RUN_DEPENDS= libGL>0:${PORTSDIR}/graphics/libGL
_GL_gl_USE_XORG= glproto dri2proto
_GL_glew_LIB_DEPENDS= libGLEW.so:${PORTSDIR}/graphics/glew
_GL_glu_LIB_DEPENDS= libGLU.so:${PORTSDIR}/graphics/libGLU
@@ -4473,18 +4476,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=`${SETENV} 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 +4486,7 @@ lib-depends:
${_INSTALL_DEPENDS} \
fi ; \
else \
- ${ECHO_MSG}; \
+ ${ECHO_MSG} " - found ($${libfile})"; \
fi ; \
done
.endif
@@ -4801,9 +4794,11 @@ PACKAGE-DEPENDS-LIST?= \
done
ACTUAL-PACKAGE-DEPENDS?= \
- if [ "${_LIB_RUN_DEPENDS}" != " " ]; then \
- ${PKG_QUERY} "\"%n\": {origin: %o, version: \"%v\"}" " " ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,:C,${PORTSDIR}/,,} 2>/dev/null || : ; \
- fi
+ depfiles="" ; \
+ for lib in ${LIB_DEPENDS:C/\:.*//}; do \
+ depfiles="$$depfiles `${SETENV} LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}`" ; \
+ done ; \
+ ${SETENV} PKG_BIN="${PKG_BIN}" ${SH} ${SCRIPTSDIR}/actual-package-depends.sh $${depfiles} ${RUN_DEPENDS:C/(.*)\:.*/"\1"/}
create-manifest:
@${MKDIR} ${METADIR}; \