ports/93947: bsd.port.mk: Implement PORTEXAMPLES facility just like PORTDOCS
Renato Botelho
garga at FreeBSD.org
Tue Feb 28 16:30:17 UTC 2006
>Number: 93947
>Category: ports
>Synopsis: bsd.port.mk: Implement PORTEXAMPLES facility just like PORTDOCS
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Feb 28 16:30:06 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Renato Botelho
>Release: FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD freefall.freebsd.org 6.0-STABLE FreeBSD 6.0-STABLE #0: Sat Dec 10 03:18:20 UTC 2005 kensmith at freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386
>Description:
Today some ports maintainers install example files always, some
others doesn't install if NOPORTDOCS is set.
Since PORTDOCS facilities make docs install a lot easier, i decided,
after discuss with linion@ to copy this facility and implement the same to
EXAMPLES.
>How-To-Repeat:
>Fix:
--- bsd.port.mk.diff begins here ---
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.529
diff -u -r1.529 bsd.port.mk
--- bsd.port.mk 23 Feb 2006 15:37:20 -0000 1.529
+++ bsd.port.mk 28 Feb 2006 11:10:53 -0000
@@ -575,6 +575,16 @@
# Default: "share/info" if ${PREFIX} is equal to /usr
# and "info" otherwise).
#
+# Set the following to specify all example files your port installs into
+# ${EXAMPLESDIR}
+#
+# PORTEXAMPLES - A list of files and directories relative to EXAMPLESDIR.
+# Shell glob patterns can be used, directories include
+# the entire subtree of contained files and directories.
+# Should not be set when no example files are installed
+# (for example because NOPORTEXAMPLES is defined).
+# Useful for dynamically generated example files.
+#
# Set the following to specify all documentation your port installs into
# ${DOCSDIR}
#
@@ -1450,6 +1460,12 @@
.endif
.endif
+.if defined(NOPORTEXAMPLES)
+PLIST_SUB+= PORTEXAMPLES="@comment "
+.else
+PLIST_SUB+= PORTEXAMPLES=""
+.endif
+
.if defined(NOPORTDOCS)
PLIST_SUB+= PORTDOCS="@comment "
.else
@@ -3779,8 +3795,9 @@
_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
pre-su-install-script do-install install-desktop-entries \
post-install post-install-script add-plist-info \
- add-plist-docs add-plist-post install-rc-script compress-man \
- run-ldconfig fake-pkg security-check
+ add-plist-examples add-plist-docs add-plist-post \
+ install-rc-script compress-man run-ldconfig fake-pkg \
+ security-check
_PACKAGE_DEP= install
_PACKAGE_SEQ= package-message pre-package pre-package-script \
do-package post-package-script
@@ -4998,6 +5015,30 @@
${TMPPLIST}:
@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} generate-plist
+.if !target(add-plist-examples)
+add-plist-examples:
+.if defined(PORTEXAMPLES) && !defined(NOPORTEXAMPLES)
+ @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \
+ [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
+ ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
+ fi
+.for x in ${PORTEXAMPLES}
+ @if ${ECHO_CMD} "${x}"| ${AWK} '$$1 ~ /(\*|\||\[|\]|\?|\{|\}|\$$)/ { exit 1};'; then \
+ if [ ! -e ${EXAMPLESDIR}/${x} ]; then \
+ ${ECHO_CMD} ${EXAMPLESDIR}/${x} | \
+ ${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
+ fi;fi
+.endfor
+ @${FIND} -P ${PORTEXAMPLES:S/^/${EXAMPLESDIR}\//} ! -type d 2>/dev/null | \
+ ${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST}
+ @${FIND} -P -d ${PORTEXAMPLES:S/^/${EXAMPLESDIR}\//} -type d 2>/dev/null | \
+ ${SED} -ne 's,^${PREFIX}/, at dirrm ,p' >> ${TMPPLIST}
+ @${ECHO_CMD} "@dirrm ${EXAMPLESDIR:S,^${PREFIX}/,,}" >> ${TMPPLIST}
+.else
+ @${DO_NADA}
+.endif
+.endif
+
.if !target(add-plist-docs)
add-plist-docs:
.if defined(PORTDOCS) && !defined(NOPORTDOCS)
--- bsd.port.mk.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list