diff options
-rw-r--r-- | mk/plist/plist-functions.awk | 8 | ||||
-rw-r--r-- | mk/plist/plist-macros.awk | 27 | ||||
-rw-r--r-- | mk/plist/plist.mk | 18 |
3 files changed, 44 insertions, 9 deletions
diff --git a/mk/plist/plist-functions.awk b/mk/plist/plist-functions.awk index 9c422b08561..1ea324481a6 100644 --- a/mk/plist/plist-functions.awk +++ b/mk/plist/plist-functions.awk @@ -1,4 +1,4 @@ -# $NetBSD: plist-functions.awk,v 1.1 2006/01/12 23:43:57 jlam Exp $ +# $NetBSD: plist-functions.awk,v 1.2 2007/10/31 21:09:03 rillig Exp $ # # Copyright (c) 2006 The NetBSD Foundation, Inc. # All rights reserved. @@ -57,3 +57,9 @@ function print_entry(entry) { print entry } } + +function getenv_or_die(varname) { + if (varname in ENVIRON) + return ENVIRON[varname] + print "ERROR: "varname" must be defined." | "cat 1>&2" +} diff --git a/mk/plist/plist-macros.awk b/mk/plist/plist-macros.awk new file mode 100644 index 00000000000..16c428a6971 --- /dev/null +++ b/mk/plist/plist-macros.awk @@ -0,0 +1,27 @@ +# $NetBSD: plist-macros.awk,v 1.1 2007/10/31 21:09:03 rillig Exp $ + +BEGIN { + IMAKE_MANINSTALL = getenv_or_die("IMAKE_MANINSTALL") +} + +# @imake-man dir basename extension +# +# Creates up to two PLIST entries for man pages of imake-style programs. +# +/^@imake-man/ { + if (IMAKE_MANINSTALL ~ /catinstall/) { + n = split($2, components, "/") + sub("man", "cat", components[n]) + print join(components, 1, n, "/") "/" $3 ".0" + } + if (IMAKE_MANINSTALL ~ /maninstall/) { + n = split($2, components, "/") + sub("cat", "man", components[n]) + print join(components, 1, n, "/") "/" $3 "." $4 + } + next; +} + +1 { + print; +} diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk index 533733145fe..c64e609a85c 100644 --- a/mk/plist/plist.mk +++ b/mk/plist/plist.mk @@ -1,4 +1,4 @@ -# $NetBSD: plist.mk,v 1.35 2007/10/25 22:02:18 jlam Exp $ +# $NetBSD: plist.mk,v 1.36 2007/10/31 21:09:03 rillig Exp $ # # This Makefile fragment handles the creation of PLISTs for use by # pkg_create(8). @@ -159,8 +159,11 @@ PLIST_SUBST+= OPSYS=${OPSYS:Q} \ _PLIST_AWK_ENV+= ${PLIST_SUBST:S/^/PLIST_/} _PLIST_AWK_ENV+= PLIST_SUBST_VARS=${PLIST_SUBST:S/^/PLIST_/:C/=.*//:M*:Q} +_PLIST_1_AWK+= -f ${PKGSRCDIR}/mk/plist/plist-functions.awk +_PLIST_1_AWK+= -f ${PKGSRCDIR}/mk/plist/plist-subst.awk +_PLIST_1_AWK+= -f ${PKGSRCDIR}/mk/plist/plist-macros.awk + _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-functions.awk -_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-subst.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-locale.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-info.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-man.awk @@ -240,12 +243,11 @@ plist: ${PLIST} ${_PLIST_NOKEYWORDS} ${PLIST}: ${PLIST_SRC} .endif ${PLIST}: - ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} - ${_PKG_SILENT}${_PKG_DEBUG} \ - { ${_GENERATE_PLIST} } | \ - ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_AWK} | \ - ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK} \ - > ${.TARGET} + ${RUN} ${MKDIR} ${.TARGET:H} + ${RUN} { ${_GENERATE_PLIST} } > ${.TARGET}-1src + ${RUN} ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_1_AWK} < ${.TARGET}-1src > ${.TARGET}-2mac + ${RUN} ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_AWK} < ${.TARGET}-2mac > ${.TARGET}-3mag + ${RUN} ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK} < ${.TARGET}-3mag > ${.TARGET} # for list of keywords see pkg_create(1) ${_PLIST_NOKEYWORDS}: ${PLIST} |