2

I'm writing a RPM spec file for building my software. The software depends on Crypto++. Crypto++ is named differently on different distributions, for example, on OpenSUSE, I should write

BuildRequires: libcryptopp-devel

But on Fedora, it should be

BuildRequires: cryptopp-devel

Now, how can I unify the two in a single spec file?

Siyuan Ren
  • 1,302
  • 2
  • 11
  • 15

1 Answers1

2

In this case you should be able to use pkgconfig(cryptopp). Packages that use pkg-config can use this syntax in both Fedora and SUSE, but this is a special case with pkgconfig, in other cases you'll need to use conditionals:

%if 0%{?fedora}
BuildRequires: cryptopp-devel
%endif

%if 0%{?suse_version}
BuildRequires: libcryptopp-devel
%endif

%if 0%{?mageia}
BuildRequires: lib64cryptopp-devel
%endif
Vojtech Trefny
  • 16,922
  • 6
  • 24
  • 48