[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#209008: debian-policy: [PROPOSAL] common interface for parallel building in DEB_BUILD_OPTIONS



Package: debian-policy
Version: 3.6.1.0
Severity: wishlist

Hi!

I'd like to propose the option "parallel=X" in DEB_BUILD_OPTIONS to allow
packages to build in parallel with X jobs thus enabling faster builds on
SMP machines for packages that support this.

Just setting "$(MAKE)=make -j3" in the environment won't work because
many packages break if built like that.
http://lists.debian.org/debian-policy/2001/debian-policy-200103/msg00368.html


I could find 4 packages that support 3 different interfaces for
accomplishing that.

gcc-snapshot and ardour look for "USE_NJOBS" in the environment and the
figure out themselves how many jobs to use:

ifneq ($(USE_NJOBS),)
   NJOBS := -j$(shell if [ -f /proc/cpuinfo ]; \
            then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \
            else echo 1; fi)
endif

openoffice.org does:

# Pararell build - add -PPn into DEB_BUILD_OPTIONS, where n is the number of processes

glibc does:

ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
DEB_BUILD_OPTION_PARALLEL = yes
else
DEB_BUILD_OPTION_PARALLEL = no
endif

I propose the following:

--- policy.sgml.orig    2003-09-06 21:58:14.000000000 +0200
+++ policy.sgml 2003-09-06 22:07:04.000000000 +0200
@@ -6325,7 +6325,13 @@
                not be stripped from the binary during installation,
                so that debugging information may be included in the package.
            </item>
          </taglist>
+        <tag>parallel=N</tag>
+        <item>
+        This option means that the package should be built with N jobs in
+        parallel if it can be built in parallel, so that the build process
+        becomes faster on multiprocessor machines.
+        </item>
        </p>
  
        <p>
@@ -6349,6 +6355,19 @@
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 INSTALL_PROGRAM += -s
 endif
+
+ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
+    PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
+        sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
+    ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS))
+        PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \
+            then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \
+            else echo 1; fi)
+    endif
+    NJOBS := -j$(PARALLEL_JOBS)
+endif
+MAKEFLAGS += $(NJOBS)
+
          </example>
        </p>

thus supporting the glibc's interface and the extension of explicitly setting
the number of jobs to be used.
 

	Robert.

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux schuh 2.5.72 #1 SMP Thu Jun 19 12:51:46 UTC 2003 i686
Locale: LANG=C, LC_CTYPE=en_US.UTF-8

-- no debconf information




Reply to: