RFC: spec preprocessor

Artur Frysiak wiget at koelner.com.pl
Wed May 21 08:57:20 CEST 2003


On Tue, May 20, 2003 at 11:18:07PM +0200, Michal Moskal wrote:
> On Tue, May 20, 2003 at 05:07:05PM +0200, Artur Frysiak wrote:
> > W liście z wto, 20-05-2003, godz. 15:44, Michal Moskal pisze: 
> > > On Tue, May 20, 2003 at 02:59:32PM +0200, Artur Frysiak wrote:
> > > Maybe something like:
> > > 
> > > %define bcond_with()	%{expand:%%{?_with_%{1}:%%define %{1} 1}}
> > > %define bcond_without()	%{expand:%%{!?_without_%{1}:%%define %{1} 1}}
> > > 
> > > And then:
> > > 
> > > %bcond_with	foo	# foo inc. support
> > > %bcond_without	bar	# bar fonts support
> > 
> > %define bcond_with()	%{expand:%%{?_with_%{1}:%%global %{1} 1}}
> > 
> > And works.
> > 
> > Any volunteer to describe this in some documentation and implement in
> > /usr/lib/rpm/macros ?
> 
> I'm not quite sure, if symbol to be defined should be name of bcond. For
> example consider --with patch or --with setup or something like this.
> 
> Maybe define with_foo for --with foo or lack of --without foo?

Whats about default value ?
Maybe:
%define bcond() %{expand:%%{?_with_%{1}:%%{?_without_%{1}:%%{error:Bcond colision} exit1}%%global %{1} %%{!?_without_%{1}:%%{?_with_%{1}:1}%%{!?_with_%{1}:%{2}}}0}

And usage:
%bcond foo 1 # foo support

%if %{foo}
%if %{bar}
with foo and bar
%else
with foo and without bar
%endif
%endif

-- 
wiget



More information about the pld-devel-en mailing list