-
Notifications
You must be signed in to change notification settings - Fork 908
/
rules
executable file
·257 lines (222 loc) · 7.64 KB
/
rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
# Enable parallel builds.
NUMJOBS = 1
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
export RADCLI=1
# Modules not in the "main" kamailio package:
EXCLUDED_MODULES =
# Extra modules to skip, because they are not compilable now:
# - regardless if they go to the main kamailio package or to some module
# package, they will be excluded from compile and install of all.
EXTRA_EXCLUDED_MODULES += bdb
EXTRA_EXCLUDED_MODULES += dbtext
EXTRA_EXCLUDED_MODULES += oracle
EXTRA_EXCLUDED_MODULES += pa
EXTRA_EXCLUDED_MODULES += iptrtpproxy
EXTRA_EXCLUDED_MODULES += dnssec
EXTRA_EXCLUDED_MODULES += java
EXTRA_EXCLUDED_MODULES += secsipid
EXTRA_EXCLUDED_MODULES += nats
EXTRA_EXCLUDED_MODULES += tls_wolfssl
## --EXCLUDED--
# Module groups that are packaged in separate packages (with the name
# kamailio-$(group_name)-modules).
# Note: the order is important (should be in dependency order, the one
# on which other depend first)
PACKAGE_GROUPS += mysql
PACKAGE_GROUPS += postgres
PACKAGE_GROUPS += berkeley
PACKAGE_GROUPS += unixodbc
PACKAGE_GROUPS += radius
PACKAGE_GROUPS += presence
PACKAGE_GROUPS += ldap
PACKAGE_GROUPS += xml
PACKAGE_GROUPS += perl
PACKAGE_GROUPS += utils
PACKAGE_GROUPS += lua
PACKAGE_GROUPS += memcached
PACKAGE_GROUPS += snmpstats
PACKAGE_GROUPS += carrierroute
PACKAGE_GROUPS += xmpp
PACKAGE_GROUPS += cpl
PACKAGE_GROUPS += redis
PACKAGE_GROUPS += python
PACKAGE_GROUPS += geoip
PACKAGE_GROUPS += geoip2
PACKAGE_GROUPS += sqlite
PACKAGE_GROUPS += json
PACKAGE_GROUPS += mono
PACKAGE_GROUPS += ruby
PACKAGE_GROUPS += ims
PACKAGE_GROUPS += sctp
PACKAGE_GROUPS += tls
PACKAGE_GROUPS += outbound
PACKAGE_GROUPS += websocket
PACKAGE_GROUPS += autheph
PACKAGE_GROUPS += kazoo
PACKAGE_GROUPS += cnxcc
PACKAGE_GROUPS += erlang
PACKAGE_GROUPS += systemd
PACKAGE_GROUPS += phonenum
PACKAGE_GROUPS += mongodb
PACKAGE_GROUPS += rabbitmq
PACKAGE_GROUPS += python3
PACKAGE_GROUPS += mqtt
PACKAGE_GROUPS += lwsc
# Module groups to be packaged onto kamailio-extra-modules.
EXTRA_GROUPS += ev
EXTRA_GROUPS += gzcompress
EXTRA_GROUPS += jansson
EXTRA_GROUPS += uuid
EXTRA_GROUPS += http_async
D = $(CURDIR)/debian/$(DEB_SOURCE)
# Name of libdir in the path for libraries (e.g., the multiarch triplet).
export LIBDIR ?= lib/$(DEB_HOST_MULTIARCH)
# Directories with possible duplicate libraries (that should be deleted
# from current module* packages).
DUP_LIBS_DIRS = $(D)/usr/$(LIBDIR)/kamailio \
$(D)-db-modules/usr/$(LIBDIR)/kamailio
# CFLAGS + CPPFLAGS -> CC_EXTRA_OPTS
CC_EXTRA_OPTS := $(shell dpkg-buildflags --get CPPFLAGS)
CC_EXTRA_OPTS += $(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
# LDFLAGS -> LD_EXTRA_OPTS
LD_EXTRA_OPTS := $(shell dpkg-buildflags --get LDFLAGS)
# https://wiki.debian.org/ReproducibleBuilds/
CC_EXTRA_OPTS += -DVERSION_NODATE
BUILD_MODULES := $(addprefix build_, $(PACKAGE_GROUPS) $(EXTRA_GROUPS))
INSTALL_MODULES := $(addprefix install_, $(PACKAGE_GROUPS))
INSTALL_EXTRA := $(addprefix install_, $(EXTRA_GROUPS))
.PHONY: test_build_all $(BUILD_MODULES) $(INSTALL_MODULES) $(INSTALL_EXTRA)
test_build_all: configure
dh_testdir
$(MAKE) all quiet=verbose
$(BUILD_MODULES): test_build_all
$(MAKE) every-module group_include="k$(subst build_,,$@)" quiet=verbose
test_install_all-stamp: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) install quiet=verbose LIBDIR=$(LIBDIR) group_include="kstandard"
touch test_install_all-stamp
$(INSTALL_MODULES): test_install_all-stamp
$(MAKE) install-modules-all \
quiet=verbose \
LIBDIR=$(LIBDIR) \
BASEDIR=$(D)-$(subst install_,,$@)-modules \
cfg_prefix=$(D)-$(subst install_,,$@)-modules \
doc-dir=share/doc/$(DEB_SOURCE)-$(subst install_,,$@)-modules \
group_include="k$(subst install_,,$@)"
# Eliminate duplicate libs.
for d in $(DUP_LIBS_DIRS); do \
test "$$d" != "$(D)-$${module}-modules/usr/$(LIBDIR)/kamailio" && \
for r in `find $$d -name 'lib*' | xargs`; do \
echo "removing $(subst install_,,$@) lib `basename $$r` present also in $$d"; \
rm -f $(D)-$(subst install_,,$@)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"`; \
done ; \
done
# clean empty dirs
find $(D)-$(subst install_,,$@)-modules -depth -empty -type d -exec rmdir {} \;
$(INSTALL_EXTRA): test_install_all-stamp
$(MAKE) install-modules-all \
quiet=verbose \
LIBDIR=$(LIBDIR) \
BASEDIR=$(D)-extra-modules \
cfg_prefix=$(D)-extra-modules \
doc-dir=share/doc/$(DEB_SOURCE)-extra-modules \
group_include="k$(subst install_,,$@)"
# Eliminate duplicate extra libs.
for d in $(DUP_LIBS_DIRS); do \
test "$$d" != "$(D)-extra-modules/usr/$(LIBDIR)/kamailio" && \
for r in `find $$d -name 'lib*' | xargs`; do \
echo "removing extra lib `basename $$r` present also in $$d"; \
rm -f $(D)-extra-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"`; \
done ; \
done
# clean empty dirs
find $(D)-extra-modules -depth -empty -type d -exec rmdir {} \;
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
$(MAKE) FLAVOUR=kamailio cfg prefix=/usr cfg_prefix=$(D) \
cfg_target=/etc/kamailio/ \
BASEDIR=$(D) \
skip_modules="$(EXCLUDED_MODULES) $(EXTRA_EXCLUDED_MODULES)" \
CC_EXTRA_OPTS="$(CC_EXTRA_OPTS)" \
LD_EXTRA_OPTS="$(LD_EXTRA_OPTS)" \
group_include="kstandard" quiet=verbose
touch configure-stamp
build: build-stamp
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure-stamp $(BUILD_MODULES)
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp test_install_all-stamp
# Add here commands to clean up after the build process.
$(MAKE) maintainer-clean
dh_clean
install: build $(INSTALL_MODULES) $(INSTALL_EXTRA)
mv $(D)-berkeley-modules/usr/sbin/kambdb_recover \
$(D)-berkeley-bin/usr/sbin/kambdb_recover
# install /etc/default/kamailio file
mkdir -p $(D)/etc/default
cp -f debian/kamailio.default $(D)/etc/default/kamailio
# delete /run/kamailio dir
rm -rf $(D)/usr/local
# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything you want to only affect one package
# should be put in another target, such as the install target.
binary-common:
dh_testdir
dh_testroot
dh_installdebconf
dh_installdocs
dh_installexamples -Xobsoleted -Xsr
dh_installmenu
dh_systemd_enable -pkamailio
dh_installinit -pkamailio -- defaults 23
dh_systemd_start -pkamailio
dh_installcron
dh_installman
dh_installinfo
dh_lintian
dh_installchangelogs ChangeLog
dh_link
dh_strip --dbg-package=kamailio-dbg
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# Build architecture-independent packages using the common target
binary-indep: build install
# (Uncomment this next line if you have such packages.)
# $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# We have nothing to do by default.
# Build architecture-dependent packages using the common target
binary-arch: build install
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
# Any other binary targets build just one binary package at a time.
binary-%: build install
$(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$*
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure