Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.