summaryrefslogtreecommitdiff
path: root/mk/find-prefix.mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-09-29 10:56:34 +0000
committerrillig <rillig@pkgsrc.org>2007-09-29 10:56:34 +0000
commit7756a9e297b56dccdc6bd88f88006ccf4bbfd665 (patch)
tree6074c4e57437bf27e7dfdeb0fa4d9cf8380c0ba8 /mk/find-prefix.mk
parent8c304824210bf3bcf5037d282b91808996fd2e2b (diff)
downloadpkgsrc-7756a9e297b56dccdc6bd88f88006ccf4bbfd665.tar.gz
Improved the documentation.
Diffstat (limited to 'mk/find-prefix.mk')
-rw-r--r--mk/find-prefix.mk30
1 files changed, 28 insertions, 2 deletions
diff --git a/mk/find-prefix.mk b/mk/find-prefix.mk
index 135cbd5827f..8dcf2b889a3 100644
--- a/mk/find-prefix.mk
+++ b/mk/find-prefix.mk
@@ -1,7 +1,28 @@
-# $NetBSD: find-prefix.mk,v 1.4 2005/11/28 05:54:17 jlam Exp $
+# $NetBSD: find-prefix.mk,v 1.5 2007/09/29 10:56:34 rillig Exp $
#
# This is a "subroutine" that can be included to find the installation
-# prefix of a package.
+# prefix of an installed package.
+#
+# Parameters:
+#
+# FIND_PREFIX
+# A list of <VARNAME>=<pattern> pairs, where
+#
+# * <pattern> is a package wildcard pattern (see pkg_info(8)),
+# * <VARNAME> is the variable that will be set to the
+# installation prefix for the package.
+#
+# Returns:
+#
+# <VARNAME>
+# The prefix of the corresponding package, or ${LOCALBASE}
+# if the package is not installed.
+#
+# Example:
+#
+# FIND_PREFIX:= M4DIR=gm4
+# .include "../../mk/find-prefix.mk"
+# # ${M4DIR} now contains the installation prefix for the "gm4" package.
#
# The input variable is FIND_PREFIX, which is a list of VARNAME=<pattern>
# pairs, where "VARNAME" is the variable that will be set to the
@@ -17,6 +38,11 @@
.for _def_ in ${FIND_PREFIX}
. if !defined(${_def_:C/=.*$//})
+
+# XXX: Is this *_DEFAULT variable really necessary? The default value
+# can be easily embedded in the shell code. What if VARNAME is set to
+# PKG_APACHE, for example?
+#
${_def_:C/=.*$//}_DEFAULT?= ${LOCALBASE}
_${_def_:C/=.*$//}_cmd= \
${PKG_INFO} -qp ${_def_:C/^[^=]*=//:Q} 2>/dev/null | \