From owner-freebsd-ports-bugs Wed Mar 12 5:10:13 2003 Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85F7537B401 for ; Wed, 12 Mar 2003 05:10:08 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B4A643FDD for ; Wed, 12 Mar 2003 05:10:06 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h2CDA6NS064594 for ; Wed, 12 Mar 2003 05:10:06 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h2CDA6JE064593; Wed, 12 Mar 2003 05:10:06 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8805437B401 for ; Wed, 12 Mar 2003 05:07:21 -0800 (PST) Received: from outpost.lukarcos.com (outpost.globcon.net [62.141.88.161]) by mx1.FreeBSD.org (Postfix) with SMTP id 33A3143F93 for ; Wed, 12 Mar 2003 05:07:20 -0800 (PST) (envelope-from sgk@outpost.globcon.net) Received: (qmail 54120 invoked by uid 911); 12 Mar 2003 13:07:21 -0000 Message-Id: <20030312130721.54119.qmail@outpost.globcon.net> Date: 12 Mar 2003 13:07:21 -0000 From: Sergei Kolobov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/49955: [PATCH] bsd.port.mk: add target to automatically install port documentation Sender: owner-freebsd-ports-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 49955 >Category: ports >Synopsis: [PATCH] bsd.port.mk: add target to automatically install port documentation >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: Wed Mar 12 05:10:05 PST 2003 >Closed-Date: >Last-Modified: >Originator: Sergei Kolobov >Release: FreeBSD 4.7-STABLE i386 >Organization: >Environment: System: FreeBSD outpost.globcon.net 4.7-STABLE FreeBSD 4.7-STABLE #0: Mon Oct 14 02:23:23 MSD 2002 sgk@outpost.globcon.net:/data/FreeBSD/obj/data/FreeBSD/src/sys/OUTPOST i386 >Description: Many of the ports, including most of the port I maintain, have documentation files that are being installed into DOCSDIR by the post-install target. To simplify the task for such port, the following trivial patch was created. It achieves several goals: 1. It adds INSTALL_DOCS variable, which, when defined, contains a list of files to be automatically installed into DOCSDIR. So, instead of the following construct in port's Makefile: DOCS= INSTALL NEWS README THANKS TODO doc/README.2nd post-install: .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} .for file in ${DOCS} ${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} .endfor .endif it will be just this: INSTALL_DOCS= INSTALL NEWS README THANKS TODO doc/README.2nd The actual installation is handled a newly-added install-docs phase of the post-install target. 2. DOCSDIR/NOPORTDOCS handling in pkg-plist DOCSDIR variable has been added to PLIST_SUB some time ago. Unfortunately, using it in pkg-plist leads to ugly constructs as this: %%PORTDOCS%%%%DOCSDIR%%/INSTALL The attached patch sets DOCSDIR PLIST_SUB to "@comment " in the NOPORTSDOCS case (essentially the same as PORTDOCS PLIST_SUB). Still, PORTDOCS has some other uses (e.g. in %%PORTDOCS%%@dirrm %%DOCSDIR%%) so it will NOT be obsoleted by DOCSDIR. >How-To-Repeat: >Fix: --- bsd.port.mk-docs.patch begins here --- Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.442 diff -u -r1.442 bsd.port.mk --- bsd.port.mk 12 Mar 2003 00:28:17 -0000 1.442 +++ bsd.port.mk 12 Mar 2003 12:51:26 -0000 @@ -648,12 +648,19 @@ # apply here. It is recommended that you use # %%PREFIX%% for ${PREFIX}, %%LOCALBASE%% for # ${LOCALBASE} and %%X11BASE%% for ${X11BASE}. +# INSTALL_DOCS - If set, bsd.port.mk will automatically create ${DOCSDIR} +# and install files listed into it. +# Does nothing if NOPORTDOCS is defined. +# Run from install-docs target. # DOCSDIR - Name of the directory to install the packages docs in # (default: ${PREFIX}/share/doc/${PORTNAME}). +# This value is added to PLIST_SUB. # EXAMPLESDIR - Name of the directory to install the packages examples in # (default: ${PREFIX}/share/examples/${PORTNAME}). +# This value is added to PLIST_SUB. # DATADIR - Name of the directory to install the packages shared data # in (default: ${PREFIX}/share/${PORTNAME}). +# This value is added to PLIST_SUB. # # Note that the install target will automatically add manpages (see # above) and also substitute special sequences of characters (delimited @@ -1026,12 +1033,6 @@ PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} -.if defined(NOPORTDOCS) -PLIST_SUB+= PORTDOCS="@comment " -.else -PLIST_SUB+= PORTDOCS="" -.endif - CONFIGURE_SHELL?= ${SH} MAKE_SHELL?= ${SH} @@ -2214,8 +2215,12 @@ EXAMPLESDIR?= ${PREFIX}/share/examples/${PORTNAME} DATADIR?= ${PREFIX}/share/${PORTNAME} -PLIST_SUB+= DOCSDIR="${DOCSDIR:S,^${PREFIX}/,,}" \ - EXAMPLESDIR="${EXAMPLESDIR:S,^${PREFIX}/,,}" \ +.if defined(NOPORTDOCS) +PLIST_SUB+= PORTDOCS="@comment" DOCSDIR="@comment " +.else +PLIST_SUB+= PORTDOCS="" DOCSDIR="${DOCSDIR:S,^${PREFIX}/,,}" +.endif +PLIST_SUB+= EXAMPLESDIR="${EXAMPLESDIR:S,^${PREFIX}/,,}" \ DATADIR="${DATADIR:S,^${PREFIX}/,,}" # Put this as far down as possible so it will catch all PLIST_SUB definitions. @@ -2893,6 +2898,17 @@ .endif .endif +.if !target(install-docs) +install-docs: +.if defined(INSTALL_DOCS) && !defined(NOPORTDOCS) + @${ECHO_MSG} "===> Installing documentation" + @${MKDIR} ${DOCSDIR} + cd ${WRKSRC} && ${INSTALL_DATA} ${INSTALL_DOCS} ${DOCSDIR} +.else + @${DO_NADA} +.endif +.endif + .if !target(run-ldconfig) run-ldconfig: .if defined(INSTALLS_SHLIB) @@ -3018,9 +3034,9 @@ _INSTALL_DEP= build _INSTALL_SEQ= install-message check-categories check-already-installed \ check-umask run-depends lib-depends install-mtree pre-install \ - pre-install-script do-install generate-plist post-install \ - post-install-script compress-man run-ldconfig fake-pkg \ - security-check + pre-install-script do-install install-docs generate-plist \ + post-install post-install-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 --- bsd.port.mk-docs.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message