Subject: HOMEPAGEs
To: None <tech-pkg@netbsd.org>
From: Ty Sarna <tsarna@endicor.com>
List: tech-pkg
Date: 08/21/1998 12:09:23
Yesterday I committed the HOMEPAGE support, plus added HOMEPAGEs to
the about two thirds of our existing packages for which I could find a
page. Today I've updated Packages.txt with information on it.

Package submitters: please make an effort to find a home page for the
software you're packaging, if it has one. Put the URL for the page in
the variable HOMEPAGE, which should follow MAINTAINER. For example:

-----snip snip-----
# $NetBSD: Makefile,v 1.7 1998/08/20 15:16:45 tsarna Exp $

DISTNAME=	bison-1.25
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_GNU}

MAINTAINER=	thorpej@netbsd.org
HOMEPAGE=	http://www.gnu.org/software/bison/bison.html

GNU_CONFIGURE=	yes
INFO_FILES=	bison.info

.include "../../mk/bsd.pkg.mk"
-----snip snip-----


The HOMEPAGE is currently only used when gereating the README.html
files, to insert a link from there to the package's home page.
I'd also like to have the URL automaticly appended to the DESCR file,
primarily to benefit users of precompiled packages. The following
patch adds that feature. Comments?

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.146
diff -u -r1.146 bsd.pkg.mk
--- bsd.pkg.mk	1998/08/20 15:17:16	1.146
+++ bsd.pkg.mk	1998/08/20 16:58:00
@@ -326,7 +326,8 @@
 .endif
 
 COMMENT?=	${PKGDIR}/COMMENT
-DESCR?=		${PKGDIR}/DESCR
+DESCR_SRC?=	${PKGDIR}/DESCR
+DESCR?=		${WRKDIR}/.DESCR
 PLIST=		${WRKDIR}/.PLIST
 
 PKG_CMD?=		/usr/sbin/pkg_create
@@ -934,7 +935,7 @@
 # Package
 
 .if !target(do-package)
-do-package: ${PLIST}
+do-package: ${PLIST} ${DESCR}
 	@if [ -e ${PLIST} ]; then \
 		${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
 		if [ -d ${PACKAGES} ]; then \
@@ -1692,8 +1693,8 @@
 	else \
 		${ECHO} -n "** No Description"; \
 	fi; \
-	if [ -f ${DESCR} ]; then \
-		${ECHO} -n "|${DESCR}"; \
+	if [ -f ${DESCR_SRC} ]; then \
+		${ECHO} -n "|${DESCR_SRC}"; \
 	else \
 		${ECHO} -n "|/dev/null"; \
 	fi; \
@@ -1808,7 +1809,7 @@
 # accordance to the @pkgdep directive in the packing lists
 
 .if !target(fake-pkg)
-fake-pkg: ${PLIST}
+fake-pkg: ${PLIST} ${DESCR}
 	@if [ ! -f ${PLIST} -o ! -f ${COMMENT} -o ! -f ${DESCR} ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
 	@if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
 .if defined(FORCE_PKG_REGISTER)
@@ -1888,3 +1889,13 @@
 			>${PLIST} ; \
 	fi
 .endif  # MANZ
+
+# generate ${DESCR} from ${DESCR_SRC} by:
+# - Appending the homepage URL, if any
+
+${DESCR}: ${DESCR_SRC}
+	@${CAT} ${DESCR_SRC} > ${DESCR}
+.if defined(HOMEPAGE)
+	@(${ECHO} ; ${ECHO} "Homepage:" ; \
+	${ECHO} '${HOMEPAGE}') >> ${DESCR}	
+.endif