Search code examples
c++compilationrpmrpmbuildrpm-spec

RPM weak dependencies


In my RPM spec file I have declared that my software package requires a C++ compiler to build:

BuildRequires: gcc-c++

Now I want to make it possible to build this package using devtoolset-8 (or even clang in the future). How can I make the dependency resolver to fail if none of gcc-c++ nor devtoolset-8 have found? I am looking for some sort of OR requirements:

BuildRequires: ( gcc-c++ || devtoolset-8 ) # ?

Solution

  • RPM > 4.13 has support for boolean dependencies. You can just give,

    BuildRequires: (gcc-c++ or devtoolset-8)
    
    

    It's documented here, https://rpm.org/user_doc/boolean_dependencies.html