On Tue, 01 Mar 2005 19:37:33 -0600, Tom 'spot' Callaway wrote:
Lets say I whip up some macros that define %{rhel}, %{fedora}, and %{rhl}, if they are relevant, with the appropriate numeric version.
What would the conditionals look like?
Examples, assuming %rhel is defined only on Red Hat Enterprise Linux, %fedora is defined only on Fedora Core, %rhl is defined only on Red Hat Linux:
# Do something special for RHEL. %if 0%{?rhel} # ... %endif
# Do something for FC4 and beyond. %if "%fedora" >= "4" # ... %endif
# One-liners, here set a default switch. %{?fedora:%define _with_xfce --with-xfce}
# Logical AND, do something for RHEL and RHL. %if 0%{?rhel} %if 0%{?rhl} # ... %endif %endif
# Logical OR, do something for either RHL or Fedora. %if 0%{?rhl}%{?fedora} # ... %endif
# Safer version, in case %rhl or %fedora expand to something non-numerical. %if 0%{?rhl:1}%{?fedora:1} # ... %endif
# Logical NOT, don't do something for RHEL %if 0%{!?rhel} # ... %endif
rpmbuild --rebuild --define "rhel 3" blubb.src.rpm