Subject: Re: simplifying an installation of examples and doc files
To: None <tech-pkg@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 10/21/2007 21:10:12
Aleksey Cheusov wrote:
> pkgsrc has tons of package/Makefile's that contain section like the
> following:
> 
>     DOCDIR=         ${PREFIX}/share/doc/${PKGBASE}
>     EGDIR=
> 
>     DOCFILES=      README COPYRIGHT NEWS ChangeLog
>     EGFILES=       example1.conf example2.conf
> 
>     INSTALLATION_DIRS+=   ${DOCDIR} ${EGDIR}
> 
>     post-install:
>     .for i in ${DOCFILES}
>          ${INSTALL_DATA} ${WRKSRC}/${i} ${DOCDIR}
>     .endfor
>     .for i in ${EGFILES}
>          ${INSTALL_DATA} ${WRKSRC}/${i} ${EGDIR}
>     .endfor
> 
> How about introducing two special variables for simplifying the above code?
> 
>     PKG_DOC_FILES=        README COPYRIGHT NEWS ChangeLog
>     PKG_EXAMPLE_FILES=    example1.conf example2.conf

I'd like to make this a bit more generic, so that we can do some more 
things with it that are often needed. The usage pattern would be similar 
to that of the SUBST framework. Of cource, for the two cases you 
mentioned (doc and examples), it should be exactly as short as you proposed.

INST_GROUPS
         A list of group names. For each of these groups, some files are
         installed into a subdirectory of ${PREFIX}.

INST_FROM.${g}
         The subdirectory of ${WRKSRC} from where the files are taken.
         Defaults to ${WRKSRC} itself.

INST_TO.${g}
         The subdirectory of ${PREFIX} where the files are installed.
         No default value.

INST_FILES.${g}
         The list of files that are installed. May include globbing
         patterns.
         No default value.

Roland