Subject: Re: Package options
To: Mike M. Volokhov <mishka@apk.od.ua>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 08/19/2004 16:51:12
On Thu, Aug 19, 2004 at 03:07:28PM +0300, Mike M. Volokhov wrote:
>
> At this moment, mk/bsd.options.mk defines nice framework for various
> package options, but it is recommended to use the following addition
> before:
>
> # Global and legacy options
> .if defined(USE_FOO)
> . if !defined(PKG_OPTIONS.somepkg)
> . if defined(USE_FOO) && !empty(USE_FOO:M[yY][eE][sS])
> PKG_OPTIONS.somepkg+= foooption
> . endif
> . endif
> .endif
>
> 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.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>