Subject: Re: Alternatives in the same package
To: Mike M. Volokhov <>
From: Quentin Garnier <>
List: tech-pkg
Date: 04/20/2005 16:23:36
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 20, 2005 at 04:34:18PM +0300, Mike M. Volokhov wrote:
> > You can test on ${PKG_OPTIONS} and then set PKG_FAIL_REASON.
> It's suboptimal for a big number of mutex options (in this case a
> number of tests will grew up by exponential regression), but it's
> needed very rare. I've asked just for the future.

make(1) doesn't offer the possibility to do such a check easily,
that's for sure.  So wherever is the logic, i.e. in pkgsrc/mk or
not, it will be the same.

When I thought about this for devel/rt3, I wanted to use the :[#]
modifier, but it is not available in 1.6 make.

Now, here's what I'm tempted to commit, knowing that the options
starting with "frontend-" are mutually exclusive, as are the ones
starting with "backend-".  A bit convoluted, but it works.  It
needs a special way of naming options, though, but you can always
add a translation step.

=2Efor _option_ in backend frontend
=2E if empty(PKG_OPTIONS:M${_option_}-*)
PKG_FAIL_REASON+=3D "There must be one ${_option_} defined."
=2E else
_RT_DUMMY:=3D     # empty
=2E  for _dummy_ in ${PKG_OPTIONS:M${_option_}-*}
_RT_DUMMY:=3D     ${_RT_DUMMY}+
=2E  endfor
=2E  if ${_RT_DUMMY} !=3D +
PKG_FAIL_REASON+=3D "There must be no more than one ${_option_} defined."
=2E  endif
=2E endif

Quentin Garnier - -
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.6 (NetBSD)