Defines for detecting build OS?

Greg_Swift at aotx.uscourts.gov Greg_Swift at aotx.uscourts.gov
Tue Mar 3 16:39:45 UTC 2009


> Hi there.  My apologies if this is something that's covered in
> documentation somewhere... but, due to the inability to google for
> punctuation, I'm finding it a bit hard to locate the appropriate
> docs.  I've done what I think is a reasonable amount of manual
> searching of documentation without coming up with anything.

I had the same question.

> I often see spec files that reference defines which appear to be set
> by the OS... for example, phrases like "%if 0%{?rhel}".  Where are
> these defined?  I can't find references in the files in /usr/lib/rpm/
> or /etc/rpm/, and can't see a list of these defines in the available
> documentation.

This is what I've gathered:

In Fedora there is a file /etc/rpm/macros.dist that comes with the
fedora-release package.  It defines (this is for fedora 8, increment
accordingly):

%fedora    8
%dist      .fc8
%fc8       1

For EPEL (the extra packages for enterprise linux) I was told the build
system provides the macro definitions.  The ones i've seen are (basing on
5, change accordingly):

%rhel 5
%dist .el5

I recently put in a bug requesting the same macros.dist file for any RHEL
they would be willing to add it to
(https://bugzilla.redhat.com/show_bug.cgi?id=481023).

The only thing I've seen for SUSE was a %{is_suse} in the func packages.  I
doubt thats what they actually use internally.

The %if 0%?{rhel} ... basically translates so that if %rhel isn't defined
you still have a 0 to use in the equation.

> Is there a relatively complete list of these defines somewhere?  Is
> there a config file in each RPM-using OS where a local one is
> defined?  Pointers would be quite welcome.

anyone else? I'd love to know myself.

-greg



More information about the Rpm-list mailing list