From Fedora Project Wiki

Revision as of 23:35, 9 February 2010 by Till (talk | contribs) (proposal to update RPMMacros)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I propose the following changes:

  • Use an admon/important template to highlight the differences in EPEL 4 & 5
  • change %{_optflag} to %{optflag}, which seems to be right according to rpm --evaland was mentioned in the discussion page of the original site
  • Do not mention Fedora 10 or older, since it is EOL
  • Do not call Fedora 11 "Fedora Core 11", Core and Extras merged


Valid RPM Macros

Here are the definitions for some common specfile macros as they are defined on Fedora 11 (rpm-4.7.0-1.fc11). For definitions of more macros, examine the output of "rpm --showrc". To see the expanded definition of a macro use the command rpm --eval "%{macro}". Note that neither command will take into account macros defined inside specfiles, but both will take into account macros defined in your ~/.rpmmacros file and macros defined on the command line.

Keep in mind that some of these macros may evaluate differently on older Fedora or EPEL releases.

Macros mimicking autoconf variables

%{_sysconfdir}        /etc
%{_prefix}            /usr
%{_exec_prefix}       %{_prefix}
%{_bindir}            %{_exec_prefix}/bin
%{_lib}               lib (lib64 on 64bit systems)
%{_libdir}            %{_exec_prefix}/%{_lib}
%{_libexecdir}        %{_exec_prefix}/libexec
%{_sbindir}           %{_exec_prefix}/sbin
%{_sharedstatedir}    /var/lib
%{_datadir}           %{_prefix}/share
%{_includedir}        %{_prefix}/include
%{_oldincludedir}     /usr/include
%{_infodir}           /usr/share/info
%{_mandir}            /usr/share/man
%{_localstatedir}     /var
%{_initddir}          %{_sysconfdir}/rc.d/init.d
Important.png
Differences in EPEL 4 & 5
  • %{_initddir} does not exist in EPEL 4 & 5, use the deprecated %{_initrddir} macro instead
  • %{_sharedstatedir} expands to %{_prefix}/com in EPEL 4 & 5

RPM directory macros

%{_topdir}            %{getenv:HOME}/rpmbuild
%{_builddir}          %{_topdir}/BUILD
%{_rpmdir}            %{_topdir}/RPMS
%{_sourcedir}         %{_topdir}/SOURCES
%{_specdir}           %{_topdir}/SPECS
%{_srcrpmdir}         %{_topdir}/SRPMS
%{_buildrootdir}      %{_topdir}/BUILDROOT
Important.png
Differences in EPEL 4 & 5
  • %{_buildrootdir} does not exist in EPEL 4 & 5


Build flags macros

%{_global_cflags}     -O2 -g -pipe
%{optflags}          %{__global_cflags} -m32 -march=i386 -mtune=pentium4 # if redhat-rpm-config is installed

Other macros

%{_var}               /var
%{_tmppath}           %{_var}/tmp
%{_usr}               /usr
%{_usrsrc}            %{_usr}/src
%{_docdir}            %{_datadir}/doc

Reference

Here are macros from other distributions to aid you in package conversion: