]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Support optional debian parallel builds
authorTravis Cross <tc@traviscross.com>
Thu, 25 Dec 2014 06:42:14 +0000 (06:42 +0000)
committerTravis Cross <tc@traviscross.com>
Thu, 25 Dec 2014 07:13:17 +0000 (07:13 +0000)
With this commit we allow getting `make -jN` behavior by setting
`parallel=N` in `DEB_BUILD_OPTIONS`.  Setting `parallel=` will result
in `make -j` being run (i.e. no limit on the number of jobs).  The
default is to run one job at a time; this is still the safest bet when
building all modules.

Thanks to Peter Wu for suggesting a different way to do this.

ref: https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options

debian/rules

index cf6a7ed1eab60057884e51726807fe8e01582fb6..6bfd911f4d3cd27032e43150c2071e73f766eb58 100755 (executable)
@@ -20,6 +20,11 @@ export CFLAGS:=$(FS_CFLAGS)
 export CXXFLAGS:=$(FS_CXXFLAGS)
 export LDFLAGS:=$(FS_LDFLAGS)
 
+NJOBS=1
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+  NJOBS=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+endif
+
 show_vars= \
        echo; \
        echo "Making target $@"; \
@@ -91,7 +96,7 @@ override_dh_auto_configure: .stamp-configure
 
 .stamp-build: .stamp-configure
        @$(call show_vars)
-       make
+       make -j$(NJOBS)
        touch $@
 
 override_dh_auto_build: .stamp-build