next up previous contents index
Next: RPM-related Resources Up: Concise Spec File Reference Previous: The %package Directive   Contents   Index

Subsections

Conditionals

The %ifxxx conditionals are used to begin a section of the spec file that is specific to a particular architecture or operating system. They are followed by one or more architecture or operating system specifiers, each separated by commas or whitespace.

Conditionals may be nested within other conditionals, provided that the inner conditional is completely enclosed by the outer conditional.

The %ifarch Conditional

If the build system's architecture is specified, the part of the spec file following the %ifarch, but before a %else or %endif will be used during the build.

%ifarch i386 sparc

See also: Section [*], page [*]

The %ifnarch Conditional

If the build system's architecture is specified, the part of the spec file following the %ifarch but before a %else or %endif will not be used during the build.

%ifnarch i386 sparc

See also: Section [*], page [*]

The %ifos Conditional

If the build system is running one of the specified operating systems, the part of the spec file following the %ifos but before a %else or %endif will be used during the build.

%ifos linux

See also: Section [*], page [*]

The %ifnos Conditional

If the build system is running one of the specified operating systems, the part of the spec file following the %ifnos but before a %else or %endif will not be used during the build.

%ifnos linux

See also: Section [*], page [*]

The %else Conditional

The %else conditional is placed between a %if conditional of some persuasion, and an %endif. It is used to create two blocks of spec file statements, only one of which will be used in any given case.

%ifarch alpha
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -I ."
%else
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%endif

See also: Section [*], page [*]

The %endif Conditional

An %endif is used to end a conditional block of spec file statements. The %endif is always needed after a conditional, otherwise, the build will fail.

%ifarch i386
make INTELFLAG=-DINTEL
%endif

See also: Section [*], page [*]


next up previous contents index
Next: RPM-related Resources Up: Concise Spec File Reference Previous: The %package Directive   Contents   Index
converted to HTML by Tim Riker