Differences between revisions 8 and 9
Revision 8 as of 2015-09-25 21:32:28
Size: 4430
Editor: TobiasFrost
Comment: it is policy since 3.9.4...
Revision 9 as of 2018-02-07 14:31:06
Size: 0
Comment: Confusing. Lots of outdated information.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''Build-Depends-Indep''' is a field in [[debian/control]] files used to specify dependencies, required to build architecture independent (arch all) packages. These are packages that can be installed on x86, x64, ARM etc. systems without recompilation or any other changes. Such packages usually include Python scripts, documentation, configs, pictures etc.

Packages needed to build the architecture dependent packages must be in build-depends. There is currently no build-depends-arch field though there are proposals to add one (indep only builds are rare however so it's not considered a priority).

It is up to the packager to ensure that the architecture specific packages can be built successfully with only build-depends (and build-essential) installed. Usually this will mean making the build-arch and build-indep targets in debian/rules perform different operations. It is also be advisable to add a build-dependency on "dpkg-dev (>= 1.16.2)" (see below)

== Background and problems with dpkg prior to 1.16.2 ==

Conventionally the files to be placed in packages are built by executing [[debian/rules]] with 'build' argument (target):
debian/rules build

This command will build the files needed for both the architecture dependent and architecture independent packages at once, and people want a way to build only architecture dependent packages. As a result, two optional targets were added to [[debian/rules]] with 'build-indep', 'build-arch' targets to build only architecture dependent and architecture independent packages.
debian/rules build-indep
debian/rules build-arch

If these targets are available then if you want to compile some package for another architecture, you do not need to rebuild all the files for the architecture independent packages (which easily can take a order of magnitude more time to create then the architecture dependent files) just to have them not used.

In theory (and for some time per policy) you could use '''Build-Depends-Indep''' to mention dependencies that are only required to build architecture independent packages. This way you would't have to install these dependencies if building architecture dependent packages, so you wouldn't have to install all the dependencies needed for those files (often the binary dependent files might only need some compiler or other stuff often installed anyway, while documentation or special data often needs much larger program suites).

If this worked, it would be especially useful for the [[autobuilders]], as usually install most dependencies before compiling and remove them afterwards, and do not create architecture-dependent packages at all (though that might change in the near future). It would also reduce the knot of circular (build-)dependencies seen when trying to bootstrap a new architecture.

However, there was no clean way for dpkg-buildpackage to detect if 'build-arch' target were avail is available (as a failed build-indep build not to be retried as build cannot reliably be distinguished from a build-indep not available), so they just call 'build'. Policy says that if there are 'build-indep' or 'build-arch' targets, then 'build' target should call them. This way dpkg-buildpackage still built everything and the majority of package builds (including all builds on buildds) could not benefit from the build-arch and build-indep targets.

Furthermore autobuilders did not install build-depends-indep. Therefore to allow a package to be successfully all packages needed by the build target had to be in build-depends. Packages that could not be autobuilt successfully were considered to by rc buggy by the release team and so in practice the requirements of the auto-builders became "de-facto policy".

A workaround for this issue was to build the documentation in the binary-indep target (since binary-arch was already mandatory and already used by the autobuilders) rather than the build-indep target. However this meant that the documentation generation tools were run as root/fakeroot which was considered to be less than ideal.

After many years of discussions going round in circles a decision was finally made to deal with this issue. Since dpkg-dev 1.16.2 dpkg-buildpackage now checks for build-arch and build-indep targets (a test that is imperfect) and uses them if available. If not it falls back to using the build target.