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

Richard W.M. Jones rjones at redhat.com
Mon Jan 20 15:56:54 UTC 2014

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:


Also there's a bug open to make these flags work from 'fedpkg local':


> According to the Packaging Guidelines we're not supposed to use those
> parameters when building "the source RPM to be submitted", because they
> somehow get "serialized" into the source package. I don't understand
> this, because I don't submit any source packages.

Yeah I don't understand this either.  I didn't know it was possible to
submit an SRPM directly (except for scratch builds), and if there is
it doesn't sound desirable.

> The source package gets built on a Koji server when I run "fedpkg
> build", and I don't know of a way to pass any options to that
> process.

There isn't .. and shouldn't be, since you'd want 'fedpkg build' to
build exactly one RPM variant.

However for 'fedpkg local' these flags could be pretty useful, see


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

More information about the devel mailing list