A proposal has been published in the Fedora mailing list proposal for standardizing macros in RPM spec files, allowing the addition of options for compilation flags and additional dependencies during the build stage.
Example usage:
%if %{use ssl}
BuildRequires: openssl-devel
%endif
%prep
%configure %{use_enable ssl openssl}
%check
make test %{?_use_ssl:-DSSL}
In this example, when the USE macro ssl is specified in the spec file, an additional dependency on the openssl-devel package will be added, the configuration step will be executed with the option --enable-openssl enabled, and corresponding tests will be performed during the build.
It is expected that the build option will be specified by the binary macro %_use_ with additional wrappers like:
- %{use } – accepts values 0 or 1,
- %{use_enable [ []]} – expands to --disable- or --enable-.
Adding options of this kind to spec files will allow building different versions of the distribution from the same source code.
For example, to minimize the build dependency tree, a global parameter %{use docs} can be used to disable documentation build.
An appropriate set of options can be configured for the build environment. Options can be specified both globally and overridden separately for each package.
The proposal is not yet accepted and is still under discussion.
Source: linux.org.ru
