Subject: Re: building different package names from PKG_OPTIONS
To: Jeremy C. Reed <reed@reedmedia.net>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 12/17/2005 07:00:24
On Fri, Dec 16, 2005 at 05:57:15PM -0800, Jeremy C. Reed wrote:
> 
> 1) Have an option that adds the PKG_OPTIONS to the package name.
> 
> 2) pkg tools and infrastructure recognize the new naming
> 
> 3) Have a build option that says to build package using all PKG_OPTIONS to 
> create package

At pkgsrcCon 2005, Roland Illig had an idea that I *really* liked,
which was to add package options to the package name using "+option".

My recollection of our discussion is that package names would look
like this:

	sox-12.17.7
	sox-12.17.7+mp3
	sox-12.17.7+vorbis
	sox-12.17.7+mp3+vorbis

This scheme involves reserving the "+" sign for this naming scheme,
which is not too bad, considering there is only one package (IIRC) in
pkgsrc that has "+" in the name (openssh+gssapi).  The nice thing
about this particular naming scheme is that you can easily strip off
the options to get the base package name and version number -- an
"+option" bit is always a suffix.  This simple naming scheme hopefully
makes it relatively easy to extend the pkg_install tools to understand
the new package names because you just strip off the "+option" bits
and leverage the existing code.

The tricky part which none of us have thought through at the time
was to properly extend the dewey naming to allow depending on a package
with a particular option, e.g. "sox with mp3 support".  I believe that
we could do something like:

	DEPENDS+=	sox>=12.17+mp3:../../audio/sox

which would allow the following package to match:

	sox-12.17.7+mp3
	sox-12.17.7+mp3+vorbis

Now that the use of package options is more prevalent in pkgsrc, this
would be a great time for someone to implement this idea on a separate
branch so we could test and refine this idea further.

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>