当前位置: 代码迷 >> 综合 >> rpm-spec: Conditional macro expansion
  详细解决方案

rpm-spec: Conditional macro expansion

热度:32   发布时间:2024-03-08 02:55:13.0

本文展示rpm spec中, 条件宏 定义与否, 分别是怎么展开的.

Conditional macro expansion

Undefined macros do not get expanded. In most cases this is not
desirable so conditional macro expansions can be used to deal with
undefined macros. The following table summarizes the expansion of
conditional macros when the “foo” macro is defined and the value
is “bar” or not defined:

Expansion when %foo is

Macro defined as bar undefined
%foo bar %foo
%{?foo} bar <empty string>
%{?foo:fred} fred <empty string>
%{?!foo:fred} <empty string> fred
%{!?foo:fred} <empty string> fred


Macro expansions can be nested:

%define fred %{?foo}%{!?foo:%{bar}}

参考:

http://pkgbuild.sourceforge.net/spec-files.txt

  相关解决方案