RPMbuild mystery parameters "--with" and "--without"

Panu Matilainen pmatilai at laiskiainen.org
Mon Jan 20 19:00:49 UTC 2014

On 01/20/2014 05:56 PM, Richard W.M. Jones wrote:
> On Mon, Jan 20, 2014 at 03:24:12PM +0100, Björn Persson wrote:
>> Apparently RPMbuild has a pair of parameters "--with" and "--without"
>> that can supposedly enable and disable optional features in a package.
>> Has anyone seen any documentation that explains how those work and how
>> they interact with a spec file?
>> I want to be able to easily switch an option between these two states:
>> · off by default but can be enabled with "--with"
>> · on by default but can be disabled with "--without"
>> What's a good way to code that in the spec?
> They are (IMHO) very confusing to implement.  However have a look at a
> the libvirt spec file for a working example:
>    http://pkgs.fedoraproject.org/cgit/libvirt.git/tree/libvirt.spec

The confusion with bcond comes from the fact the logic seems entirely 
backwards. Which it kinda is, until one learns the logic behind it:

"%bcond_with foo" adds support for "--with foo" build option to the 
spec. Which also happens to mean that the default is "without" - why 
else would you need a --with option? And conversely, "%bcond_without 
foo" adss "--without foo" build option, effectively also saying default 
is "with".

The fact that *everybody* is (at least initially) confused about it says 
something about the intuitiveness of the feature ... or lack of thereof :)

	- Panu -

More information about the devel mailing list