I'll use an example to show what I mean, since it's hard to explain.
I have a spec
file that is used for native and cross-compiling. I have many variables being passed to rpmbuild
using the --define
option. I'd like a macro that would be the equivalent of this:
%{?myvar:myvar=%{myvar}}
So, iff myvar
exists, I want it to expand to myvar=%{myvar}
which then would be myvar=myval
.
I tried playing with %{expand:}
a little (src), but ran into trouble when I had more than one parameter. Since it seems a macro's parameters go to EOL, and I need them all on one line in the final output, that also becomes a requirement.
I don't know lua
, which might help to iterate over the various parameters, e.g.:
%expvar myvar1 myvar2 myvar3
=> myvar1=myval1 myvar2=myval2 myvar3=myval3
Thanks for any ideas!