Re: options handling when there are LOTS of options

Tobias Nygren <[email protected]>
Newsgroups gmane.os.netbsd.devel.pkgsrc.wip.general
Message-ID <[email protected]>
On Wed, 20 Jan 2010 17:03:50 -0600
"Larson, Timothy E." <[email protected]> wrote:

> Is there a way to make package options take a value, rather than simple binary (present/nonpresent) switches?  I've got a package with over 40 possible drivers. I think it would be a lot easier to take a comma-delimited string and pass it straight to configure since that's the kind of format it's expecting, than to construct such a string from bunches of individual options.  Especially since its configure already supports "all,!driver" syntax.

I think in this case you need to roll your own configuration variable
and not use the options framework at all. I suggest something like this:

.include "../../mk/bsd.prefs.mk"
PKGNAME_ENABLED_DRIVERS?=foo,bar,baz

BUILD_DEFS+=	PKGNAME_ENABLED_DRIVERS

CONFIGURE_ARGS+=	--enable-drivers=${PKGNAME_ENABLED_DRIVERS}

At build time it will generate a message like this:

==========================================================================
The following variables will affect the build process of this package,
pkgname-0.1.  Their current value is shown below:

        * PKGNAME_ENABLED_DRIVERS = foo,bar,baz

You may want to abort the process now with CTRL-C and change their value
before continuing.  Be sure to run `/usr/bin/make clean' after
the changes.
==========================================================================

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.