]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- new macros: %defined, %undefined, %ifdef, %ifndef, %bcond_with and
authorMichal Moskal <michal@moskal.me>
Tue, 20 May 2003 21:26:28 +0000 (21:26 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  %bcond_without (last two from wiget, others from jbj)

Changed files:
    rpm.macros -> 1.116

rpm.macros

index 66f9c4b304c8789e7cca65b42181c09c3237002e..a247fc6fe1b620ed6d617063b5686d27c7d9e03a 100644 (file)
        --infodir=%{_infodir} \
 }
 
+# ------------------------------------------------------------------------
+# Conditional build stuff.
+
+# Check if symbol is defined.
+# Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
+%defined()     %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%undefined()   %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+
+# Shorthand for %if %{defined ...}
+%ifdef()       %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%ifndef()      %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+
+# Handle conditional builds. %bcond_with is for case when feature is
+# default off and needs to be activated with --with ... command line 
+# switch. %bcond_without is for the dual case.
+#
+# %bcond_with foo defines symbol with_foo if --with foo was specified on
+# command line.
+# %bcond_without foo defines symbol with_foo if --without foo was *not* 
+# specified on command line.
+#
+# For example:
+#
+# %bcond_with extra_fonts
+# %bcond_without static
+# %ifdef with_extra_fonts
+# ...
+# %endif
+# %ifdef with_static
+# ...
+# %endif
+# %{?with_static: ... }
+# %{!?with_static: ... }
+# %{?with_extra_fonts: ... }
+# %{!?with_extra_fonts: ... }
+# 
+# The bottom line: never use without_foo, _with_foo nor _without_foo, only
+# with_foo. This way changing default set of bconds for given spec is just
+# a matter of changing single line in it and syntax is more readable.
+%bcond_with()          %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
+%bcond_without()       %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
+# ------------------------------------------------------------------------
+
 # Location of autoconf macros
 %_aclocaldir   %(aclocal --print-ac-dir)
 
This page took 0.099004 seconds and 4 git commands to generate.