Subject: Re: Package options
To: None <tech-pkg@NetBSD.org>
From: Mike M. Volokhov <mishka@apk.od.ua>
List: tech-pkg
Date: 08/20/2004 09:55:10
On Thu, 19 Aug 2004 16:51:12 +0000
"Johnny C. Lam" <jlam@NetBSD.org> wrote:
> On Thu, Aug 19, 2004 at 03:07:28PM +0300, Mike M. Volokhov wrote:
[snip]
> > Why not define this in more generic form and then include into
> > bsd.options.mk in the such way:
> >
> > --- package makefile ---
> > PKG_OPTIONS_VAR= PKG_OPTIONS.somepkg
> > PKG_SUPPORTED_OPTIONS= foo bar
> > .include "../../mk/bsd.options.mk"
> >
> > --- in bsd.options.mk ---
> > .for _PKG_OPTION in PKG_SUPPORTED_OPTIONS
> > . if defined(USE_${_PKG_OPTION:tu})
> > . if !defined(${PKG_OPTIONS_VAR})
> > . if defined(USE_${_PKG_OPTION:tu}) && !empty(USE_${_PKG_OPTION:tu}:M[yY][eE][sS])
> > ${PKG_OPTIONS_VAR}+= ${_PKG_OPTION}
> > . endif
> > . endif
> > . endif
> > .endfor
> >
> > Any comments please?
>
> This was a design decision -- I explicitly did not add this to
> bsd.options.mk when I wrote it so that developers have to decide
> exactly which options they want support, and how they want to support
> it.
It just converts USE_FOO=yes to PKG_OPTIONS.somepkg+=foo. If developers
need support something in more extended way, of course it is possible to
wrote such constructions manually. This also means, that USE_BAR may
didn't match "yes" and may not be converted to PKG_OPTIONS.somepkg+=bar
- developers are free to hadle it manually. But bsd.options.mk seems
allows boolean options only, and it's just covenience to know that you
may use USE_-like variable for all PKG_OPTIONS.
--
Mishka.