Subject: Re: learning how to port to pkgsrc
To: Georg Schwarz <georg.schwarz@freenet.de>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 01/02/2005 20:53:55
On Thu, 30 Dec 2004 22:58:06 +0100
georg.schwarz@freenet.de (Georg Schwarz) wrote:

> I thought it was time to learn how to port things to pkgsrc, so I
> figured I should try with an easy example.
> I would like to ask you to please review and test the result of my
> attempts.
> It's small enough to include it here:
> 
> lorenz 136% cat Makefile 

Add a coment with the cvs id.  See other packages.

> DISTNAME=       boa-0.94.13
> CATEGORIES=     www
> MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE:=boa/}
> 
> HOMEPAGE=       http://www.boa.org/
> COMMENT=        boa is a small http server

The comment should read "Small HTTP server".
Add a MAINTAINER line here.

> USE_BUILDLINK3= YES
> WRKSRC=         ${WRKDIR}/${DISTNAME}/src       
> GNU_CONFIGURE=  YES
> USE_GNU_TOOLS+= make

Sort this section alphabetically.
 
> do-install:

Before this, add the following, which is useful in the pkgviews case:

INSTALLATION_DIRS= man/man8 sbin

(no, it's not adequate for share/{doc,examples}/boa.

>                 ${INSTALL_PROGRAM} ${WRKSRC}/boa ${WRKSRC}/boa_indexer
> ${PREFIX}/sbin
>                 ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/boa
>                 ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/boa.conf
> ${PREFIX}/share/examples/boa
>                 ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/boa
>                 ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/CREDITS
> ${WRKDIR}/${DISTNAME}/README ${PREFIX}/share/doc/boa
>                 ${INSTALL_MAN} ${WRKDIR}/${DISTNAME}/docs/boa.8
> ${PREFIX}/man/man8

I'd remove a tab from all these lines.  And break them into multiple
lines (using \).  Lines that wrap over the screen are very ugly.

> .include "../../mk/bsd.pkg.mk"
> lorenz 137% cat DESCR 
> boa is a small http server.

Try to make the description a bit longer.

> lorenz 138% cat PLIST 
> sbin/boa
> sbin/boa_indexer
> share/examples/boa/boa.conf
> share/doc/boa/CREDITS
> share/doc/boa/README
> man/man8/boa.8
> @dirrm share/examples/boa
> @dirrm share/doc/boa

Missing cvs id in PLIST.  (Run pkglint, who should tell you that.)
Sort the PLIST entries alphabetically.  (directory removal in reverse
order is ok.)
Just FYI, "make print-PLIST >PLIST" often produces very good results.

> - are the extra commands to create the examples/boa and doc/boa
> directories needed, or would they be created automatically if not
> existing?

Yes, they are.

> - should I try to rewrite the paths in the sample boa.conf,  or would
> that simply be overkill?

Rewrite the paths.  You'll have to do what tv@ said, or try to substitute
them without patching before (if possible).  Use the SUBST_* framework
(grep makefiles for examples; gdm comes to mind).

> - Do you think it would be a good idea to have a MESSAGE pointing out
> the sample config file?

Add a CONF_FILES entry so that the example file is copied into place,
and hence used by default.

Hope this helps and thanks for your efforts!

-- 
Julio M. Merino Vidal <jmmv@menta.net>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/