[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-users
Subject:    [SR-Users] PATCH: parallel debian build support
From:       Noa Resare <noa () spotify ! com>
Date:       2010-12-31 15:05:25
Message-ID: AANLkTik86Zmn8pQO-YzpAMt6pXc-7Pjo9Z7zuiQzYW+g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Friends,

The attached patch implements parallel building of the debian packages using
the -j parameter to make.
Predictably this gives package building a serious speed boost on an 8 way
xeon with solid state drives :)

To make things even simpler, I've pushed a branch debian-packaging to git://
git.resare.com/kamailio that you can pull from and merge with master using
the following commands:

git remote add resare git://git.resare.com/kamailio
git fetch resare
<check out the resare/debian-packaging branch, inspect>
<merge it into master>

A note on the patch:

- I've replaced the DEB_BUILD_OPTIONS:="$(DEB_BUILD_OPTIONS) nostrip" (which
puts literal quote characters in the make variable with a construct using
the += operator.

-It passes the basic test of building packages without failing with the
DEB_BUILD_OPTIONS environment variable set to parallel=8 as well as unset on
squeeze and lenny.

/noa

-- 
Everything is secret.

[Attachment #5 (text/html)]

Friends,<div><br></div><div><div>The attached patch implements parallel building of \
the debian packages using the -j parameter to make.</div><div>Predictably this gives \
package building a serious speed boost on an 8 way xeon with solid state drives \
:)</div>

<div><br></div><div>To make things even simpler, I&#39;ve pushed a branch \
debian-packaging to git://<a href="http://git.resare.com/kamailio" \
target="_blank">git.resare.com/kamailio</a> that you can pull from and merge with \
master using the following commands:</div>

<div><br></div><div>git remote add resare git://<a \
href="http://git.resare.com/kamailio" \
target="_blank">git.resare.com/kamailio</a></div><div>git fetch \
resare</div><div>&lt;check out the resare/debian-packaging branch, inspect&gt;</div> \
<div>&lt;merge it into master&gt;</div><div><br></div><div>A note on the \
patch:</div><div><br></div><div>- I&#39;ve replaced the \
DEB_BUILD_OPTIONS:=&quot;$(DEB_BUILD_OPTIONS) nostrip&quot; (which puts literal quote \
characters in the make variable with a construct using the += operator.</div> \
<div><br></div><div>-It passes the basic test of building packages without failing \
with the DEB_BUILD_OPTIONS environment variable set to parallel=8 as well as unset on \
squeeze and lenny.</div><div><br></div><div>/noa</div> <div>
 <br>-- <br>Everything is secret.<br>
</div></div>

--001485f5aea4c913060498b62144--


["kamailio-parallel-debian-make.patch" (application/octet-stream)]

diff --git a/pkg/kamailio/deb/lenny/rules b/pkg/kamailio/deb/lenny/rules
index 84ebd65..17b5e9b 100755
--- a/pkg/kamailio/deb/lenny/rules
+++ b/pkg/kamailio/deb/lenny/rules
@@ -17,7 +17,7 @@
 # export DH_COMPAT=4
 #  -- already set in compat
 #  force no striping (always include debug symbols for now)
-export DEB_BUILD_OPTIONS:="$(DEB_BUILD_OPTIONS) nostrip"
+DEB_BUILD_OPTIONS += nostrip
 
 # modules not in the "main" kamailio package
 EXCLUDED_MODULES= geoip
@@ -59,7 +59,7 @@ mod_name=$(subst db_,,$(lastword $(subst /, ,$(1))))
 define PACKAGE_GRP_BUILD_template
 	# package all the modules in PACKAGE_GROUPS in separate packages
 	$(foreach grp,$(PACKAGE_GROUPS),\
-		$(MAKE) every-module group_include="k$(grp)"
+		$(MAKE) every-module group_include="k$(grp)" $(EXTRA_MAKE_ARGS)
 	)
 endef
 
@@ -67,7 +67,7 @@ endef
 define PACKAGE_MODULE_BUILD_template
 	# package all the modules MODULES_SP in separate packages
 	$(foreach mod,$(MODULES_SP),\
-		$(MAKE) modules modules="$(mod)"
+		$(MAKE) modules modules="$(mod)" $(EXTRA_MAKE_ARGS)
 	)
 endef
 
@@ -114,6 +114,12 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 	INSTALL_PROGRAM += -s
 endif
 
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    EXTRA_MAKE_ARGS = -j$(NUMJOBS)
+endif
+
+
 configure: configure-stamp
 configure-stamp:
 	dh_testdir
@@ -131,8 +137,8 @@ build: build-stamp
 
 build-stamp: configure-stamp 
 	dh_testdir
-	# Add here commands to compile the package.
-	$(MAKE) all
+	# Add here commands to compile the package. 
+	$(MAKE) all $(EXTRA_MAKE_ARGS)
 	# make groups
 	$(call PACKAGE_GRP_BUILD_template)
 	# make single-module packages
diff --git a/pkg/kamailio/deb/squeeze/rules b/pkg/kamailio/deb/squeeze/rules
index a64793a..abdce7b 100755
--- a/pkg/kamailio/deb/squeeze/rules
+++ b/pkg/kamailio/deb/squeeze/rules
@@ -17,7 +17,7 @@
 # export DH_COMPAT=4
 #  -- already set in compat
 #  force no striping (always include debug symbols for now)
-export DEB_BUILD_OPTIONS:="$(DEB_BUILD_OPTIONS) nostrip"
+DEB_BUILD_OPTIONS += nostrip
 
 # modules not in the "main" kamailio package
 EXCLUDED_MODULES= purple
@@ -59,7 +59,7 @@ mod_name=$(subst db_,,$(lastword $(subst /, ,$(1))))
 define PACKAGE_GRP_BUILD_template
 	# package all the modules in PACKAGE_GROUPS in separate packages
 	$(foreach grp,$(PACKAGE_GROUPS),\
-		$(MAKE) every-module group_include="k$(grp)"
+		$(MAKE) every-module group_include="k$(grp)" $(EXTRA_MAKE_ARGS)
 	)
 endef
 
@@ -67,7 +67,7 @@ endef
 define PACKAGE_MODULE_BUILD_template
 	# package all the modules MODULES_SP in separate packages
 	$(foreach mod,$(MODULES_SP),\
-		$(MAKE) modules modules="$(mod)"
+		$(MAKE) modules modules="$(mod)" $(EXTRA_MAKE_ARGS)
 	)
 endef
 
@@ -114,6 +114,12 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 	INSTALL_PROGRAM += -s
 endif
 
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    EXTRA_MAKE_ARGS = -j$(NUMJOBS)
+endif
+
+
 configure: configure-stamp
 configure-stamp:
 	dh_testdir
@@ -131,8 +137,8 @@ build: build-stamp
 
 build-stamp: configure-stamp 
 	dh_testdir
-	# Add here commands to compile the package.
-	$(MAKE) all
+	# Add here commands to compile the package. 
+	$(MAKE) all $(EXTRA_MAKE_ARGS)
 	# make groups
 	$(call PACKAGE_GRP_BUILD_template)
 	# make single-module packages


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic