]> git.donarmstrong.com Git - debian/debian-policy.git/commitdiff
Add parallel=n and move DEB_BUILD_OPTS section
authorRuss Allbery <rra@debian.org>
Sun, 16 Mar 2008 20:43:55 +0000 (20:43 +0000)
committerRuss Allbery <rra@debian.org>
Sun, 16 Mar 2008 20:43:55 +0000 (20:43 +0000)
Add the build option parallel=n, requesting a parallel build.  Standardize
the format of DEB_BUILD_OPTIONS, require tags be whitespace-separated,
allow packages to assume non-conflicting tags, and require unknown flags
be ignored.  Move the section documenting DEB_BUILD_OPTS under the
debian/rules section and away from the binaries section, leaving a
cross-reference behind.  Thanks to Loïc Minier, Peter Samuelson,
Robert Millan, and Guillem Jover for wording suggestions.

git-archimport-id: rra@debian.org--lenny/debian-policy--devel--3.7--patch-40

debian/changelog
policy.sgml
upgrading-checklist.html

index ac674e9c1432037fe957a39541549a222f438ad0..1b9056356934676f7ea4480f591dd356ccbb4836 100644 (file)
@@ -2,6 +2,12 @@ debian-policy (3.7.4.0) unstable; urgency=low
 
   * Bug fix: "[AMENDMENT 11/02/2008] Manual page encoding", thanks to
     Colin Watson                                             (Closes: #440420).
+  * Bug fix: "[PROPOSAL] common interface for parallel building in
+    DEB_BUILD_OPTIONS", thanks to Loïc Minier, Peter Samuelson, and Robert
+    Millan                                                   (Closes: #209008).
+  * Bug fix: "Please clarify splitting/syntax of DEB_BUILD_OPTIONS", thanks to
+    Loïc Minier, Peter Samuelson, Robert Millan, and Guillem Jover
+                                                             (Closes: #430649).
   * Bug fix: "Documentation for Breaks in dpkg", thanks to Ian Jackson
                                                              (Closes: #379150).
   * Bug fix: "support for wrapped Uploaders should now be mandatory"
index c8087f3127483f1d5b3725747c022ef6d0ab672e..888de5aec75a60ac90b3edc1fb27e131621d405e 100644 (file)
          or system information; the GNU style variables should be
          used for that.
        </p>
+
+       <sect1 id="debianrules-options">
+         <heading><file>debian/rules</file> and
+           <tt>DEB_BUILD_OPTIONS</tt></heading>
+
+         <p>
+           Supporting the standardized environment variable
+           <tt>DEB_BUILD_OPTIONS</tt> is recommended.  This variable can
+           contain several flags to change how a package is compiled and
+           built.  Each flag must be in the form <var>flag</var> or
+           <var>flag</var>=<var>options</var>.  If multiple flags are
+           given, they must be separated by whitespace.<footnote>
+             Some packages support any delimiter, but whitespace is the
+             easiest to parse inside a makefile and avoids ambiguity with
+             flag values that contain commas.
+           </footnote>
+           <var>flag</var> must start with a lowercase letter
+           (<tt>a-z</tt>) and consist only of lowercase letters,
+           numbers (<tt>0-9</tt>), and the characters
+           <tt>-</tt> and <tt>_</tt> (hyphen and underscore).
+           <var>options</var> must not contain whitespace.  The same
+           tag should not be given multiple times with conflicting
+           values.  Package maintainers may assume that
+           <tt>DEB_BUILD_OPTIONS</tt> will not contain conflicting tags.
+         </p>
+
+         <p>
+           The meaning of the following tags has been standardized:
+           <taglist>
+             <tag>noopt</tag>
+             <item>
+                 The presence of this tag means that the package should
+                 be compiled with a minimum of optimization.  For C
+                 programs, it is best to add <tt>-O0</tt> to
+                 <tt>CFLAGS</tt> (although this is usually the default).
+                 Some programs might fail to build or run at this level
+                 of optimization; it may be necessary to use
+                 <tt>-O1</tt>, for example.
+             </item>
+             <tag>nostrip</tag>
+             <item>
+                 This tag means that the debugging symbols should not be
+                 stripped from the binary during installation, so that
+                 debugging information may be included in the package.
+             </item>
+             <tag>parallel=n</tag>
+             <item>
+                 This tag means that the package should be built using up
+                 to <tt>n</tt> parallel processes if the package build
+                 system supports this.<footnote>
+                     Packages built with <tt>make</tt> can often implement
+                     this by passing the <tt>-j</tt><var>n</var> option to
+                     <tt>make</tt>.
+                 </footnote>
+                 If the package build system does not support parallel
+                 builds, this string must be ignored.  If the package
+                 build system only supports a lower level of concurrency
+                 than <var>n</var>, the package should be built using as
+                 many parallel processes as the package build system
+                 supports.  It is up to the package maintainer to decide
+                 whether the package build times are long enough and the
+                 package build system is robust enough to make supporting
+                 parallel builds worthwhile.
+              </item>
+           </taglist>
+         </p>
+
+         <p>
+           Unknown flags must be ignored by <file>debian/rules</file>.
+         </p>
+
+         <p>
+           The following makefile snippet is an example of how one may
+           implement the build options; you will probably have to
+           massage this example in order to make it work for your
+           package.
+           <example compact="compact">
+CFLAGS = -Wall -g
+INSTALL = install
+INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
+INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
+INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
+INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
+
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+    CFLAGS += -O0
+else
+    CFLAGS += -O2
+endif
+ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
+    INSTALL_PROGRAM += -s
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    MAKEFLAGS += -j$(NUMJOBS)
+endif
+           </example>
+         </p>
+       </sect1>
       </sect>
 
 <!-- FIXME: section pkg-srcsubstvars is the same as substvars -->
@@ -6597,58 +6696,12 @@ INSTALL = install -s # (or use strip on the files in debian/tmp)
 
        <p>
          Although binaries in the build tree should be compiled with
-         debugging information by default, it can often be difficult
-         to debug programs if they are also subjected to compiler
-         optimization.  For this reason, it is recommended to support
-         the standardized environment
-         variable <tt>DEB_BUILD_OPTIONS</tt>.  This variable can
-         contain several flags to change how a package is compiled
-         and built.
-       </p>
-
-       <p>
-         <taglist>
-           <tag>noopt</tag>
-           <item>
-               The presence of this string means that the package
-               should be compiled with a minimum of optimization.
-               For C programs, it is best to add <tt>-O0</tt>
-               to <tt>CFLAGS</tt> (although this is usually the
-               default).  Some programs might fail to build or run at
-               this level of optimization; it may be necessary to
-               use <tt>-O1</tt>, for example.
-           </item>
-           <tag>nostrip</tag>
-           <item>
-               This string means that the debugging symbols should
-               not be stripped from the binary during installation,
-               so that debugging information may be included in the package.
-           </item>
-         </taglist>
-       </p>
-
-       <p>
-         The following makefile snippet is an example of how one may
-          implement the build options; you will probably have to
-          massage this example in order to make it work for your
-          package.
-         <example compact="compact">
-CFLAGS = -Wall -g
-INSTALL = install
-INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
-INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
-INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
-INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-CFLAGS += -O0
-else
-CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-INSTALL_PROGRAM += -s
-endif
-         </example>
+         debugging information by default, it can often be difficult to
+         debug programs if they are also subjected to compiler
+         optimization.  For this reason, it is recommended to support the
+         standardized environment variable <tt>DEB_BUILD_OPTIONS</tt>
+         (see <ref id="debianrules-options">).  This variable can contain
+         several flags to change how a package is compiled and built.
        </p>
 
        <p>
index 5cd0b10be1f1884c4edc205c87840318e411cabb..e344403bc34fe521693c25b4cda7716ae9f46628 100644 (file)
@@ -58,6 +58,13 @@ picking your way through this list.
      * The base section has been removed.  contrib and non-free have been
        removed from the section list; they are only categories.  The base
        system is now defined by priority.                        [2.4, 3.7]
+     * Standardized the format of DEB_BUILD_OPTIONS.  Specified permitted
+       characters for tags, required that tags be whitespace-separated,
+       allowed packages to assume non-conflicting tags, and required
+       unknown flags be ignored.                                 [4.9.1, 10.1]
+     * Added parallel=n to the standardized DEB_BUILD_OPTIONS tags,
+       indicating that a package should be built using up to n parallel
+       processes if the package supports it                      [4.9.1]
      * Debian packages should not use convience copies of code from other
        packages unless the included package is explicitly intended to be
        used that way.                                            [4.13]