Browse code

pkg/kamailio/deb: rework rules [skip ci]

* define list elements per line. It helps to remove/add them in
backports scripts
* remove unused definitions
* include dpkg-dev helper makefile files with definitions
* rework backports scripts

Victor Seva authored on 17/06/2022 09:33:47
Showing 27 changed files
... ...
@@ -1,54 +1,113 @@
1 1
 #!/usr/bin/make -f
2
-# Sample debian/rules that uses debhelper.
3
-# GNU copyright 1997 to 1999 by Joey Hess.
4 2
 
5
-DEBVERSION:=$(shell head -n 1 debian/changelog \
6
-                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
7
-UPVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
8
-
9
-FILENAME := kamailio_$(UPVERSION).orig.tar.gz
10
-URL := http://www.kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)_src.tar.gz
11
-
12
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
3
+# Uncomment this to turn on verbose mode.
4
+#export DH_VERBOSE=1
13 5
 
14 6
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15 7
 DPKG_EXPORT_BUILDFLAGS = 1
8
+
9
+include /usr/share/dpkg/architecture.mk
16 10
 include /usr/share/dpkg/buildflags.mk
11
+include /usr/share/dpkg/pkg-info.mk
17 12
 
18
-# Uncomment this to turn on verbose mode.
19
-#export DH_VERBOSE=1
13
+# Enable parallel builds.
14
+NUMJOBS = 1
15
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17
+  MAKEFLAGS += -j$(NUMJOBS)
18
+endif
20 19
 
21 20
 export RADCLI=1
22 21
 
23
-# modules not in the "main" kamailio package
24
-EXCLUDED_MODULES= java nats
25
-
26
-# extra modules to skip, because they are not compilable now
27
-# - regardless if they go to the main kamailio package or to some module package,
28
-# they will be excluded from compile and install of all
29
-EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy mi_xmlrpc dnssec secsipid lwsc
30
-
31
-# module groups that are packaged in separate packages
32
-# (with the name kamailio-$(group_name)-modules)
22
+# Modules not in the "main" kamailio package:
23
+EXCLUDED_MODULES =
24
+
25
+# Extra modules to skip, because they are not compilable now:
26
+# - regardless if they go to the main kamailio package or to some module
27
+#   package, they will be excluded from compile and install of all.
28
+EXTRA_EXCLUDED_MODULES += bdb
29
+EXTRA_EXCLUDED_MODULES += dbtext
30
+EXTRA_EXCLUDED_MODULES += oracle
31
+EXTRA_EXCLUDED_MODULES += pa
32
+EXTRA_EXCLUDED_MODULES += iptrtpproxy
33
+EXTRA_EXCLUDED_MODULES += dnssec
34
+EXTRA_EXCLUDED_MODULES += java
35
+EXTRA_EXCLUDED_MODULES += secsipid
36
+EXTRA_EXCLUDED_MODULES += lwsc
37
+EXTRA_EXCLUDED_MODULES += nats
38
+## --EXCLUDED--
39
+
40
+
41
+# Module groups that are packaged in seperate packages (with the name
42
+# kamailio-$(group_name)-modules).
33 43
 # Note: the order is important (should be in dependency order, the one
34 44
 # on which other depend first)
35
-PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \
36
-			   ldap xml perl utils lua memcached \
37
-			   snmpstats carrierroute xmpp cpl redis python geoip geoip2 \
38
-			   sqlite json mono ruby ims sctp \
39
-			   tls outbound websocket autheph kazoo cnxcc \
40
-			   erlang systemd phonenum mongodb rabbitmq python3 mqtt
45
+PACKAGE_GROUPS += mysql
46
+PACKAGE_GROUPS += postgres
47
+PACKAGE_GROUPS += berkeley
48
+PACKAGE_GROUPS += unixodbc
49
+PACKAGE_GROUPS += radius
50
+PACKAGE_GROUPS += presence
51
+PACKAGE_GROUPS += ldap
52
+PACKAGE_GROUPS += xml
53
+PACKAGE_GROUPS += perl
54
+PACKAGE_GROUPS += utils
55
+PACKAGE_GROUPS += lua
56
+PACKAGE_GROUPS += memcached
57
+PACKAGE_GROUPS += snmpstats
58
+PACKAGE_GROUPS += carrierroute
59
+PACKAGE_GROUPS += xmpp
60
+PACKAGE_GROUPS += cpl
61
+PACKAGE_GROUPS += redis
62
+PACKAGE_GROUPS += python
63
+PACKAGE_GROUPS += geoip
64
+PACKAGE_GROUPS += geoip2
65
+PACKAGE_GROUPS += sqlite
66
+PACKAGE_GROUPS += json
67
+PACKAGE_GROUPS += mono
68
+PACKAGE_GROUPS += ruby
69
+PACKAGE_GROUPS += ims
70
+PACKAGE_GROUPS += sctp
71
+PACKAGE_GROUPS += tls
72
+PACKAGE_GROUPS += outbound
73
+PACKAGE_GROUPS += websocket
74
+PACKAGE_GROUPS += autheph
75
+PACKAGE_GROUPS += kazoo
76
+PACKAGE_GROUPS += cnxcc
77
+PACKAGE_GROUPS += erlang
78
+PACKAGE_GROUPS += systemd
79
+PACKAGE_GROUPS += phonenum
80
+PACKAGE_GROUPS += mongodb
81
+PACKAGE_GROUPS += rabbitmq
82
+PACKAGE_GROUPS += python3
83
+PACKAGE_GROUPS += mqtt
84
+
85
+# Module groups to be packaged onto kamailio-extra-modules.
86
+EXTRA_GROUPS += ev
87
+EXTRA_GROUPS += gzcompress
88
+EXTRA_GROUPS += jansson
89
+EXTRA_GROUPS += uuid
90
+EXTRA_GROUPS += http_async
91
+
92
+D = $(CURDIR)/debian/$(DEB_SOURCE)
93
+
94
+# Name of libdir in the path for libraries (e.g., the multiarch triplet).
95
+export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
41 96
 
42
-# module groups to be packaged onto kamailio-extra-modules
43
-EXTRA_GROUPS=gzcompress uuid ev jansson http_async
97
+# Directories with possible duplicate libraries (that should be deleted
98
+# from current module* packages).
99
+DUP_LIBS_DIRS = $(D)/usr/$(LIBDIR)/kamailio \
100
+                $(D)-db-modules/usr/$(LIBDIR)/kamailio
44 101
 
45
-# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b)
46
-export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
102
+# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
103
+CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
104
+CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
105
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
106
+# LDFLAGS -> LD_EXTRA_OPTS
107
+LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
47 108
 
48
-# directories with possible duplicate libraries (that should be deleted
49
-# from current module* packages)
50
-DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \
51
-			$(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio
109
+# https://wiki.debian.org/ReproducibleBuilds/
110
+CC_EXTRA_OPTS += -DVERSION_NODATE
52 111
 
53 112
 # "function" to get package short name out of a dir/module_name
54 113
 # it also transforms db_foo into foo
... ...
@@ -64,18 +123,18 @@ endef
64 123
 define PACKAGE_GRP_INSTALL_template
65 124
 	$(foreach grp,$(PACKAGE_GROUPS),\
66 125
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
67
-		BASEDIR=$(CURDIR)/debian/kamailio-$(grp)-modules \
68
-		cfg_prefix=$(CURDIR)/debian/kamailio-$(grp)-modules \
69
-		doc-dir=share/doc/kamailio-$(grp)-modules quiet=verbose
126
+		BASEDIR=$(D)-$(grp)-modules \
127
+		cfg_prefix=$(D)-$(grp)-modules \
128
+		doc-dir=share/doc/$(DEB_SOURCE)-$(grp)-modules quiet=verbose
70 129
 		# eliminate duplicate libs
71 130
 		-for d in $(DUP_LIBS_DIRS); do \
72
-			test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
131
+			test "$$d" != "$(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
73 132
 			for r in `find $$d -name 'lib*'|xargs`; do \
74 133
 				echo "removing $(grp) lib `basename $$r` present also in $$d";\
75
-				rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
134
+				rm -f $(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
76 135
 			done ; \
77 136
 		done
78
-		find $(CURDIR)/debian/kamailio-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
137
+		find $(D)-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
79 138
 	)
80 139
 endef
81 140
 
... ...
@@ -89,38 +148,28 @@ endef
89 148
 define PACKAGE_EXTRA_INSTALL_template
90 149
 	$(foreach grp,$(EXTRA_GROUPS),\
91 150
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
92
-		BASEDIR=$(CURDIR)/debian/kamailio-extra-modules \
93
-		cfg_prefix=$(CURDIR)/debian/kamailio-extra-modules \
94
-		doc-dir=share/doc/kamailio-extra-modules quiet=verbose
151
+		BASEDIR=$(D)-extra-modules \
152
+		cfg_prefix=$(D)-extra-modules \
153
+		doc-dir=share/doc/$(DEB_SOURCE)-extra-modules quiet=verbose
95 154
 	)
96 155
 	# eliminate duplicate libs
97 156
 	-for d in $(DUP_LIBS_DIRS); do \
98
-		test "$$d" != "$(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio" &&\
157
+		test "$$d" != "$(D)-extra-modules/usr/$(LIBDIR)/kamailio" &&\
99 158
 		for r in `find $$d -name 'lib*'|xargs`; do \
100 159
 			echo "removing extra lib `basename $$r` present also in $$d";\
101
-			rm -f $(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
160
+			rm -f $(D)-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
102 161
 		done ; \
103 162
 	done
104
-	find $(CURDIR)/debian/kamailio-extra-modules -depth -empty -type d -exec rmdir {} \;
163
+	find $(D)-extra-modules -depth -empty -type d -exec rmdir {} \;
105 164
 endef
106 165
 
107
-# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
108
-CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
109
-CC_EXTRA_OPTS += $(shell DEB_CFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CFLAGS)
110
-CXXFLAGS := $(shell DEB_CXXFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CXXFLAGS)
111
-# LDFLAGS -> LD_EXTRA_OPTS
112
-LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
113
-
114
-# https://wiki.debian.org/ReproducibleBuilds/
115
-CC_EXTRA_OPTS += -DVERSION_NODATE
116
-
117 166
 configure: configure-stamp
118 167
 configure-stamp:
119 168
 	dh_testdir
120 169
 	# Add here commands to configure the package.
121
-	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/kamailio \
170
+	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(D) \
122 171
 			cfg_target=/etc/kamailio/ \
123
-			BASEDIR=$(CURDIR)/debian/kamailio \
172
+			BASEDIR=$(D) \
124 173
 			skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
125 174
 			CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
126 175
 			LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
... ...
@@ -159,13 +208,13 @@ install: build
159 208
 	# make group packages
160 209
 	$(call PACKAGE_GRP_INSTALL_template)
161 210
 	$(call PACKAGE_EXTRA_INSTALL_template)
162
-	mv $(CURDIR)/debian/kamailio-berkeley-modules/usr/sbin/kambdb_recover \
163
-		$(CURDIR)/debian/kamailio-berkeley-bin/usr/sbin/kambdb_recover
211
+	mv $(D)-berkeley-modules/usr/sbin/kambdb_recover \
212
+		$(D)-berkeley-bin/usr/sbin/kambdb_recover
164 213
 	# install /etc/default/kamailio file
165
-	mkdir -p $(CURDIR)/debian/kamailio/etc/default
166
-	cp -f debian/kamailio.default $(CURDIR)/debian/kamailio/etc/default/kamailio
214
+	mkdir -p $(D)/etc/default
215
+	cp -f debian/kamailio.default $(D)/etc/default/kamailio
167 216
 	# delete /run/kamailio dir
168
-	rm -rf $(CURDIR)/debian/kamailio/usr/local
217
+	rm -rf $(D)/usr/local
169 218
 
170 219
 
171 220
 # This single target is used to build all the packages, all at once, or
... ...
@@ -213,16 +262,5 @@ binary-arch: build install
213 262
 binary-%: build install
214 263
 	$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
215 264
 
216
-print-version:
217
-	@@echo "Debian version:          $(DEBVERSION)"
218
-	@@echo "Upstream version:        $(UPVERSION)"
219
-
220
-get-orig-source:
221
-	@@dh_testdir
222
-	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
223
-	@@echo Downloading $(FILENAME) from $(URL) ...
224
-	@@wget -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
225
-
226 265
 binary: binary-indep binary-arch
227 266
 .PHONY: build clean binary-indep binary-arch binary install configure
228
-
... ...
@@ -1,54 +1,113 @@
1 1
 #!/usr/bin/make -f
2
-# Sample debian/rules that uses debhelper.
3
-# GNU copyright 1997 to 1999 by Joey Hess.
4 2
 
5
-DEBVERSION:=$(shell head -n 1 debian/changelog \
6
-                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
7
-UPVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
8
-
9
-FILENAME := kamailio_$(UPVERSION).orig.tar.gz
10
-URL := http://www.kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)_src.tar.gz
11
-
12
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
3
+# Uncomment this to turn on verbose mode.
4
+#export DH_VERBOSE=1
13 5
 
14 6
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15 7
 DPKG_EXPORT_BUILDFLAGS = 1
8
+
9
+include /usr/share/dpkg/architecture.mk
16 10
 include /usr/share/dpkg/buildflags.mk
11
+include /usr/share/dpkg/pkg-info.mk
17 12
 
18
-# Uncomment this to turn on verbose mode.
19
-#export DH_VERBOSE=1
13
+# Enable parallel builds.
14
+NUMJOBS = 1
15
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17
+  MAKEFLAGS += -j$(NUMJOBS)
18
+endif
20 19
 
21 20
 export RADCLI=1
22 21
 
23
-# modules not in the "main" kamailio package
24
-EXCLUDED_MODULES= java python
25
-
26
-# extra modules to skip, because they are not compilable now
27
-# - regardless if they go to the main kamailio package or to some module package,
28
-# they will be excluded from compile and install of all
29
-EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy mi_xmlrpc dnssec
30
-
31
-# module groups that are packaged in separate packages
32
-# (with the name kamailio-$(group_name)-modules)
22
+# Modules not in the "main" kamailio package:
23
+EXCLUDED_MODULES =
24
+
25
+# Extra modules to skip, because they are not compilable now:
26
+# - regardless if they go to the main kamailio package or to some module
27
+#   package, they will be excluded from compile and install of all.
28
+EXTRA_EXCLUDED_MODULES += bdb
29
+EXTRA_EXCLUDED_MODULES += dbtext
30
+EXTRA_EXCLUDED_MODULES += oracle
31
+EXTRA_EXCLUDED_MODULES += pa
32
+EXTRA_EXCLUDED_MODULES += iptrtpproxy
33
+EXTRA_EXCLUDED_MODULES += dnssec
34
+EXTRA_EXCLUDED_MODULES += java
35
+EXTRA_EXCLUDED_MODULES += python
36
+## --EXCLUDED--
37
+
38
+
39
+# Module groups that are packaged in seperate packages (with the name
40
+# kamailio-$(group_name)-modules).
33 41
 # Note: the order is important (should be in dependency order, the one
34 42
 # on which other depend first)
35
-PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \
36
-			   ldap xml perl utils lua memcached \
37
-			   snmpstats carrierroute xmpp cpl redisgeoip geoip2 \
38
-			   sqlite json mono ruby ims sctp \
39
-			   tls outbound websocket autheph kazoo cnxcc \
40
-			   erlang systemd phonenum mongodb rabbitmq python3 mqtt secsipid lwsc nats
43
+PACKAGE_GROUPS += mysql
44
+PACKAGE_GROUPS += postgres
45
+PACKAGE_GROUPS += berkeley
46
+PACKAGE_GROUPS += unixodbc
47
+PACKAGE_GROUPS += radius
48
+PACKAGE_GROUPS += presence
49
+PACKAGE_GROUPS += ldap
50
+PACKAGE_GROUPS += xml
51
+PACKAGE_GROUPS += perl
52
+PACKAGE_GROUPS += utils
53
+PACKAGE_GROUPS += lua
54
+PACKAGE_GROUPS += memcached
55
+PACKAGE_GROUPS += snmpstats
56
+PACKAGE_GROUPS += carrierroute
57
+PACKAGE_GROUPS += xmpp
58
+PACKAGE_GROUPS += cpl
59
+PACKAGE_GROUPS += redis
60
+PACKAGE_GROUPS += geoip
61
+PACKAGE_GROUPS += geoip2
62
+PACKAGE_GROUPS += sqlite
63
+PACKAGE_GROUPS += json
64
+PACKAGE_GROUPS += mono
65
+PACKAGE_GROUPS += ruby
66
+PACKAGE_GROUPS += ims
67
+PACKAGE_GROUPS += sctp
68
+PACKAGE_GROUPS += tls
69
+PACKAGE_GROUPS += outbound
70
+PACKAGE_GROUPS += websocket
71
+PACKAGE_GROUPS += autheph
72
+PACKAGE_GROUPS += kazoo
73
+PACKAGE_GROUPS += cnxcc
74
+PACKAGE_GROUPS += erlang
75
+PACKAGE_GROUPS += systemd
76
+PACKAGE_GROUPS += phonenum
77
+PACKAGE_GROUPS += mongodb
78
+PACKAGE_GROUPS += rabbitmq
79
+PACKAGE_GROUPS += python3
80
+PACKAGE_GROUPS += mqtt
81
+PACKAGE_GROUPS += secsipid
82
+PACKAGE_GROUPS += lwsc
83
+PACKAGE_GROUPS += nats
84
+
85
+# Module groups to be packaged onto kamailio-extra-modules.
86
+EXTRA_GROUPS += ev
87
+EXTRA_GROUPS += gzcompress
88
+EXTRA_GROUPS += jansson
89
+EXTRA_GROUPS += uuid
90
+EXTRA_GROUPS += http_async
91
+
92
+D = $(CURDIR)/debian/$(DEB_SOURCE)
93
+
94
+# Name of libdir in the path for libraries (e.g., the multiarch triplet).
95
+export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
41 96
 
42
-# module groups to be packaged onto kamailio-extra-modules
43
-EXTRA_GROUPS=gzcompress uuid ev jansson http_async
97
+# Directories with possible duplicate libraries (that should be deleted
98
+# from current module* packages).
99
+DUP_LIBS_DIRS = $(D)/usr/$(LIBDIR)/kamailio \
100
+                $(D)-db-modules/usr/$(LIBDIR)/kamailio
44 101
 
45
-# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b)
46
-export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
102
+# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
103
+CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
104
+CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
105
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
106
+# LDFLAGS -> LD_EXTRA_OPTS
107
+LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
47 108
 
48
-# directories with possible duplicate libraries (that should be deleted
49
-# from current module* packages)
50
-DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \
51
-			$(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio
109
+# https://wiki.debian.org/ReproducibleBuilds/
110
+CC_EXTRA_OPTS += -DVERSION_NODATE
52 111
 
53 112
 # "function" to get package short name out of a dir/module_name
54 113
 # it also transforms db_foo into foo
... ...
@@ -64,18 +123,18 @@ endef
64 123
 define PACKAGE_GRP_INSTALL_template
65 124
 	$(foreach grp,$(PACKAGE_GROUPS),\
66 125
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
67
-		BASEDIR=$(CURDIR)/debian/kamailio-$(grp)-modules \
68
-		cfg_prefix=$(CURDIR)/debian/kamailio-$(grp)-modules \
69
-		doc-dir=share/doc/kamailio-$(grp)-modules quiet=verbose
126
+		BASEDIR=$(D)-$(grp)-modules \
127
+		cfg_prefix=$(D)-$(grp)-modules \
128
+		doc-dir=share/doc/$(DEB_SOURCE)-$(grp)-modules quiet=verbose
70 129
 		# eliminate duplicate libs
71 130
 		-for d in $(DUP_LIBS_DIRS); do \
72
-			test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
131
+			test "$$d" != "$(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
73 132
 			for r in `find $$d -name 'lib*'|xargs`; do \
74 133
 				echo "removing $(grp) lib `basename $$r` present also in $$d";\
75
-				rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
134
+				rm -f $(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
76 135
 			done ; \
77 136
 		done
78
-		find $(CURDIR)/debian/kamailio-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
137
+		find $(D)-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
79 138
 	)
80 139
 endef
81 140
 
... ...
@@ -89,38 +148,28 @@ endef
89 148
 define PACKAGE_EXTRA_INSTALL_template
90 149
 	$(foreach grp,$(EXTRA_GROUPS),\
91 150
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
92
-		BASEDIR=$(CURDIR)/debian/kamailio-extra-modules \
93
-		cfg_prefix=$(CURDIR)/debian/kamailio-extra-modules \
94
-		doc-dir=share/doc/kamailio-extra-modules quiet=verbose
151
+		BASEDIR=$(D)-extra-modules \
152
+		cfg_prefix=$(D)-extra-modules \
153
+		doc-dir=share/doc/$(DEB_SOURCE)-extra-modules quiet=verbose
95 154
 	)
96 155
 	# eliminate duplicate libs
97 156
 	-for d in $(DUP_LIBS_DIRS); do \
98
-		test "$$d" != "$(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio" &&\
157
+		test "$$d" != "$(D)-extra-modules/usr/$(LIBDIR)/kamailio" &&\
99 158
 		for r in `find $$d -name 'lib*'|xargs`; do \
100 159
 			echo "removing extra lib `basename $$r` present also in $$d";\
101
-			rm -f $(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
160
+			rm -f $(D)-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
102 161
 		done ; \
103 162
 	done
104
-	find $(CURDIR)/debian/kamailio-extra-modules -depth -empty -type d -exec rmdir {} \;
163
+	find $(D)-extra-modules -depth -empty -type d -exec rmdir {} \;
105 164
 endef
106 165
 
107
-# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
108
-CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
109
-CC_EXTRA_OPTS += $(shell DEB_CFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CFLAGS)
110
-CXXFLAGS := $(shell DEB_CXXFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CXXFLAGS)
111
-# LDFLAGS -> LD_EXTRA_OPTS
112
-LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
113
-
114
-# https://wiki.debian.org/ReproducibleBuilds/
115
-CC_EXTRA_OPTS += -DVERSION_NODATE
116
-
117 166
 configure: configure-stamp
118 167
 configure-stamp:
119 168
 	dh_testdir
120 169
 	# Add here commands to configure the package.
121
-	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/kamailio \
170
+	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(D) \
122 171
 			cfg_target=/etc/kamailio/ \
123
-			BASEDIR=$(CURDIR)/debian/kamailio \
172
+			BASEDIR=$(D) \
124 173
 			skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
125 174
 			CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
126 175
 			LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
... ...
@@ -159,13 +208,13 @@ install: build
159 208
 	# make group packages
160 209
 	$(call PACKAGE_GRP_INSTALL_template)
161 210
 	$(call PACKAGE_EXTRA_INSTALL_template)
162
-	mv $(CURDIR)/debian/kamailio-berkeley-modules/usr/sbin/kambdb_recover \
163
-		$(CURDIR)/debian/kamailio-berkeley-bin/usr/sbin/kambdb_recover
211
+	mv $(D)-berkeley-modules/usr/sbin/kambdb_recover \
212
+		$(D)-berkeley-bin/usr/sbin/kambdb_recover
164 213
 	# install /etc/default/kamailio file
165
-	mkdir -p $(CURDIR)/debian/kamailio/etc/default
166
-	cp -f debian/kamailio.default $(CURDIR)/debian/kamailio/etc/default/kamailio
214
+	mkdir -p $(D)/etc/default
215
+	cp -f debian/kamailio.default $(D)/etc/default/kamailio
167 216
 	# delete /run/kamailio dir
168
-	rm -rf $(CURDIR)/debian/kamailio/usr/local
217
+	rm -rf $(D)/usr/local
169 218
 
170 219
 
171 220
 # This single target is used to build all the packages, all at once, or
... ...
@@ -213,16 +262,5 @@ binary-arch: build install
213 262
 binary-%: build install
214 263
 	$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
215 264
 
216
-print-version:
217
-	@@echo "Debian version:          $(DEBVERSION)"
218
-	@@echo "Upstream version:        $(UPVERSION)"
219
-
220
-get-orig-source:
221
-	@@dh_testdir
222
-	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
223
-	@@echo Downloading $(FILENAME) from $(URL) ...
224
-	@@wget -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
225
-
226 265
 binary: binary-indep binary-arch
227 266
 .PHONY: build clean binary-indep binary-arch binary install configure
228
-
... ...
@@ -1,54 +1,113 @@
1 1
 #!/usr/bin/make -f
2
-# Sample debian/rules that uses debhelper.
3
-# GNU copyright 1997 to 1999 by Joey Hess.
4 2
 
5
-DEBVERSION:=$(shell head -n 1 debian/changelog \
6
-                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
7
-UPVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
8
-
9
-FILENAME := kamailio_$(UPVERSION).orig.tar.gz
10
-URL := http://www.kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)_src.tar.gz
11
-
12
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
3
+# Uncomment this to turn on verbose mode.
4
+#export DH_VERBOSE=1
13 5
 
14 6
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15 7
 DPKG_EXPORT_BUILDFLAGS = 1
8
+
9
+include /usr/share/dpkg/architecture.mk
16 10
 include /usr/share/dpkg/buildflags.mk
11
+include /usr/share/dpkg/pkg-info.mk
17 12
 
18
-# Uncomment this to turn on verbose mode.
19
-#export DH_VERBOSE=1
13
+# Enable parallel builds.
14
+NUMJOBS = 1
15
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17
+  MAKEFLAGS += -j$(NUMJOBS)
18
+endif
20 19
 
21 20
 export RADCLI=1
22 21
 
23
-# modules not in the "main" kamailio package
24
-EXCLUDED_MODULES= java nats
25
-
26
-# extra modules to skip, because they are not compilable now
27
-# - regardless if they go to the main kamailio package or to some module package,
28
-# they will be excluded from compile and install of all
29
-EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy mi_xmlrpc dnssec
30
-
31
-# module groups that are packaged in separate packages
32
-# (with the name kamailio-$(group_name)-modules)
22
+# Modules not in the "main" kamailio package:
23
+EXCLUDED_MODULES =
24
+
25
+# Extra modules to skip, because they are not compilable now:
26
+# - regardless if they go to the main kamailio package or to some module
27
+#   package, they will be excluded from compile and install of all.
28
+EXTRA_EXCLUDED_MODULES += bdb
29
+EXTRA_EXCLUDED_MODULES += dbtext
30
+EXTRA_EXCLUDED_MODULES += oracle
31
+EXTRA_EXCLUDED_MODULES += pa
32
+EXTRA_EXCLUDED_MODULES += iptrtpproxy
33
+EXTRA_EXCLUDED_MODULES += dnssec
34
+EXTRA_EXCLUDED_MODULES += java
35
+EXTRA_EXCLUDED_MODULES += nats
36
+## --EXCLUDED--
37
+
38
+
39
+# Module groups that are packaged in seperate packages (with the name
40
+# kamailio-$(group_name)-modules).
33 41
 # Note: the order is important (should be in dependency order, the one
34 42
 # on which other depend first)
35
-PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \
36
-			   ldap xml perl utils lua memcached \
37
-			   snmpstats carrierroute xmpp cpl redis python geoip geoip2 \
38
-			   sqlite json mono ruby ims sctp \
39
-			   tls outbound websocket autheph kazoo cnxcc \
40
-			   erlang systemd phonenum mongodb rabbitmq python3 mqtt secsipid lwsc
43
+PACKAGE_GROUPS += mysql
44
+PACKAGE_GROUPS += postgres
45
+PACKAGE_GROUPS += berkeley
46
+PACKAGE_GROUPS += unixodbc
47
+PACKAGE_GROUPS += radius
48
+PACKAGE_GROUPS += presence
49
+PACKAGE_GROUPS += ldap
50
+PACKAGE_GROUPS += xml
51
+PACKAGE_GROUPS += perl
52
+PACKAGE_GROUPS += utils
53
+PACKAGE_GROUPS += lua
54
+PACKAGE_GROUPS += memcached
55
+PACKAGE_GROUPS += snmpstats
56
+PACKAGE_GROUPS += carrierroute
57
+PACKAGE_GROUPS += xmpp
58
+PACKAGE_GROUPS += cpl
59
+PACKAGE_GROUPS += redis
60
+PACKAGE_GROUPS += python
61
+PACKAGE_GROUPS += geoip
62
+PACKAGE_GROUPS += geoip2
63
+PACKAGE_GROUPS += sqlite
64
+PACKAGE_GROUPS += json
65
+PACKAGE_GROUPS += mono
66
+PACKAGE_GROUPS += ruby
67
+PACKAGE_GROUPS += ims
68
+PACKAGE_GROUPS += sctp
69
+PACKAGE_GROUPS += tls
70
+PACKAGE_GROUPS += outbound
71
+PACKAGE_GROUPS += websocket
72
+PACKAGE_GROUPS += autheph
73
+PACKAGE_GROUPS += kazoo
74
+PACKAGE_GROUPS += cnxcc
75
+PACKAGE_GROUPS += erlang
76
+PACKAGE_GROUPS += systemd
77
+PACKAGE_GROUPS += phonenum
78
+PACKAGE_GROUPS += mongodb
79
+PACKAGE_GROUPS += rabbitmq
80
+PACKAGE_GROUPS += python3
81
+PACKAGE_GROUPS += mqtt
82
+PACKAGE_GROUPS += secsipid
83
+PACKAGE_GROUPS += lwsc
84
+
85
+# Module groups to be packaged onto kamailio-extra-modules.
86
+EXTRA_GROUPS += ev
87
+EXTRA_GROUPS += gzcompress
88
+EXTRA_GROUPS += jansson
89
+EXTRA_GROUPS += uuid
90
+EXTRA_GROUPS += http_async
91
+
92
+D = $(CURDIR)/debian/$(DEB_SOURCE)
93
+
94
+# Name of libdir in the path for libraries (e.g., the multiarch triplet).
95
+export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
41 96
 
42
-# module groups to be packaged onto kamailio-extra-modules
43
-EXTRA_GROUPS=gzcompress uuid ev jansson http_async
97
+# Directories with possible duplicate libraries (that should be deleted
98
+# from current module* packages).
99
+DUP_LIBS_DIRS = $(D)/usr/$(LIBDIR)/kamailio \
100
+                $(D)-db-modules/usr/$(LIBDIR)/kamailio
44 101
 
45
-# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b)
46
-export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
102
+# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
103
+CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
104
+CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
105
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
106
+# LDFLAGS -> LD_EXTRA_OPTS
107
+LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
47 108
 
48
-# directories with possible duplicate libraries (that should be deleted
49
-# from current module* packages)
50
-DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \
51
-			$(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio
109
+# https://wiki.debian.org/ReproducibleBuilds/
110
+CC_EXTRA_OPTS += -DVERSION_NODATE
52 111
 
53 112
 # "function" to get package short name out of a dir/module_name
54 113
 # it also transforms db_foo into foo
... ...
@@ -64,18 +123,18 @@ endef
64 123
 define PACKAGE_GRP_INSTALL_template
65 124
 	$(foreach grp,$(PACKAGE_GROUPS),\
66 125
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
67
-		BASEDIR=$(CURDIR)/debian/kamailio-$(grp)-modules \
68
-		cfg_prefix=$(CURDIR)/debian/kamailio-$(grp)-modules \
69
-		doc-dir=share/doc/kamailio-$(grp)-modules quiet=verbose
126
+		BASEDIR=$(D)-$(grp)-modules \
127
+		cfg_prefix=$(D)-$(grp)-modules \
128
+		doc-dir=share/doc/$(DEB_SOURCE)-$(grp)-modules quiet=verbose
70 129
 		# eliminate duplicate libs
71 130
 		-for d in $(DUP_LIBS_DIRS); do \
72
-			test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
131
+			test "$$d" != "$(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
73 132
 			for r in `find $$d -name 'lib*'|xargs`; do \
74 133
 				echo "removing $(grp) lib `basename $$r` present also in $$d";\
75
-				rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
134
+				rm -f $(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
76 135
 			done ; \
77 136
 		done
78
-		find $(CURDIR)/debian/kamailio-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
137
+		find $(D)-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
79 138
 	)
80 139
 endef
81 140
 
... ...
@@ -89,38 +148,28 @@ endef
89 148
 define PACKAGE_EXTRA_INSTALL_template
90 149
 	$(foreach grp,$(EXTRA_GROUPS),\
91 150
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
92
-		BASEDIR=$(CURDIR)/debian/kamailio-extra-modules \
93
-		cfg_prefix=$(CURDIR)/debian/kamailio-extra-modules \
94
-		doc-dir=share/doc/kamailio-extra-modules quiet=verbose
151
+		BASEDIR=$(D)-extra-modules \
152
+		cfg_prefix=$(D)-extra-modules \
153
+		doc-dir=share/doc/$(DEB_SOURCE)-extra-modules quiet=verbose
95 154
 	)
96 155
 	# eliminate duplicate libs
97 156
 	-for d in $(DUP_LIBS_DIRS); do \
98
-		test "$$d" != "$(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio" &&\
157
+		test "$$d" != "$(D)-extra-modules/usr/$(LIBDIR)/kamailio" &&\
99 158
 		for r in `find $$d -name 'lib*'|xargs`; do \
100 159
 			echo "removing extra lib `basename $$r` present also in $$d";\
101
-			rm -f $(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
160
+			rm -f $(D)-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
102 161
 		done ; \
103 162
 	done
104
-	find $(CURDIR)/debian/kamailio-extra-modules -depth -empty -type d -exec rmdir {} \;
163
+	find $(D)-extra-modules -depth -empty -type d -exec rmdir {} \;
105 164
 endef
106 165
 
107
-# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
108
-CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
109
-CC_EXTRA_OPTS += $(shell DEB_CFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CFLAGS)
110
-CXXFLAGS := $(shell DEB_CXXFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CXXFLAGS)
111
-# LDFLAGS -> LD_EXTRA_OPTS
112
-LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
113
-
114
-# https://wiki.debian.org/ReproducibleBuilds/
115
-CC_EXTRA_OPTS += -DVERSION_NODATE
116
-
117 166
 configure: configure-stamp
118 167
 configure-stamp:
119 168
 	dh_testdir
120 169
 	# Add here commands to configure the package.
121
-	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/kamailio \
170
+	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(D) \
122 171
 			cfg_target=/etc/kamailio/ \
123
-			BASEDIR=$(CURDIR)/debian/kamailio \
172
+			BASEDIR=$(D) \
124 173
 			skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
125 174
 			CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
126 175
 			LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
... ...
@@ -159,13 +208,13 @@ install: build
159 208
 	# make group packages
160 209
 	$(call PACKAGE_GRP_INSTALL_template)
161 210
 	$(call PACKAGE_EXTRA_INSTALL_template)
162
-	mv $(CURDIR)/debian/kamailio-berkeley-modules/usr/sbin/kambdb_recover \
163
-		$(CURDIR)/debian/kamailio-berkeley-bin/usr/sbin/kambdb_recover
211
+	mv $(D)-berkeley-modules/usr/sbin/kambdb_recover \
212
+		$(D)-berkeley-bin/usr/sbin/kambdb_recover
164 213
 	# install /etc/default/kamailio file
165
-	mkdir -p $(CURDIR)/debian/kamailio/etc/default
166
-	cp -f debian/kamailio.default $(CURDIR)/debian/kamailio/etc/default/kamailio
214
+	mkdir -p $(D)/etc/default
215
+	cp -f debian/kamailio.default $(D)/etc/default/kamailio
167 216
 	# delete /run/kamailio dir
168
-	rm -rf $(CURDIR)/debian/kamailio/usr/local
217
+	rm -rf $(D)/usr/local
169 218
 
170 219
 
171 220
 # This single target is used to build all the packages, all at once, or
... ...
@@ -213,16 +262,5 @@ binary-arch: build install
213 262
 binary-%: build install
214 263
 	$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
215 264
 
216
-print-version:
217
-	@@echo "Debian version:          $(DEBVERSION)"
218
-	@@echo "Upstream version:        $(UPVERSION)"
219
-
220
-get-orig-source:
221
-	@@dh_testdir
222
-	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
223
-	@@echo Downloading $(FILENAME) from $(URL) ...
224
-	@@wget -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
225
-
226 265
 binary: binary-indep binary-arch
227 266
 .PHONY: build clean binary-indep binary-arch binary install configure
228
-
... ...
@@ -1,54 +1,113 @@
1 1
 #!/usr/bin/make -f
2
-# Sample debian/rules that uses debhelper.
3
-# GNU copyright 1997 to 1999 by Joey Hess.
4 2
 
5
-DEBVERSION:=$(shell head -n 1 debian/changelog \
6
-                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
7
-UPVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
8
-
9
-FILENAME := kamailio_$(UPVERSION).orig.tar.gz
10
-URL := http://www.kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)_src.tar.gz
11
-
12
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
3
+# Uncomment this to turn on verbose mode.
4
+#export DH_VERBOSE=1
13 5
 
14 6
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
15 7
 DPKG_EXPORT_BUILDFLAGS = 1
8
+
9
+include /usr/share/dpkg/architecture.mk
16 10
 include /usr/share/dpkg/buildflags.mk
11
+include /usr/share/dpkg/pkg-info.mk
17 12
 
18
-# Uncomment this to turn on verbose mode.
19
-#export DH_VERBOSE=1
13
+# Enable parallel builds.
14
+NUMJOBS = 1
15
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16
+  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17
+  MAKEFLAGS += -j$(NUMJOBS)
18
+endif
20 19
 
21 20
 export RADCLI=1
22 21
 
23
-# modules not in the "main" kamailio package
24
-EXCLUDED_MODULES= java nats
25
-
26
-# extra modules to skip, because they are not compilable now
27
-# - regardless if they go to the main kamailio package or to some module package,
28
-# they will be excluded from compile and install of all
29
-EXTRA_EXCLUDED_MODULES=bdb dbtext oracle pa iptrtpproxy mi_xmlrpc dnssec secsipid lwsc
30
-
31
-# module groups that are packaged in separate packages
32
-# (with the name kamailio-$(group_name)-modules)
22
+# Modules not in the "main" kamailio package:
23
+EXCLUDED_MODULES =
24
+
25
+# Extra modules to skip, because they are not compilable now:
26
+# - regardless if they go to the main kamailio package or to some module
27
+#   package, they will be excluded from compile and install of all.
28
+EXTRA_EXCLUDED_MODULES += bdb
29
+EXTRA_EXCLUDED_MODULES += dbtext
30
+EXTRA_EXCLUDED_MODULES += oracle
31
+EXTRA_EXCLUDED_MODULES += pa
32
+EXTRA_EXCLUDED_MODULES += iptrtpproxy
33
+EXTRA_EXCLUDED_MODULES += dnssec
34
+EXTRA_EXCLUDED_MODULES += java
35
+EXTRA_EXCLUDED_MODULES += secsipid
36
+EXTRA_EXCLUDED_MODULES += lwsc
37
+EXTRA_EXCLUDED_MODULES += nats
38
+## --EXCLUDED--
39
+
40
+
41
+# Module groups that are packaged in seperate packages (with the name
42
+# kamailio-$(group_name)-modules).
33 43
 # Note: the order is important (should be in dependency order, the one
34 44
 # on which other depend first)
35
-PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \
36
-			   ldap xml perl utils lua memcached \
37
-			   snmpstats carrierroute xmpp cpl redis python geoip geoip2 \
38
-			   sqlite json mono ruby ims sctp \
39
-			   tls outbound websocket autheph kazoo cnxcc \
40
-			   erlang systemd phonenum mongodb rabbitmq python3 mqtt
45
+PACKAGE_GROUPS += mysql
46
+PACKAGE_GROUPS += postgres
47
+PACKAGE_GROUPS += berkeley
48
+PACKAGE_GROUPS += unixodbc
49
+PACKAGE_GROUPS += radius
50
+PACKAGE_GROUPS += presence
51
+PACKAGE_GROUPS += ldap
52
+PACKAGE_GROUPS += xml
53
+PACKAGE_GROUPS += perl
54
+PACKAGE_GROUPS += utils
55
+PACKAGE_GROUPS += lua
56
+PACKAGE_GROUPS += memcached
57
+PACKAGE_GROUPS += snmpstats
58
+PACKAGE_GROUPS += carrierroute
59
+PACKAGE_GROUPS += xmpp
60
+PACKAGE_GROUPS += cpl
61
+PACKAGE_GROUPS += redis
62
+PACKAGE_GROUPS += python
63
+PACKAGE_GROUPS += geoip
64
+PACKAGE_GROUPS += geoip2
65
+PACKAGE_GROUPS += sqlite
66
+PACKAGE_GROUPS += json
67
+PACKAGE_GROUPS += mono
68
+PACKAGE_GROUPS += ruby
69
+PACKAGE_GROUPS += ims
70
+PACKAGE_GROUPS += sctp
71
+PACKAGE_GROUPS += tls
72
+PACKAGE_GROUPS += outbound
73
+PACKAGE_GROUPS += websocket
74
+PACKAGE_GROUPS += autheph
75
+PACKAGE_GROUPS += kazoo
76
+PACKAGE_GROUPS += cnxcc
77
+PACKAGE_GROUPS += erlang
78
+PACKAGE_GROUPS += systemd
79
+PACKAGE_GROUPS += phonenum
80
+PACKAGE_GROUPS += mongodb
81
+PACKAGE_GROUPS += rabbitmq
82
+PACKAGE_GROUPS += python3
83
+PACKAGE_GROUPS += mqtt
84
+
85
+# Module groups to be packaged onto kamailio-extra-modules.
86
+EXTRA_GROUPS += ev
87
+EXTRA_GROUPS += gzcompress
88
+EXTRA_GROUPS += jansson
89
+EXTRA_GROUPS += uuid
90
+EXTRA_GROUPS += http_async
91
+
92
+D = $(CURDIR)/debian/$(DEB_SOURCE)
93
+
94
+# Name of libdir in the path for libraries (e.g., the multiarch triplet).
95
+export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
41 96
 
42
-# module groups to be packaged onto kamailio-extra-modules
43
-EXTRA_GROUPS=gzcompress uuid ev jansson http_async
97
+# Directories with possible duplicate libraries (that should be deleted
98
+# from current module* packages).
99
+DUP_LIBS_DIRS = $(D)/usr/$(LIBDIR)/kamailio \
100
+                $(D)-db-modules/usr/$(LIBDIR)/kamailio
44 101
 
45
-# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b)
46
-export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
102
+# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
103
+CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
104
+CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
105
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
106
+# LDFLAGS -> LD_EXTRA_OPTS
107
+LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
47 108
 
48
-# directories with possible duplicate libraries (that should be deleted
49
-# from current module* packages)
50
-DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \
51
-			$(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio
109
+# https://wiki.debian.org/ReproducibleBuilds/
110
+CC_EXTRA_OPTS += -DVERSION_NODATE
52 111
 
53 112
 # "function" to get package short name out of a dir/module_name
54 113
 # it also transforms db_foo into foo
... ...
@@ -64,18 +123,18 @@ endef
64 123
 define PACKAGE_GRP_INSTALL_template
65 124
 	$(foreach grp,$(PACKAGE_GROUPS),\
66 125
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
67
-		BASEDIR=$(CURDIR)/debian/kamailio-$(grp)-modules \
68
-		cfg_prefix=$(CURDIR)/debian/kamailio-$(grp)-modules \
69
-		doc-dir=share/doc/kamailio-$(grp)-modules quiet=verbose
126
+		BASEDIR=$(D)-$(grp)-modules \
127
+		cfg_prefix=$(D)-$(grp)-modules \
128
+		doc-dir=share/doc/$(DEB_SOURCE)-$(grp)-modules quiet=verbose
70 129
 		# eliminate duplicate libs
71 130
 		-for d in $(DUP_LIBS_DIRS); do \
72
-			test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
131
+			test "$$d" != "$(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\
73 132
 			for r in `find $$d -name 'lib*'|xargs`; do \
74 133
 				echo "removing $(grp) lib `basename $$r` present also in $$d";\
75
-				rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
134
+				rm -f $(D)-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
76 135
 			done ; \
77 136
 		done
78
-		find $(CURDIR)/debian/kamailio-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
137
+		find $(D)-$(grp)-modules -depth -empty -type d -exec rmdir {} \;
79 138
 	)
80 139
 endef
81 140
 
... ...
@@ -89,38 +148,28 @@ endef
89 148
 define PACKAGE_EXTRA_INSTALL_template
90 149
 	$(foreach grp,$(EXTRA_GROUPS),\
91 150
 		$(MAKE) install-modules-all LIBDIR=$(LIBDIR) group_include="k$(grp)" \
92
-		BASEDIR=$(CURDIR)/debian/kamailio-extra-modules \
93
-		cfg_prefix=$(CURDIR)/debian/kamailio-extra-modules \
94
-		doc-dir=share/doc/kamailio-extra-modules quiet=verbose
151
+		BASEDIR=$(D)-extra-modules \
152
+		cfg_prefix=$(D)-extra-modules \
153
+		doc-dir=share/doc/$(DEB_SOURCE)-extra-modules quiet=verbose
95 154
 	)
96 155
 	# eliminate duplicate libs
97 156
 	-for d in $(DUP_LIBS_DIRS); do \
98
-		test "$$d" != "$(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio" &&\
157
+		test "$$d" != "$(D)-extra-modules/usr/$(LIBDIR)/kamailio" &&\
99 158
 		for r in `find $$d -name 'lib*'|xargs`; do \
100 159
 			echo "removing extra lib `basename $$r` present also in $$d";\
101
-			rm -f $(CURDIR)/debian/kamailio-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
160
+			rm -f $(D)-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \
102 161
 		done ; \
103 162
 	done
104
-	find $(CURDIR)/debian/kamailio-extra-modules -depth -empty -type d -exec rmdir {} \;
163
+	find $(D)-extra-modules -depth -empty -type d -exec rmdir {} \;
105 164
 endef
106 165
 
107
-# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
108
-CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
109
-CC_EXTRA_OPTS += $(shell DEB_CFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CFLAGS)
110
-CXXFLAGS := $(shell DEB_CXXFLAGS_MAINT_STRIP=-O2 dpkg-buildflags --get CXXFLAGS)
111
-# LDFLAGS -> LD_EXTRA_OPTS
112
-LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
113
-
114
-# https://wiki.debian.org/ReproducibleBuilds/
115
-CC_EXTRA_OPTS += -DVERSION_NODATE
116
-
117 166
 configure: configure-stamp
118 167
 configure-stamp:
119 168
 	dh_testdir
120 169
 	# Add here commands to configure the package.
121
-	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(CURDIR)/debian/kamailio \
170
+	$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(D) \
122 171
 			cfg_target=/etc/kamailio/ \
123
-			BASEDIR=$(CURDIR)/debian/kamailio \
172
+			BASEDIR=$(D) \
124 173
 			skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
125 174
 			CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
126 175
 			LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
... ...
@@ -159,13 +208,13 @@ install: build
159 208
 	# make group packages
160 209
 	$(call PACKAGE_GRP_INSTALL_template)
161 210
 	$(call PACKAGE_EXTRA_INSTALL_template)
162
-	mv $(CURDIR)/debian/kamailio-berkeley-modules/usr/sbin/kambdb_recover \
163
-		$(CURDIR)/debian/kamailio-berkeley-bin/usr/sbin/kambdb_recover
211
+	mv $(D)-berkeley-modules/usr/sbin/kambdb_recover \
212
+		$(D)-berkeley-bin/usr/sbin/kambdb_recover
164 213
 	# install /etc/default/kamailio file
165
-	mkdir -p $(CURDIR)/debian/kamailio/etc/default
166
-	cp -f debian/kamailio.default $(CURDIR)/debian/kamailio/etc/default/kamailio
214
+	mkdir -p $(D)/etc/default
215
+	cp -f debian/kamailio.default $(D)/etc/default/kamailio
167 216
 	# delete /run/kamailio dir
168
-	rm -rf $(CURDIR)/debian/kamailio/usr/local
217
+	rm -rf $(D)/usr/local
169 218
 
170 219
 
171 220
 # This single target is used to build all the packages, all at once, or
... ...
@@ -213,16 +262,5 @@ binary-arch: build install
213 262
 binary-%: build install
214 263
 	$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
215 264
 
216
-print-version:
217
-	@@echo "Debian version:          $(DEBVERSION)"
218
-	@@echo "Upstream version:        $(UPVERSION)"
219
-
220
-get-orig-source:
221
-	@@dh_testdir
222
-	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
223
-	@@echo Downloading $(FILENAME) from $(URL) ...
224
-	@@wget -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
225
-
226 265
 binary: binary-indep binary-arch
227 266
 .PHONY: build clean binary-indep binary-arch binary install configure
228
-
... ...
@@ -6,43 +6,37 @@ DIST=bionic
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # No dnssec module:
16 10
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
17 11
   ${DIST}/control
18
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
19
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
12
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
13
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
20 14
 
21 15
 # No app_java due lack of gcj-jdk
22 16
 sed -i -e '/gcj-jdk/d' -e '/^Package: kamailio-java-modules/,/^$/d' \
23 17
   ${DIST}/control
24 18
 sed -i -e '/^export JAVA_HOME/d' ${DIST}/rules
25
-sed -i -e 's/ java[ ,$]*/ /' ${DIST}/rules
26
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ java/' ${DIST}/rules
19
+sed -i -e '/^PACKAGE_GROUPS += java/d' ${DIST}/rules
20
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += java' ${DIST}/rules
27 21
 
28 22
 # No secsipid module
29 23
 sed -i -e '/libsecsipid-dev/d' -e '/^Package: kamailio-secsipid-modules/,/^$/d' \
30 24
 	${DIST}/control
31
-sed -i -e 's/ secsipid[ ,$]*/ /' ${DIST}/rules
32
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ secsipid/' ${DIST}/rules
25
+sed -i -e '/^PACKAGE_GROUPS += secsipid/d' ${DIST}/rules
26
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += secsipid' ${DIST}/rules
33 27
 
34 28
 # libwebsockets >= 3.1
35 29
 sed -i -e '/libwebsockets-dev/d' -e '/^Package: kamailio-lwsc-modules/,/^$/d' \
36 30
 	${DIST}/control
37
-sed -i -e 's/ lwsc[ ,$]*/ /' ${DIST}/rules
38
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ lwsc/' ${DIST}/rules
31
+sed -i -e '/^PACKAGE_GROUPS += lwsc/d' ${DIST}/rules
32
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += lwsc' ${DIST}/rules
39 33
 
40 34
 # no libnats-dev
41 35
 sed -i -e '/^ libnats-dev,/d' \
42 36
   -e '/^Package: kamailio-nats-modules/,/^$/d' \
43 37
   ${DIST}/control
44
-sed -i -e 's/ nats[ ,$]*//' ${DIST}/rules
45
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ nats/' ${DIST}/rules
38
+sed -i -e '/^PACKAGE_GROUPS += nats/d' ${DIST}/rules
39
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += nats' ${DIST}/rules
46 40
 
47 41
 wrap-and-sort -sat -d ${DIST}
48 42
 
... ...
@@ -6,24 +6,18 @@ DIST=bookworm
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # No dnssec module:
16 10
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
17 11
   ${DIST}/control
18
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
19
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
12
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
13
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
20 14
 
21 15
 # No app_java due lack of gcj-jdk
22 16
 sed -i -e '/gcj-jdk/d' -e '/^Package: kamailio-java-modules/,/^$/d' \
23 17
   ${DIST}/control
24 18
 sed -i -e '/^export JAVA_HOME/d' ${DIST}/rules
25
-sed -i -e 's/ java[ ,$]*/ /' ${DIST}/rules
26
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ java/' ${DIST}/rules
19
+sed -i -e '/^PACKAGE_GROUPS += java/d' ${DIST}/rules
20
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += java' ${DIST}/rules
27 21
 
28 22
 # no dh-systemd
29 23
 sed -i -e '/dh-systemd/d' ${DIST}/control
... ...
@@ -32,8 +26,8 @@ sed -i -e '/dh-systemd/d' ${DIST}/control
32 26
 sed -i -e '/^ python,/d' -e '/python-dev/d' \
33 27
   -e '/^Package: kamailio-python-modules/,/^$/d' \
34 28
   ${DIST}/control
35
-sed -i -e 's/ python [ ,$]*//' ${DIST}/rules
36
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ python/' ${DIST}/rules
29
+sed -i -e '/^PACKAGE_GROUPS += python$/d' ${DIST}/rules
30
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += python' ${DIST}/rules
37 31
 
38 32
 wrap-and-sort -sat -d ${DIST}
39 33
 
... ...
@@ -6,34 +6,28 @@ DIST=bullseye
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # No dnssec module:
16 10
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
17 11
   ${DIST}/control
18
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
19
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
12
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
13
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
20 14
 
21 15
 # No app_java due lack of gcj-jdk
22 16
 sed -i -e '/gcj-jdk/d' -e '/^Package: kamailio-java-modules/,/^$/d' \
23 17
   ${DIST}/control
24 18
 sed -i -e '/^export JAVA_HOME/d' ${DIST}/rules
25
-sed -i -e 's/ java[ ,$]*/ /' ${DIST}/rules
26
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ java/' ${DIST}/rules
19
+sed -i -e '/^PACKAGE_GROUPS += java/d' ${DIST}/rules
20
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += java' ${DIST}/rules
27 21
 
28
-# No dh-systemd
22
+# no dh-systemd
29 23
 sed -i -e '/dh-systemd/d' ${DIST}/control
30 24
 
31 25
 # no libnats-dev
32 26
 sed -i -e '/^ libnats-dev,/d' \
33 27
   -e '/^Package: kamailio-nats-modules/,/^$/d' \
34 28
   ${DIST}/control
35
-sed -i -e 's/ nats[ ,$]*//' ${DIST}/rules
36
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ nats/' ${DIST}/rules
29
+sed -i -e '/^PACKAGE_GROUPS += nats/d' ${DIST}/rules
30
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += nats' ${DIST}/rules
37 31
 
38 32
 wrap-and-sort -sat -d ${DIST}
39 33
 
... ...
@@ -6,43 +6,37 @@ DIST=buster
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # No dnssec module:
16 10
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
17 11
   ${DIST}/control
18
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
19
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
12
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
13
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
20 14
 
21 15
 # No app_java due lack of gcj-jdk
22 16
 sed -i -e '/gcj-jdk/d' -e '/^Package: kamailio-java-modules/,/^$/d' \
23 17
   ${DIST}/control
24 18
 sed -i -e '/^export JAVA_HOME/d' ${DIST}/rules
25
-sed -i -e 's/ java[ ,$]*/ /' ${DIST}/rules
26
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ java/' ${DIST}/rules
19
+sed -i -e '/^PACKAGE_GROUPS += java/d' ${DIST}/rules
20
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += java' ${DIST}/rules
27 21
 
28 22
 # No secsipid module
29 23
 sed -i -e '/libsecsipid-dev/d' -e '/^Package: kamailio-secsipid-modules/,/^$/d' \
30 24
 	${DIST}/control
31
-sed -i -e 's/ secsipid[ ,$]*/ /' ${DIST}/rules
32
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ secsipid/' ${DIST}/rules
25
+sed -i -e '/^PACKAGE_GROUPS += secsipid/d' ${DIST}/rules
26
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += secsipid' ${DIST}/rules
33 27
 
34 28
 # libwebsockets >= 3.1
35 29
 sed -i -e '/libwebsockets-dev/d' -e '/^Package: kamailio-lwsc-modules/,/^$/d' \
36 30
 	${DIST}/control
37
-sed -i -e 's/ lwsc[ ,$]*/ /' ${DIST}/rules
38
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ lwsc/' ${DIST}/rules
31
+sed -i -e '/^PACKAGE_GROUPS += lwsc/d' ${DIST}/rules
32
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += lwsc' ${DIST}/rules
39 33
 
40 34
 # no libnats-dev
41 35
 sed -i -e '/^ libnats-dev,/d' \
42 36
   -e '/^Package: kamailio-nats-modules/,/^$/d' \
43 37
   ${DIST}/control
44
-sed -i -e 's/ nats[ ,$]*//' ${DIST}/rules
45
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ nats/' ${DIST}/rules
38
+sed -i -e '/^PACKAGE_GROUPS += nats/d' ${DIST}/rules
39
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += nats' ${DIST}/rules
46 40
 
47 41
 wrap-and-sort -sat -d ${DIST}
48 42
 
... ...
@@ -6,37 +6,31 @@ DIST=focal
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # No dnssec module:
16 10
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
17 11
   ${DIST}/control
18
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
19
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
12
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
13
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
20 14
 
21 15
 # No app_java due lack of gcj-jdk
22 16
 sed -i -e '/gcj-jdk/d' -e '/^Package: kamailio-java-modules/,/^$/d' \
23 17
   ${DIST}/control
24 18
 sed -i -e '/^export JAVA_HOME/d' ${DIST}/rules
25
-sed -i -e 's/ java[ ,$]*/ /' ${DIST}/rules
26
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ java/' ${DIST}/rules
19
+sed -i -e '/^PACKAGE_GROUPS += java/d' ${DIST}/rules
20
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += java' ${DIST}/rules
27 21
 
28 22
 # No secsipid module
29 23
 sed -i -e '/libsecsipid-dev/d' -e '/^Package: kamailio-secsipid-modules/,/^$/d' \
30 24
 	${DIST}/control
31
-sed -i -e 's/ secsipid[ ,$]*/ /' ${DIST}/rules
32
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ secsipid/' ${DIST}/rules
25
+sed -i -e '/^PACKAGE_GROUPS += secsipid/d' ${DIST}/rules
26
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += secsipid' ${DIST}/rules
33 27
 
34 28
 # no libnats-dev
35 29
 sed -i -e '/^ libnats-dev,/d' \
36 30
   -e '/^Package: kamailio-nats-modules/,/^$/d' \
37 31
   ${DIST}/control
38
-sed -i -e 's/ nats[ ,$]*//' ${DIST}/rules
39
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ nats/' ${DIST}/rules
32
+sed -i -e '/^PACKAGE_GROUPS += nats/d' ${DIST}/rules
33
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += nats' ${DIST}/rules
40 34
 
41 35
 wrap-and-sort -sat -d ${DIST}
42 36
 
... ...
@@ -6,12 +6,6 @@ DIST=jessie
6 6
 rm -rf ${DIST}
7 7
 cp -r debian ${DIST}
8 8
 
9
-# No mi_xmlrpc module
10
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
11
-	${DIST}/control
12
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
13
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
14
-
15 9
 # use old libfreeradius
16 10
 sed -i 's/libradcli-dev/libfreeradius-client-dev/' ${DIST}/control
17 11
 sed -i -e 's/RADCLI/FREERADIUS/' ${DIST}/rules
... ...
@@ -27,39 +21,39 @@ echo "kamailio-mysql-modules: depends-on-obsolete-package depends: mysql-client
27 21
 # No geoip2 module
28 22
 sed -i -e '/libmaxminddb-dev/d' -e '/^Package: kamailio-geoip2-modules/,/^$/d' \
29 23
 	${DIST}/control
30
-sed -i -e 's/ geoip2[ ,$]*/ /' ${DIST}/rules
31
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ geoip2/' ${DIST}/rules
24
+sed -i -e '/^PACKAGE_GROUPS += geoip2/d' ${DIST}/rules
25
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += geoip2' ${DIST}/rules
32 26
 
33 27
 # No phonenum module
34 28
 sed -i -e '/libphonenumber-dev/d' -e '/^Package: kamailio-phonenum-modules/,/^$/d' \
35 29
 	${DIST}/control
36
-sed -i -e 's/ phonenum[ ,$]*/ /' ${DIST}/rules
37
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ phonenum/' ${DIST}/rules
30
+sed -i -e '/^PACKAGE_GROUPS += phonenum/d' ${DIST}/rules
31
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += phonenum' ${DIST}/rules
38 32
 
39 33
 # Mo mongodb
40 34
 sed -i -e '/libmongoc-dev/d' -e '/^Package: kamailio-mongodb-modules/,/^$/d' \
41 35
 	${DIST}/control
42
-sed -i -e 's/ mongodb[ ,$]*/ /' ${DIST}/rules
43
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mongodb/' ${DIST}/rules
36
+sed -i -e '/^PACKAGE_GROUPS += mongodb/d' ${DIST}/rules
37
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += mongodb' ${DIST}/rules
44 38
 
45 39
 # No secsipid module
46 40
 sed -i -e '/libsecsipid-dev/d' -e '/^Package: kamailio-secsipid-modules/,/^$/d' \
47 41
 	${DIST}/control
48
-sed -i -e 's/ secsipid[ ,$]*/ /' ${DIST}/rules
49
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ secsipid/' ${DIST}/rules
42
+sed -i -e '/^PACKAGE_GROUPS += secsipid/d' ${DIST}/rules
43
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += secsipid' ${DIST}/rules
50 44
 
51 45
 # libwebsockets >= 3.1
52 46
 sed -i -e '/libwebsockets-dev/d' -e '/^Package: kamailio-lwsc-modules/,/^$/d' \
53 47
 	${DIST}/control
54
-sed -i -e 's/ lwsc[ ,$]*/ /' ${DIST}/rules
55
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ lwsc/' ${DIST}/rules
48
+sed -i -e '/^PACKAGE_GROUPS += lwsc/d' ${DIST}/rules
49
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += lwsc' ${DIST}/rules
56 50
 
57 51
 # no libnats-dev
58 52
 sed -i -e '/^ libnats-dev,/d' \
59 53
   -e '/^Package: kamailio-nats-modules/,/^$/d' \
60 54
   ${DIST}/control
61
-sed -i -e 's/ nats[ ,$]*//' ${DIST}/rules
62
-sed -i -e '/^EXCLUDED_MODULES=/s/$/ nats/' ${DIST}/rules
55
+sed -i -e '/^PACKAGE_GROUPS += nats/d' ${DIST}/rules
56
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += nats' ${DIST}/rules
63 57
 
64 58
 wrap-and-sort -sat -d ${DIST}
65 59
 
... ...
@@ -11,17 +11,11 @@ sed -i -e '/dh-systemd/d' ${DIST}/control
11 11
 sed -i -e '/dh_systemd/d' ${DIST}/rules
12 12
 rm ${DIST}/kamailio.service
13 13
 
14
-# No mi_xmlrpc module
15
-sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
16
-	${DIST}/control
17
-sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
18
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules
19
-
20 14
 # No dnssec module:
21 15
 sed -i -e '/libval-dev/d' -e '/^Package: kamailio-dnssec-modules/,/^$/d' \
22
-	${DIST}/control
23
-sed -i -e 's/ dnssec[ ,$]*/ /' ${DIST}/rules
24
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ dnssec/' ${DIST}/rules
16
+  ${DIST}/control
17
+sed -i -e '/^PACKAGE_GROUPS += dnssec/d' ${DIST}/rules
18
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += dnssec' ${DIST}/rules
25 19
 
26 20
 # use old radius-client-ng
27 21
 sed -i 's/libradcli-dev/libradiusclient-ng-dev/' ${DIST}/control
... ...
@@ -33,19 +27,19 @@ sed -i 's/libjson-c-dev/libjson0-dev/' ${DIST}/control
33 27
 # no kazoo module
34 28
 sed -i -e '/librabbitmq-dev/d' -e '/^Package: kamailio-kazoo-modules/,/^$/d' \
35 29
 	${DIST}/control
36
-sed -i -e 's/ kazoo[ ,$]*/ /' ${DIST}/rules
37
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ kazoo/' ${DIST}/rules
30
+sed -i -e '/^PACKAGE_GROUPS += kazoo/d' ${DIST}/rules
31
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += kazoo' ${DIST}/rules
38 32
 
39 33
 # no cnxcc module
40 34
 sed -i -e '/^Package: kamailio-cnxcc-modules/,/^$/d' ${DIST}/control
41
-sed -i -e 's/ cnxcc[ ,$]*/ /' ${DIST}/rules
42
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ cnxcc/' ${DIST}/rules
35
+sed -i -e '/^PACKAGE_GROUPS += cnxcc/d' ${DIST}/rules
36
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += cnxcc' ${DIST}/rules
43 37
 
44 38
 # no systemd module
45 39
 sed -i -e '/libsystemd-dev/d' -e '/^Package: kamailio-systemd-modules/,/^$/d' \
46 40
   ${DIST}/control
47
-sed -i -e 's/ systemd[ ,$]*/ /' ${DIST}/rules
48
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ systemd/' ${DIST}/rules
41
+sed -i -e '/^PACKAGE_GROUPS += systemd/d' ${DIST}/rules
42
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += systemd' ${DIST}/rules
49 43
 
50 44
 # old mysql
51 45
 sed -i -e 's/default-mysql-client/mysql-client/' \
... ...
@@ -61,32 +55,32 @@ sed -i -e '/libssl-dev/d' ${DIST}/control
61 55
 # no rabbitmq
62 56
 sed -i -e '/librabbitmq-dev/d' \
63 57
   -e '/^Package: kamailio-rabbitmq-modules/,/^$/d' ${DIST}/control
64
-sed -i -e 's/ rabbitmq[ ,$]*/ /' ${DIST}/rules
65
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ rabbitmq/' ${DIST}/rules
58
+sed -i -e '/^PACKAGE_GROUPS += rabbitmq/d' ${DIST}/rules
59
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += rabbitmq' ${DIST}/rules
66 60
 
67 61
 # No geoip2 module
68 62
 sed -i -e '/libmaxminddb-dev/d' -e '/^Package: kamailio-geoip2-modules/,/^$/d' \
69 63
 	${DIST}/control
70
-sed -i -e 's/ geoip2[ ,$]*/ /' ${DIST}/rules
71
-sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ geoip2/' ${DIST}/rules
64
+sed -i -e '/^PACKAGE_GROUPS += geoip2/d' ${DIST}/rules
65
+sed -i -e '/--EXCLUDED--/i EXTRA_EXCLUDED_MODULES += geoip2' ${DIST}/rules
72 66
 
73 67
 # No phonenum module
74 68
 sed -i -e '/libphonenumber-dev/d' -e '/^Package: kamailio-phonenum-modules/,/^$/d' \
75 69
 	${DIST}/control
76