Autres langues

Langue: en

Version: 337403 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)


dpkg-buildflags - returns build flags to use during package build


dpkg-buildflags [option...] command


dpkg-buildflags is a tool to retrieve compilation flags to use during build of Debian packages. The default flags are defined by the vendor but they can be extended/overriden in several ways:
system-wide with /etc/dpkg/buildflags.conf;
for the current user with $XDG_CONFIG_HOME/dpkg/buildflags.conf where $XDG_CONFIG_HOME defaults to $HOME/.config;
temporarily with environment variables (see section ENVIRONMENT).

The configuration files can contain two types of directives:

SET flag value
Override the flag named flag to have the value value.
APPEND flag value
Extend the flag named flag with the options given in value. A space is prepended to the appended value if the flag's current value is non-empty.

The configuration files can contain comments on lines starting with a hash (#). Empty lines are also ignored.


Print the list of flags supported by the current vendor (one per line). See the SUPPORTED FLAGS section for more information about them.
Print to standard output shell (if format is sh) or make (if format is make) commands that can be used to export all the compilation flags in the environment. If the format value is not given, sh is assumed. Only compilation flags starting with an upper case character are included, others are assumed to not be suitable for the environment.
--get flag
Print the value of the flag on standard output. Exits with 0 if the flag is known otherwise exits with 1.
--origin flag
Print the origin of the value that is returned by --get. Exits with 0 if the flag is known otherwise exits with 1. The origin can be one of the following values:
the original flag set by the vendor is returned;
the flag is set/modified by a system-wide configuration;
the flag is set/modified by a user-specific configuration;
the flag is set/modified by an environment-specific configuration.
Show the usage message and exit.
Show the version and exit.


Options for the C compiler. The default value set by the vendor includes -g and the default optimization level (-O2 usually, or -O0 if the DEB_BUILD_OPTIONS environment variable defines noopt).
Options for the C preprocessor. Default value: empty.
Options for the C++ compiler. Same as CFLAGS.
Options for the Fortran compiler. Same as CFLAGS.
Options passed to the compiler when linking executables or shared objects (if the linker is called directly, then -Wl and , have to be stripped from these options). Default value: empty.


System wide configuration file.
$XDG_CONFIG_HOME/dpkg/buildflags.conf or $HOME/.config/dpkg/buildflags.conf
User configuration file.


This variable can be used to force the value returned for the given flag.
This variable can be used to append supplementary options to the value returned for the given flag.
When used with the hardening-wrapper package, the values hardening and nohardening will be converted into their respective DEB_BUILD_HARDENING values. The hardening option can also include (optionally prefixed with no ) the following sub-options: stackprotector format fortify pie relro For example, DEB_BUILD_OPTIONS=hardening=nopie would cause DEB_BUILD_HARDENING_PIE=0 to be set, or DEB_BUILD_OPTIONS=nohardening would cause DEB_BUILD_HARDENING=0 to be set. See http://wiki.debian.org/Hardening for further details.


Copyright © 2010 Raphaël Hertzog

This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY.