Test for rpm variable
Greg_Swift at aotx.uscourts.gov
Greg_Swift at aotx.uscourts.gov
Tue Apr 6 15:51:59 UTC 2010
> How can I test if %{__global_cflags} is defined?
>
> I want something in my spec along these lines.
>
> CFLAGS=''"
> CFLAGS = "%{__global_cflags}" if(defined %{__global_cflags})
> CFLAGS = "$CFLAGS my custom arguments here"
I haven't actually tried either of these, so they may not be 100%
functional, but might point you the right direction.
Populating %{cflags} macro:
%{?__global_cflags: %define cflags %{__global_cflags} my custom arguments
here}
And here is a method of doing what you were showing above
%if 0%{?__global_cflags} != 0
CFLAGS = "%{__global_cflags} my custom arguments here"
%endif
Or even more simply:
CFLAGS = "%{?__global_cflags} my custom arguments here"
which works because it doesn't put anything if %{__global_cflags} is not
defined.
Someone else might be able to give you a better method, but I don't deal
with much in the realms of compiled RPMs, I'm mainly python or repackaging
closed source binaries.
-greg
More information about the Rpm-list
mailing list