Is staging a port really this simple?

Perry Hutchison perryh at pluto.rain.com
Tue May 27 04:13:34 UTC 2014


John Marino <freebsd.contact at marino.st> wrote:
> You didn't miss much -- except adding the man page to the
> pkg-plist and removing the MAN* definitions from the makefile.

...

> On 5/25/2014 09:09, Zsolt Udvari wrote:
> > Your condition is unneeded.
> > You don't need check the existence of
> > ${STAGEDIR}${PREFIX}/etc/distcheckd.conf because you'll copy it, the
> > ${STAGEDIR} are empty!!!!
>
> no, the @sample keyword in pkg-plist does that (replacing other lines
> there).  pkg doesn't do this by itself, it needs to be told.

So, like this? (diffs against the originals, not the previous iteration)
[and I don't follow how, or if, @sample should be used in diskcheckd
since it delivers the sample named as such, and also installs it as
the live config file if the live config file does not already exist]

--- misc/gtkfind/Makefile
+++ misc/gtkfind/Makefile-staged
@@ -18,15 +18,13 @@
 USE_GNOME=	gtk12
 GNU_CONFIGURE=	yes
 
-MAN1=		gtkfind.1
-PLIST_FILES=	bin/gtkfind
+PLIST_FILES=	bin/gtkfind man/man1/gtkfind.1
 
-NO_STAGE=	yes
 post-patch:
 	${REINPLACE_CMD} -e "s,-O2,${CFLAGS}," ${WRKSRC}/configure ${WRKSRC}/Makefile.in
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/gtkfind ${PREFIX}/bin
-	${INSTALL_MAN} ${WRKSRC}/gtkfind.1 ${MANPREFIX}/man/man1
+	${INSTALL_PROGRAM} ${WRKSRC}/gtkfind ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_MAN} ${WRKSRC}/gtkfind.1 ${STAGEDIR}${MANPREFIX}/man/man1
 
 .include <bsd.port.mk>
--- sysutils/diskcheckd/Makefile
+++ sysutils/diskcheckd/Makefile-staged
@@ -11,15 +11,13 @@
 MAINTAINER=	perryh at pluto.rain.com
 COMMENT=	Daemon to check for disk read errors
 
-MAN8=		diskcheckd.8
 MLINKS=		diskcheckd.8 diskcheckd.conf.5
 
 USE_RC_SUBR=	diskcheckd
 CFLAGS+=	-D_PATH_CONF='\"${PREFIX}/etc/diskcheckd.conf\"'
 MAKEFILE=	/usr/share/mk/bsd.prog.mk
-MAKE_ARGS=	PROG=diskcheckd MAN8=${MAN8}
+MAKE_ARGS=	PROG=diskcheckd MAN8=diskcheckd.8
 
-NO_STAGE=	yes
 do-extract:
 	@${MKDIR} ${WRKSRC}
 .for f in diskcheckd.c diskcheckd.8
@@ -30,13 +28,13 @@
 	@${REINPLACE_CMD} -e 's|/usr/local/etc/diskcheckd.conf|${PREFIX}/etc/diskcheckd.conf|g' ${WRKSRC}/diskcheckd.8
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/diskcheckd ${PREFIX}/sbin
-	${INSTALL_DATA}	${FILESDIR}/diskcheckd.conf ${PREFIX}/etc/diskcheckd.conf.sample
-	${INSTALL_MAN} ${WRKSRC}/diskcheckd.8 ${MAN8PREFIX}/man/man8
+	${INSTALL_PROGRAM} ${WRKSRC}/diskcheckd ${STAGEDIR}${PREFIX}/sbin
+	${INSTALL_DATA}	${FILESDIR}/diskcheckd.conf \
+			${STAGEDIR}${PREFIX}/etc/diskcheckd.conf.sample
+	${INSTALL_MAN} ${WRKSRC}/diskcheckd.8 ${STAGEDIR}${MAN8PREFIX}/man/man8
 
 post-install:
-	@[ -f ${PREFIX}/etc/diskcheckd.conf ] \
-		|| ${CP} -p ${PREFIX}/etc/diskcheckd.conf.sample \
-			${PREFIX}/etc/diskcheckd.conf
+	@${CP} -p ${STAGEDIR}${PREFIX}/etc/diskcheckd.conf.sample \
+		${STAGEDIR}${PREFIX}/etc/diskcheckd.conf
 
 .include <bsd.port.mk>
--- sysutils/diskcheckd/pkg-plist
+++ sysutils/diskcheckd/pkg-plist-staged
@@ -1,4 +1,6 @@
 sbin/diskcheckd
+man/man8/diskcheckd.8
+man/man5/diskcheckd.conf.5
 @unexec if cmp -s %D/etc/diskcheckd.conf.sample %D/etc/diskcheckd.conf; then rm -f %D/etc/diskcheckd.conf; fi
 etc/diskcheckd.conf.sample
 @exec if [ ! -f %D/etc/diskcheckd.conf ]; then cp %D/%F %B/diskcheckd.conf; fi


More information about the freebsd-ports mailing list