Subject: Re: *_OPTIONS for package options
To: Juan RP <xtraeme@netbsd.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 07/24/2004 09:02:50
On Sat, Jul 24, 2004 at 10:03:46AM +0200, Juan RP wrote:
> 
> Looks good, thanks for the work. But could we have only in the pkg Makefiles:
> 
> PKG_SUPPORTED_OPTIONS+= foo bar
> 
> And implement the logic automatically, without having to touch the pkg Makefile
> for this? I mean, if we add PKG_SUPPORTED_OPTIONS into the pkg Makefile, still
> we have to add the logic into the Makefile, right?
> 
> I would like to make this automatically, for example as grant said before, e.g:
> 
> # package	# category	#pkg-option
> 
> openldap		databases	ldap
> cyrus-sasl2	security		sasl2
> ...
> 
> And the logic could be implemented into bsd.options.mk and not into the pkg
> Makefile.
> 
> What do you think about this?

I don't see how we can implement this without touching the package
Makefile.  The package Makefile must contain the logic for actually
using the selected build options, e.g.

	.if !empty(PKG_OPTIONS:MPAM)
	.  include "../../security/PAM/buildlink3.mk"
	CONFIGURE_ARGS+=	--with-pam
	.endif

So we clearly can't remove those sections of the package Makefiles.

As for the rest, all that a package Makefile really needs to do is
to put the following two lines somewhere before the option logic:

	PKG_SUPPORTED_OPTIONS=	foo bar
	.include "../../mk/bsd.options.mk"

The header of the example ("Global and legacy options") shown in
bsd.options.mk is there solely to provide backwards-compatibility for
using the old options, until we can deprecate and remove all instances
of them.

I think this is about as succinct as I can make it for the package
developer to use.

Or perhaps I'm not understanding the idea you're putting forth.  Could
you explain that to me again, with an example showing how your idea
would work in practice?

	Thanks,

	-- Johnny Lam <jlam@NetBSD.org>