patch: ports/Mk/

Brandon D. Valentine brandon at
Thu Feb 12 01:11:18 PST 2004

I have seen many ports use a construct similar to this in the do-install

    .if !defined(NOPORTDOCS)
            @${MKDIR} ${DOCSDIR}

Now, all of the ports I've seen do this have a corresponding:

    %%PORTDOCS%%@rmdir %%DOCSDIR%%

or similiar in their pkg-plist.  If NOPORTDOCS is defined, then a
deinstall of these ports will complain about not being able to remove
DOCSDIR due to that line in the pkg-plist.  That line shouldn't exist in
the PLIST if NOPORTDOCS is defined, which means it should be added to
the TMPPLIST at install time rather than hardcoded in the pkg-plist

The current add-plist-docs target does this if and only if PORTDOCS is
set.  It should do it in all cases.  I have attached a patch to fix
this.  The patch is untested as my only test machine is undergoing a
massive portupgrade at the moment.

I'd appreciate some feedback on this.


Brandon D. Valentine
brandon at                 
Pseudo-Random Googlism:  february is "kindness" month at hillendale
-------------- next part --------------
Index: ports/Mk/
RCS file: /home/ncvs/ports/Mk/,v
retrieving revision 1.484
diff -u -r1.484
--- ports/Mk/	4 Feb 2004 04:27:04 -0000	1.484
+++ ports/Mk/	12 Feb 2004 09:07:42 -0000
@@ -4896,12 +4896,12 @@
 		${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST}
 	@${FIND} -P -d ${PORTDOCS:S/^/${DOCSDIR}\//} -type d 2>/dev/null | \
 		${SED} -ne 's,^${PREFIX}/, at dirrm ,p' >> ${TMPPLIST}
-	@if [ -d "${DOCSDIR}" ]; then \
-		${ECHO_CMD} "@unexec rmdir %D/${DOCSDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}; \
-	fi
+	@if [ -d "${DOCSDIR}" ]; then \
+		${ECHO_CMD} "@unexec rmdir %D/${DOCSDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}; \
+	fi

More information about the freebsd-ports mailing list