Re: %if

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/16/06, Marcus Habermehl (BMH1980) <bmh1980de@xxxxxxxx> wrote:

And this is the code from my /etc/rpm/macros file.

%ifdef %{prefix}
    %_prefix            %{prefix}
%else
    %_prefix            /usr
%endif


If in /etc/rpm/macros, existence tests are tricky, recursion on macros
needs to be avoided.

Your example looks like
    %_prefix  %{?prefix}%{!?prefix:/usr}
in /etc/rpm/macros.

In a spec file, the above would look like
   %define _prefix  %{?prefix}%{!?prefix:/usr}
of (arguably more readable but using %if)

   %if %{?prefix:1}0
       %define _prefix            %{prefix}
   %else
       %define _prefix            /usr
   %endif

Note that %prefix is set as a side effect of Prefix: parsing, just
like Name: sets %name, Version sets %version, etc, etc.

73 de Jeff

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux