Differences between revisions 133 and 134
Revision 133 as of 2022-12-16 00:17:00
Size: 23187
Editor: IanJackson
Comment: Expand on request to consult -devel
Revision 134 as of 2022-12-16 03:03:37
Size: 23252
Editor: PaulWise
Comment: link to the discussions too
Deletions are marked like this. Additions are marked like this.
Line 320: Line 320:
If you would like to introduce new profile, please consult debian-devel@lists.debian.org.
Try to capture the conclusions from that discussion here on this page.
If you would like to introduce new profile, please consult DebianList:debian-devel.
Try to capture the conclusions from that discussion here on this page and
link to the discussions from the documentation of the new profile

Document status

Preliminary support of this spec was implemented in.




vcs commit











python-apt (dep on libapt)


git:419ac4d0, git:921a75d9


















devscripts (mk-build-deps)



git:718fa762, git:118fa762











git:fd343efd, git:fd343efd5





Problem description

For some compilation scenarios it is required to build-depend on a different set of binary packages than specified in the Build-Depends line. The two most important scenarios are:

  • Bootstrapping (for breaking build dependency cycles) and

  • Cross building (for source packages having different build dependencies during cross building than during native building)

This specification describes an extension of the Build-Depends field syntax. The extensions allow the marking of build dependencies as being needed or not needed when one or more build profiles are activated. It also defines a new field called "Build-Profiles" which, depending on the context marks binary packages as being built or not built with a certain set of build profiles activated or marks binary packages as having been built with a certain set of build profiles activated.

Build profiles can be activated by setting the environment variable DEB_BUILD_PROFILES or by using the -P option with dpkg-buildpackage (or -o Apt::Build-Profiles for apt, or --profiles in sbuild). More than one build profile can be activated at a time. Multiple profiles are specified by separating them with commas in commandline arguments and by separating them with spaces in the DEB_BUILD_PROFILES environment variable. Some common profile names are "nocheck", "nodoc", "nobiarch" and "cross".

Build-Depends syntax extension (restriction formulas)

An example demonstrating the restriction formula syntax for build profiles:

Build-Depends: foo (>= 1.0) [i386 arm] <!nocheck> <!cross>, bar

This specification introduces a new pair of brackets (using < as the opening and > as the closing bracket) to be used after the optional architecture restriction list. The < and > brackets enclose a whitespace separated list of terms called a restriction list. But in contrast to architecture qualification there can be multiple < and > enclosed restriction lists. The list of restriction lists is called a restriction formula and individual restriction lists are separated by whitespace. Just as the version specification and the architecture restriction list, the restriction formula is optional and attached to a single package name.

Every term in a restriction list refers to the name of a build profile (see above for a list). Terms can be negated by using an exclamation mark as a prefix just as architectures in the architecture qualification list. In contrast to the architecture qualification list, positive and negative terms are allowed to be mixed.

The terms arranged as a restriction formula form a disjunctive normal form expression. This is, each term within a restriction list is AND-ed together while the restriction lists in a restriction formula are OR-ed together. This also means that the order of terms within restriction lists and the order of restriction lists within a restriction formula does not matter. A term evaluates to "true" if the profile with the same name was set for the build. It defaults to false if the profile was not set. In the example above, the package would depend on foo for i386 or arm and if neither the profile nocheck nor the profile cross are active.

Second example:

Build-Depends: foo <nocheck cross>

In this case, the source package would build depend on foo only if both, the profile nocheck and cross are active.

Third example:

Build-Depends: foo <nocheck cross> <nocheck>

In this case, the source package would build depend on foo if either both, nocheck and cross are active or if the profile nocheck is active. This means that the dependency is not applied if the profile cross alone is active. The last example can also be rewritten to this alternative form which is equal in meaning:

Build-Depends: foo <nocheck cross>, foo <nocheck>

In other words, if a build dependency is annotated with a restriction formula, then that build dependency is included if and only if the condition expressed by the conjunctive normal form expression evaluates to true.

The Build-Profiles field

In debian/control binary package stanzas, the content of the Build-Profiles field specifies the condition for which that binary package does or does not build. To express that condition, the same restriction formula syntax from the Build-Depends field is used.

Build-Profiles: <!cross> <!nocheck>

If a binary package stanza in a debian/control file does not contain a Build-Profiles field, then it implicitly means that it builds with all build profiles (including none at all).

In other words, if a binary package stanza in debian/control is annotated with a non-empty Build-Profiles field, then that binary package is generated if and only if the condition expressed by the conjunctive normal form expression evaluates to true.

Here an example for debian/rules for source packages using debhelper to conditionally create certain artifacts:

DOPACKAGES := $(shell dh_listpackages)

binary-arch: build
ifneq (,$(filter mypackage1,$(DOPACKAGES)))
    # create artifacts for mypackage1
ifneq (,$(filter mypackage2,$(DOPACKAGES)))
    # create artifacts for mypackage2

The Built-For-Profiles field

In *.changes (and previously in Packages files but not anymore since dpkg 1.18.19), the content of the Built-For-Profiles field specifies the white space separated list of build profiles with which that binary or source package was built.

The DEB_BUILD_PROFILES environment variable

The DEB_BUILD_PROFILES environment variable contains a space separated unordered list of activated profiles. The content of this variable must be honored by all tools involved in package compilation. Here an example for debian/rules (enabling sql for any build except stage1 profile - notice the negated test):

ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
    DH_OPTIONS += -Nlibdb5.1-sql # not needed with debhelper (>= 9.20140227)
    CONFIGURE_SWITCHES += --disable-sql
    CONFIGURE_SWITCHES += --enable-sql

The Package-List field

The fifth item from lines in the Package-List field gains another key value called "profile". For each binary package that conditionally builds with certain build profiles enabled, the value belonging to the "profile" key indicates the condition under which the respective binary package is built. The restriction formula format differs from the format used in the build dependencies and Build-Profiles field. Terms of the restriction list are AND-ed together using a comma and they are OR-ed together using a plus. So for a binary package foo with the following Build-Profiles field

Build-Profiles: <cross !nocheck> <nopython>

The value of the "profile" key in the fifth field of the Package-List field for that binary package foo might look like this:


For a possible whole line in the Package-List field like this:

foo deb misc extra arch=any profile=cross,!nocheck+nopython

Profile built binary packages

A binary package must contain the exact same content for all profiles with which it builds including no activated profile at all (if it builds in that case). Otherwise a package depending on that binary package might not find the functionality or data it expects it to provide. This means that if necessary binary packages have to be split or that a source package has to be built in two stages. This requirement can not technically be checked before ReproducibleBuilds happen.

This requirement does not apply if the "stage1" or "nodoc" profile is active. In this case, only the parts of the package that expose a functional interface (scripts, programs, libraries, headers) must not be different. Non-functional interfaces like documentation can be different or missing in the produced binary packages.


Imagine src:foo depends on bar which is needed to build a plugin that is shipped together with other plugins in the package foo-plugins. When bar is made optional as a build dependency of src:foo in a pkg.foo.nobar build, then the resulting pkg.foo.nobar binary package foo-plugins would differ from the foo-plugins package that is created during a full build. Thus the creation of the foo-plugins binary package must be disabled by using the Build-Profiles field in the foo-plugins binary package stanza and by adding the necessary bits to debian/rules for packages without debhelper or when build depending on debhelper (>> 9.20140227) is not desired.

If foo-plugins has reverse dependencies which are part of a cycle with src:foo itself, then not building foo-plugins would not solve the bootstrap problem. In that case it is necessary to either:

  • split the foo-plugins package into foo-plugins-nobar and foo-plugins-bar and adjust *all* reverse dependencies of foo-plugins to correctly depend on foo-plugins-nobar and foo-plugins-bar

  • or create a package foo-plugins-nobar during a pkg.foo.nobar build and modify only the reverse dependencies that are in a cycle with src:foo to build depend on foo-plugins-nobar in their own pkg.foo2.nobar build. When src:foo is built fully, it will not produce foo-plugins-nobar anymore but the full foo-plugins package instead.


The final goal is to allow a fully automated bootstrap where a buildd is able to bootstrap the whole archive for a specific architecture without any manual intervention. This is only possible if reverse dependencies of any binary package continue to be able to rely on its content being the one they expect no matter how the binary package was created. If this cannot be guaranteed, then a dependency solver will choose an installation set which does not satisfy the actual dependencies of a package and the bootstrap will fail. Just as it is necessary for multiarch, this often means the addition of more binary packages. In the case of bootstrapping, those binary packages might even only be useful during the bootstrap process itself. For example, the dependency cycle between src:gamin and src:glib2.0 can be solved by letting src:glib2.0 build an additional package libglib2.0-stage1-dev which does not include gamin on which src:gamin can then build depend upon during a stage1 build. While the temporary package libglib2.0-stage1-dev is very short lived, there can be situations where the stage1 package needs to be around for a long time. One example are the binary packages built by glibc stage2. While these can be built very early, the full glibc can only be built once audit and systemtap are available which come much later. Without those temporary, differently named, stage1 packages, another package might accidentally use a not fully built binary package to satisfy its dependencies. This is especially likely to happen for long lived stage1 binary packages. The only alternative to introducing temporary stage1 binary packages, would be to change the dependency system to include the information for which build profiles a binary package is built. But this is unlikely to happen due to the intrusiveness of such a change.

Registered profile names

The profile names used is a distribution specific policy. Ideally Debian derivatives should use the same profile names registered in Debian so that there's consistency, but otherwise most of the tools do not care about the names or its semantics, only the packages making use of them.

The current prospective list of registered profile names in Debian is:








Can be used to add extra dependencies for cross-compilation. Usually used when a package would build depend on it self. If the set of binary packages built changes, then it should be combined with another profile.




Extension namespace. Can be used whenever the maintainer of $sourcepackage agrees to the use. $anything must match the following regex [a-z0-9-]+




Deprecated. Use a descriptive profile below or from the extension namespace instead. Must reduce Build-Depends. Must not be used outside of the very early cross-compiler bootstrap phase (gcc, glibc, linux)




Deprecated. Use a descriptive profile below or from the extension namespace instead. Should not be necessary for packages other than glibc or gcc.




No multilib packages should be built.




No test suite should be run, and build dependencies used only for that purpose should be ignored. Builds that set this profile must also add nocheck to DEB_BUILD_OPTIONS




Disable CIL (Common Intermediate Language) bindings, as used by the Common Language Infrastructure, Mono, .NET and C#




No documentation should be included or built into packages. Builds that set this profile must also add nodoc to DEB_BUILD_OPTIONS




Disable bindings for the Go programming language




Disable binary packages consisting entirely of automated tests, manual tests, example/demo programs and test tools




Disable Java bindings




Disable Perl bindings




Disable Python bindings (all versions)




Disable Ruby bindings (all versions)




Disable Lua bindings (all versions)




Disable Guile bindings




Disable ocaml bindings




Disable Wasm components




Disable Windows components (can include anything using the Windows ABI, all versions)




Inhibit building udebs


Whether the content of individual binary packages may change when activating this profile. Values: N (not at all), F (no functional changes, e.g. changes to /usr/share/doc/, /usr/share/locale/ or /usr/share/man/), Y (package contents may change)

Whether the set of binary packages built may change when activating this profile. I.e.: whether this profile name can occur by itself in the Build-Profile field in binary stanzas in debian/control. Values: N (no), Y (yes)

Possible future additions include:





nonls or nointl or noi18n



No i18n support should be built into the package.

Adding new profiles to this registry

If you would like to introduce new profile, please consult debian-devel. Try to capture the conclusions from that discussion here on this page and link to the discussions from the documentation of the new profile.

Other uses for the restriction syntax

Mark build dependencies that need to be translated when cross building

See CrossTranslatableBuildDeps#A3._Use_restriction_syntax_with_new_namespace

Replace Build-Depends-Indep and Build-Depends-Arch

Instead of moving build dependencies needed to build arch:all or arch:any packages into Build-Depends-Indep and Build-Depends-Arch, respectively, mark them directly in the Build-Depends field using <debbuildopt.archindep> and <debbuildopt.archdep>, respectively.

Map DEB_BUILD_OPTIONS to namespaces

Some DEB_BUILD_OPTIONS like nocheck or noopt could be mapped to <debbuildopt.nocheck> or <debbuildopt.noopt>. This would allow not needing to install certain dependencies if certain DEB_BUILD_OPTIONS are active.


A backports profile could adjust build dependencies depending on the Debian release for which the backport is done. A backports profile name would thus have to contain the targetted release. With support from debhelper, even the binary versions could automatically adapted to contain the bpo postfix once a build is done with a backport profile active. This would allow to do backports without forking the packaging.


Interaction with ReproducibleBuilds

As of dpkg 1.18.19, build profiles and reproducible builds should become compatible, as the Built-For-Profiles field will not get emitted any more.

As it stands, build profiles and reproducible builds are inherently incompatible, because at least the Built-For-Profiles field will be added to the generated binary packages. A possible solution to this could be to stop adding those fields, and instead record the active set of build profiles in the *.buildinfo file. This has the inconvenience that the information is not tied to the actual binary package and as such might get lost, and that it's not as easily accessible from the archive Packages indices.

This might also get in the way of possibly setting the build profiles automatically by dpkg-buildpackage on certain DEB_BUILD_OPTION values or other criteria, like when cross-building.

Derivative specific profiles

It is easy to see build profiles as a way to allow the same source package to be used by Debian and its downstreams without modifications. Thus, one might want to propose a mechanism for distribution specific build profiles. Here is a list of reasons why that would be a bad idea:

  • derivative specific profiles do not immediately tell a maintainer what they mean
  • maintainers in Debian would have to start maintaining long lists of derivative names in their packaging
  • disappearing derivatives lead to bitrot in the packaging that use profiles specific to that derivative

Instead, derivatives should make use of the general profile names and propose new ones where required. Downstreams like Devuan for example could make use of a nosystemd profile.


  1. Ideally N (1 2)