Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.


Building a package archive with a consistant set of compiler and linker options currently requires modification of each single package or the use of wrapper scripts. This specification defines a way to pass/inject these options in the package build process.

Release Note

No specific release note; this will be used as base work for stuff like hardening or optimization for a specific processor.


The set of compiler/linker flags used for building packages is defined in Debian policy:

Currently two approaches are used to build the archive with modified options:

Changing the behaviour at this level has a few disadvantages:

The injection of compiler/linker options should be done in the basic package build tool (dpkg-buildpackage); the debian/rules file should handle passing/overriding the options to the upstream build system.

Similiar implementations do exist for rpm (Fedora, OpenSuse) and the Gentoo build system.

Use Cases



We define a set of macros which are passed from dpkg-buildpackage to the debian build system (debian/rules). The injected flags are collected and passed to the upstream build system in the environment. If any of these flags are already set they are passed unmodified to the debian build system.

dpkg-buildpackage sets these flags to the default values unless the flags are already defined in the environment.

TODO: Identify other build systems not using dpkg-buildpackage and adopt these as well (autopkgtst).

TODO: Make build systems like cdbs comply with this spec.


The implementation itself is trivial, but needs to be done in every source package.

TODO: Examples for debian/rules

LoicMinier: would be nice to have a transition plan; what happens if the parameters are not set? Does the package have the responsability to set them properly? Also, is the package/compiler required to support some specific flags or a specific optimization level like "-g -O2" and what other flags are allowed in these parameters?

MatthiasKlose: Two options for unset parameters: Either do nothing (like many build systems already do), or set those to the default values recommended by Debian policy. Allowed flags: Every flags which gcc can interpret (other compilers like llvm or icc should be compatible with regard to command line options).

Test/Demo Plan

The implementation status of a package can be checked by (automatically) inspecting the debian/rules file for every package which builds architecture dependent packages, or by inspecting the build dependencies of a source package (in the case that a build system supporting the spec is used).

The correctness of the implementation can be checked by inspecting the build logs.

Outstanding Issues

This should highlight any issues that should be addressed in further specifications, and not problems with the specification itself; since any specification with problems cannot be approved.

BoF agenda and discussion

Discussed at UDS/Boston.


DistCompilerFlags (last edited 2008-08-06 16:33:10 by localhost)