dpkg-buildflags.1 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. .TH dpkg\-buildflags 1 "2011-08-14" "Debian Project" "dpkg suite"
  2. .SH NAME
  3. dpkg\-buildflags \- returns build flags to use during package build
  4. .
  5. .SH SYNOPSIS
  6. .B dpkg\-buildflags
  7. .RI [ option "...] [" command ]
  8. .
  9. .SH DESCRIPTION
  10. \fBdpkg\-buildflags\fP is a tool to retrieve compilation flags to use during
  11. build of Debian packages.
  12. .
  13. The default flags are defined by the vendor but they can be
  14. extended/overriden in several ways:
  15. .IP 1.
  16. system-wide with \fB/etc/dpkg/buildflags.conf\fP;
  17. .IP 2.
  18. for the current user with \fB$XDG_CONFIG_HOME/dpkg/buildflags.conf\fP
  19. where \fB$XDG_CONFIG_HOME\fP defaults to \fB$HOME/.config\fP;
  20. .IP 3.
  21. temporarily by the user with environment variables (see section
  22. \fBENVIRONMENT\fP);
  23. .IP 4.
  24. dynamically by the package maintainer with environment variables set via
  25. \fBdebian/rules\fP (see section \fBENVIRONMENT\fP).
  26. .P
  27. The configuration files can contain two types of directives:
  28. .TP
  29. .BI SET " flag value"
  30. Override the flag named \fIflag\fP to have the value \fIvalue\fP.
  31. .TP
  32. .BI STRIP " flag value"
  33. Strip from the flag named \fIflag\fP all the build flags listed in \fIvalue\fP.
  34. .TP
  35. .BI APPEND " flag value"
  36. Extend the flag named \fIflag\fP by appending the options given in \fIvalue\fP.
  37. A space is prepended to the appended value if the flag's current value is non-empty.
  38. .TP
  39. .BI PREPEND " flag value"
  40. Extend the flag named \fIflag\fP by prepending the options given in \fIvalue\fP.
  41. A space is appended to the prepended value if the flag's current value is non-empty.
  42. .P
  43. The configuration files can contain comments on lines starting with a hash
  44. (#). Empty lines are also ignored.
  45. .SH COMMANDS
  46. .TP
  47. .BI \-\-dump
  48. Print to standard output all compilation flags and their values. It prints
  49. one flag per line separated from its value by an equal sign
  50. ("\fIflag\fP=\fIvalue\fP"). This is the default action.
  51. .TP
  52. .BI \-\-list
  53. Print the list of flags supported by the current vendor
  54. (one per line). See the \fBSUPPORTED FLAGS\fP section for more
  55. information about them.
  56. .TP
  57. .BI \-\-export= format
  58. Print to standard output shell (if \fIformat\fP is \fBsh\fP) or make
  59. (if \fIformat\fP is \fBmake\fP) commands that can be used to export
  60. all the compilation flags in the environment. If \fIformat\fP is
  61. \fBconfigure\fP then the output can be used on a \fB./configure\fP
  62. command-line. If the \fIformat\fP value is not
  63. given, \fBsh\fP is assumed. Only compilation flags starting with an
  64. upper case character are included, others are assumed to not be suitable
  65. for the environment.
  66. .TP
  67. .BI \-\-get " flag"
  68. Print the value of the flag on standard output. Exits with 0
  69. if the flag is known otherwise exits with 1.
  70. .TP
  71. .BI \-\-origin " flag"
  72. Print the origin of the value that is returned by \fB\-\-get\fP. Exits
  73. with 0 if the flag is known otherwise exits with 1. The origin can be one
  74. of the following values:
  75. .RS
  76. .TP
  77. .B vendor
  78. the original flag set by the vendor is returned;
  79. .TP
  80. .B system
  81. the flag is set/modified by a system-wide configuration;
  82. .TP
  83. .B user
  84. the flag is set/modified by a user-specific configuration;
  85. .TP
  86. .B env
  87. the flag is set/modified by an environment-specific configuration.
  88. .RE
  89. .TP
  90. .B \-\-help
  91. Show the usage message and exit.
  92. .TP
  93. .B \-\-version
  94. Show the version and exit.
  95. .
  96. .SH SUPPORTED FLAGS
  97. .TP
  98. .B CFLAGS
  99. Options for the C compiler. The default value set by the vendor
  100. includes \fI\-g\fP and the default optimization level (\fI\-O2\fP usually,
  101. or \fI\-O0\fP if the \fBDEB_BUILD_OPTIONS\fP environment variable defines
  102. \fInoopt\fP).
  103. .TP
  104. .B CPPFLAGS
  105. Options for the C preprocessor. Default value: empty.
  106. .TP
  107. .B CXXFLAGS
  108. Options for the C++ compiler. Same as \fBCFLAGS\fP.
  109. .TP
  110. .B FFLAGS
  111. Options for the Fortran compiler. Same as \fBCFLAGS\fP.
  112. .TP
  113. .B LDFLAGS
  114. Options passed to the compiler when linking executables or shared
  115. objects (if the linker is called directly, then
  116. .B \-Wl
  117. and
  118. .B ,
  119. have to be stripped from these options). Default value: empty.
  120. .
  121. .SH FILES
  122. .TP
  123. .B /etc/dpkg/buildflags.conf
  124. System wide configuration file.
  125. .TP
  126. .BR $XDG_CONFIG_HOME/dpkg/buildflags.conf " or " $HOME/.config/dpkg/buildflags.conf
  127. User configuration file.
  128. .SH ENVIRONMENT
  129. There are 2 sets of environment variables doing the same operations, the
  130. first one (DEB_\fIflag\fP_\fIop\fP) should never be used within
  131. \fBdebian/rules\fP. It's meant for any user that wants to rebuild the
  132. source package with different build flags. The second set
  133. (DEB_\fIflag\fP_MAINT_\fIop\fP) should only be used in \fBdebian/rules\fP
  134. by package maintainers to change the resulting build flags.
  135. .TP
  136. .BI DEB_ flag _SET
  137. .TQ
  138. .BI DEB_ flag _MAINT_SET
  139. This variable can be used to force the value returned for the given
  140. \fIflag\fP.
  141. .TP
  142. .BI DEB_ flag _STRIP
  143. .TQ
  144. .BI DEB_ flag _MAINT_STRIP
  145. This variable can be used to provide a space separated list of options
  146. that will be stripped from the set of flags returned for the given
  147. \fIflag\fP.
  148. .TP
  149. .BI DEB_ flag _APPEND
  150. .TQ
  151. .BI DEB_ flag _MAINT_APPEND
  152. This variable can be used to append supplementary options to the value
  153. returned for the given \fIflag\fP.
  154. .TP
  155. .BI DEB_ flag _PREPEND
  156. .TQ
  157. .BI DEB_ flag _MAINT_PREPEND
  158. This variable can be used to prepend supplementary options to the value
  159. returned for the given \fIflag\fP.
  160. .
  161. .SH AUTHOR
  162. Copyright \(co 2010-2011 Rapha\[:e]l Hertzog
  163. .sp
  164. This is free software; see the GNU General Public Licence version 2 or
  165. later for copying conditions. There is NO WARRANTY.