7

I am trying to work my way around with the BuildPrereq flag in the spec files. I want a few pre-requisites to be included if the OS is of a particular version. something like

if os == fedora 4
 BuildPrereq >= apr0.9
endif

if os == feodra 10
 BuildPrereq >= apr2.0
endif 

Is there any way to achieve the above ? Also I would like to hear some alternatives on this. The problem being i have a section of the code which is not required to be compiled on a few versions of OS. So i am looking at mixing conditional compilation and the above.

Cheers!

1 Answer 1

7

To translate what you wrote directly into specfile macros:

%if 0%{?fedora} == 4
BuildPrereq >= apr0.9
%endif 
%if 0%{?fedora} == 10
BuildPrereq >= apr2.0
%endif

You could probably change the first %endif to an %else but I wanted to keep my rewrite as similar as possible in case there are other circumstances involved.

If you want to support versions of fedora between fc4 and f10 or later, you can use >= and <= as well. If you care about RHEL, there's a %{rhel} that evaluates as 4 for RHEL4 and 5 for RHEL5.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .