From Fedora Project Wiki

< User:Tibbs

Revision as of 18:52, 29 January 2015 by Tibbs (talk | contribs)

BuildRequires

It is important that your package list all necessary build dependencies using the BuildRequires: tag. You may assume that you have everything necessary for RPM to function and process your spec file(so of course RPM is present, along with redhat-rpm-config and what is necessary for rpm to apply patches, unpack archives, and run the shell scripts which make up the spec file sections.) You should not assume any other packages are present, as RPM dependencies and anything brought into the buildroot by the build system may change over time.

During package development, it usually suffices to build your packages with rpmbuild or "fedpkg local" but keep in mind that this will make use of the packages on your system and does not test that you have the correct build dependencies specified. Use "fedpkg mockbuild" to build a package locally in a clean environment or use "fedpkg scratch-build" to use the build system, but even then keep in mind that you should still double check your BuildRequires: because your package may still rely on the particular makeup of the build environment.

Note also that it is not simply sufficient that your package builds successfully in mock or the build system, because some programs may change behavior depending on what is installed when they are built. You need to double-check such things as configure script output to ensure that the package is building as you intend.

BuildRequires and %{_isa}

You MUST NOT use arched BuildRequires. The arch ends up in the built SRPM but SRPMs need to be architecture independent. For instance, if you did this:

# Example of what *not* to do
BuildRequires:	python%{?_isa} >= 2.7

Then the SRPM that is built in Fedora would have one of these Requirements depending on what builder the SRPM was created on:

python(x86-32) >= 2.7
# or
python(x86-64) >= 2.7

This would prevent yum-builddep or similar tools that use the SRPM's requirements from operating correctly.

BuildRequires based on pkg-config

Fedora packages which use pkg-config to build against a library (e.g. 'foo') on which they depend, SHOULD express their build dependency correctly as pkgconfig(foo). For more information, see Packaging:PkgConfigBuildRequires.