Mailinglist Archive: opensuse-packaging (284 mails)

< Previous Next >
Re: [opensuse-packaging] Where do the macros "BUILD_ORIG" and "BUILD_ORIG_ADDON" come from?
On 01/31/2011 09:16 PM, Tejas Guruswamy wrote:
I'm by no means an expert, but I'm surprised people are packaging
missing this info ... Here's the basics / what I know:

Braces are generally recommended for anything but the most trivial
macros and (possibly) macros with arguments, on their own line.
Define a macro with "%define macro value", use a macro with "%{macro}"
or one of the following:
%{?macro} expands to the value of %macro if %macro is defined, and ""
(empty string) if it isn't.
similarly %{?macro:foo} expands to "foo" if %macro is defined.
and the opposite is %{!?macro:bar} which expands to "bar" if %macro
isn't defined.
These can be nested.

For example I've used
%{?make_install} %{!?make_install:%makeinstall}
which will work if make_install OR makeinstall is defined.

This also should explain the common idiom
%if 0%{?suse_version}
If just "%if %{suse_version}", when trying to build on a non-suse
distro, rpm would complain about an unrecognized macro. If just "%if
%{?suse_version}" was used, rpm would see only %if "" (empty string) and
complain about missing argument to %if.

%{?macro:%macro} is clearly redundant given the above definitions; so in
the above case %{?glib2_gsettings_schema_requires} should be sufficient.
This sounds distro-specific so the leading "?" is a good idea - no
errors on distro's without the macro defined.

I spent quite a few days googling and researching, which lead to me
spending quite a while on fedora's packaging as well, the openSUSE
packaging portal is improving day by day btw.
The bookmark (it was me who changed
the old wiki to point to the snapshot version) I've had for a while
since my first blender maintainance and never found anything about "?".
Your explanation explains why rpmlint complains about "%if %suse_version
<= 1020" but doesn't complain about "%if 0%{?suse_version} <= 1020" rpm
in <= 1020 most probably won't see the macro at all? The invert "!" next
to "?" is a new one, I would only use "!" in "%if ! %{with foo}" does it
invert when used inside the braces to the left of "?"? I don't
understand the usage of the colon ":" inside the macro either, I've seen
it used but it doesn't seem to do anything except obfuscate the macro a
bit more than normal.
Last but not least, like a small boy asking his mother where babies come
from, where is "BUILD_ORIG" and "BUILD_ORIG_ADDON" defined, I still
haven't tried an online build %dump but I've looked everywhere else,
including a local factory build with %dump. When I first found the use
of %bcond I could find /usr/lib/rpm /etc/rpm grep and I found a very
good explanation (I was able to fix the original packagers use of it)
but the only answer I've had for the BUILD macros (are they macros?) is
it's there, which to me is the same as "the stork drops them down the
I now fully understand the use of "?".
Thanks very much, knowledge is my heroin.
Dave P
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups