patch only if dependent version < x? (rpm spec)

Ville Skyttä ville.skytta at
Tue Jun 7 17:53:35 UTC 2011

On 06/07/2011 11:52 AM, Mattias Ellert wrote:

> You can do it on the version of the software. If it has a pkg-config
> file you can do something like this (taken from an existing specfile in
> Fedora):
> %prep
> %setup -q
> %if %(pkg-config --max-version 2.1.2 ftgl 2>/dev/null && echo 1 || echo 0)
> %patch0 -p1
> %endif

BTW there's no need to use rpm macros for stuff like that in %prep,
simply use the shell:

%setup -q
if pkg-config --max-version 2.1.2 ftgl; then
%patch0 -p1

More information about the devel mailing list