Subject: Re: how to handle dynamic config-file generation?
To: Geert Hendrickx <geert.hendrickx@ua.ac.be>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 08/07/2005 16:46:58
On Sun, Aug 07, 2005 at 03:13:18PM +0200, Geert Hendrickx wrote:
> On Sun, Aug 07, 2005 at 02:21:54PM +0200, Julio M. Merino Vidal wrote:
> > On 8/7/05, Geert Hendrickx <geert.hendrickx@ua.ac.be> wrote:
> > > 
> > > I thought about that, but the package wants to create the file in the same
> > > location it expects to find it (PKG_SYSCONFDIR).
> > 
> > Many packages want to do that, and we "fix" them by doing each action
> > independently (look for the file in one place, but create it somewhere
> > else).  So it is perfectly correct if you do that.
> 
> I could also create the config file manually from the pkg's Makefile,
> instead of patching the original Makefile.in template.  (The "make config"
> target basically just calls the program with --dump-config, pipes the std
> output to the default config location and chmods it.)  

What I usually do, at least for packages that use GNU autoconf and/or
automake, is to set the following in the package Makefile:

EXAMPLEDIR=		${PREFIX}/share/examples/${PKGBASE}
INSTALL_MAKE_FLAGS=	${MAKE_FLAGS} sysconfdir=${EXAMPLEDIR:Q}

This overrides sysconfdir in the software's Makefile only during
installation, which is usually where it wants to install the config
files.  This way, there's less patching needed.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>