ports/67151: Mk/bsd.port.mk - Add a way to handle PLIST_SUB like substitutions to a given file list.
Florent Thoumie
flz at xbsd.org
Sun May 30 11:59:44 UTC 2004
This is a new version of the patch.
o Useless ${CAT} has been removed (thanks to eik's notice)
o Now when using PORTDOCS comment style, each line beginning with
"@comment " is deleted from the output.
--- apply-slist.diff begins here ---
--- bsd.port.mk.old Sun May 30 13:54:33 2004
+++ bsd.port.mk Sun May 30 13:53:44 2004
@@ -720,6 +720,17 @@
# (default: ${WRKDIR}/.PLIST.mktmp).
# PLIST_SUB - List of "variable=value" pair for substitution in ${PLIST}
# (default: see below).
+#
+# SUB_FILES - Files that should be passed through sed and redirected to ${WRKDIR}.
+# - For each file specified in SUB_FILES, there must be a corresponding
+# file in ${FILESDIR} whose suffix is ".in". For instance,
+# if the Makefile specifies "SUB_FILES= pkg-message" then there must be
+# a file called pkg-message.in in ${FILESDIR}.
+# - The substitution process is the same as PLIST_FILES, as described
+# below except that any line beginning with @comment is deleted.
+# SUB_LIST - List of "variable=value" pair for substitution in ${SUB_FILES}
+# (some pair are added by default: eg. PREFIX=${PREFIX}).
+#
# INSTALLS_SHLIB - If set, bsd.port.mk will automatically run ldconfig commands
# from post-install and also add appropriate @exec/@unexec
# directives to directories listed in LDCONFIG_DIRS.
@@ -1208,6 +1219,8 @@
INSTALL_WRKSRC?=${WRKSRC}
PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
+SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \
+ DATADIR=${DATADIR} DOCSDIR=${DOCSDIR} EXAMPLESDIR=${EXAMPLESDIR}
.if defined(WITHOUT_CPU_CFLAGS)
.if defined(_CPUCFLAGS)
@@ -3496,7 +3509,7 @@
_INSTALL_DEP= build
_INSTALL_SEQ= install-message check-conflicts \
run-depends lib-depends pre-install pre-install-script \
- generate-plist check-already-installed
+ apply-slist generate-plist check-already-installed
_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
pre-su-install-script do-install post-install add-plist-info \
post-install-script add-plist-docs compress-man run-ldconfig fake-pkg \
@@ -4485,6 +4498,26 @@
@${ECHO_CMD} '" to run.'
.endif
.endif
+
+_SUB_LIST_TEMP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
+.if !target(apply-slist)
+apply-slist:
+.if defined(SUB_FILES)
+.for file in ${SUB_FILES}
+.if !exists(${FILESDIR}/${file}.in)
+ @${ECHO_CMD} "** Missing ${FILESDIR}/${file}.in for ${PKGNAME}."; exit 1
+.else
+ @${SED} ${_SUB_LIST_TEMP} -e '/^@comment /d' ${FILESDIR}/${file}.in > ${WRKDIR}/${file}
+.endif
+.endfor
+.for i in pkg-message pkg-install pkg-deinstall pkg-req
+.if ${SUB_FILES:M${i}*}!=""
+${i:S/-//:U}= ${WRKDIR}/${SUB_FILES:M${i}*}
+.endif
+.endfor
+.endif
+.endif
+
# Generate packing list. Also tests to make sure all required package
# files exist.
--- apply-slist.diff ends here ---
More information about the freebsd-ports-bugs
mailing list