File: rules

package info (click to toggle)
asterisk 1%3A1.2.13~dfsg-2etch4
  • links: PTS
  • area: main
  • in suites: etch
  • size: 14,116 kB
  • ctags: 18,540
  • sloc: ansic: 202,323; sh: 21,940; makefile: 2,296; perl: 1,908; cpp: 1,605; yacc: 815; asm: 642; tcl: 113; php: 62; sql: 50; xml: 36
file content (242 lines) | stat: -rwxr-xr-x 7,842 bytes parent folder | download
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess. 

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

export PROC := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)

MAKEFLAGS = OPTIMIZE=-O2 MAKECMDGOALS=dont-optimize

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

export OPENH323DIR=/usr/share/openh323
export PWLIBDIR=/usr/share/pwlib

include /usr/share/dpatch/dpatch.make

DEBVERSION:=$(shell head -n 1 debian/changelog \
		    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/~dfsg$$//')
#UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-.*$$//' -e 's/~dfsg$$//')

FILENAME := asterisk_$(UPVERSION)~dfsg.orig.tar.gz
UPFILENAME := asterisk_$(UPVERSION).orig.tar.gz
URL := http://downloads.digium.com/pub/asterisk/releases/asterisk-$(UPVERSION).tar.gz


check-sounds:
	( [ ! -f sounds/fpm-calm-river.mp3 ] && \
	  [ ! -f sounds/fpm-sunshine.mp3 ]   && \
	  [ ! -f sounds/fpm-world-mix.mp3 ] ) || \
		(echo "WARNING: fpm sounds must to be removed from sources before packaging." ; false )
	touch $@
	
BRISTUFF_DIR=debian/build/asterisk-bristuff
config.status: check-sounds patch-stamp
	dh_testdir
	# Add here commands to configure the package.
	touch .cleancount
	- (cd editline ; \
	if [ -f config.sub.old ]; then \
	  rm -f config.sub; \
	else \
	  mv config.sub config.sub.old; \
	fi; \
	if [ -f config.guess.old ]; then \
	  rm -f config.guess; \
	else \
	  mv config.guess config.guess.old; \
	fi; \
	ln -s /usr/share/misc/config.sub config.sub; \
	ln -s /usr/share/misc/config.guess config.guess; \
	cd ..)

	cd editline;./configure $(confflags)
	touch $@

debian/build/asterisk-bristuff/config.status: config.status check-sounds patch-stamp
	# get ourselves a copy of the source to build bristuff in...
	rm -rf $(BRISTUFF_DIR)
	mkdir -p $(BRISTUFF_DIR)
	tar cf - --exclude ./debian . | (cd $(BRISTUFF_DIR); tar xf -)
	#ls -1d * .version .cleancount|grep -v debian|grep -v ^.$$|xargs cp -alt debian/build/asterisk-bristuff
	set -e; cd $(BRISTUFF_DIR) ; \
	  patch -p1 <../../patches/bristuff.dpatch ; \
	  patch -p1 <../../patches/libpri_bristuffed.dpatch 
	
	cd $(BRISTUFF_DIR)/editline; ./configure $(confflags)
	touch $@

build-arch: build-arch-stamp
build-arch-stamp: config.status debian/build/asterisk-bristuff/config.status
	dh_testdir

	# Add here command to compile/build the package.
	$(MAKE) $(MAKEFLAGS)
	$(MAKE) $(MAKEFLAGS) -C channels/h323 opt
	$(MAKE) $(MAKEFLAGS) -C $(BRISTUFF_DIR)

	touch $@

build-indep: build-indep-stamp
build-indep-stamp: config.status 
	dh_testdir

	# Add here command to compile/build the arch indep package.
	# It's ok not to do anything here, if you don't need to build
	#  anything for this package.
	#/usr/bin/docbook-to-man debian/asterisk.sgml > asterisk.1
ifndef ASTERISK_NO_DOCS
	$(MAKE) progdocs
endif

	touch $@


build: build-arch build-indep

clean: cleaned unpatch 
cleaned:
	dh_testdir
	dh_testroot
	
	# Add here commands to clean up after the build process.
	-test -d channels/h323 && $(MAKE) -C channels/h323 clean
	-$(RM) -f channels/h323/libchanh323.a
	-$(MAKE) clean
	-$(RM) -rf debian/build
	-$(RM) utils/streamplayer
	#-$(RM) -f fxstest ztmonitor ztspeed zttest
	-$(RM) -fR doc/api agi/eagi-test agi/eagi-sphinx-test
	-$(RM) debian/asterisk.8.gz
	-(test -d editline &&cd editline; \
	if [ -f config.sub.old ]; then \
	   mv config.sub.old config.sub; \
	fi; \
	if [ -f config.guess.old ]; then \
	   mv config.guess.old config.guess; \
	fi; \
	cd ..)
	-test -d configs && chmod -x configs/*.sample
	-$(RM) -f build-arch-stamp build-indep-stamp config.status check-sounds

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs var/run/asterisk
	
	# Add here commands to install the package into debian/<packagename>
	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install samples
	cp channels/h323/h323.conf.sample $(CURDIR)/debian/tmp/etc/asterisk/h323.conf
	mkdir -p $(CURDIR)/debian/tmp/etc/default/
	cp debian/asterisk.default $(CURDIR)/debian/tmp/etc/default/asterisk
	mkdir -p $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/
	cp contrib/scripts/vmail.cgi $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/
	chmod +x $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/vmail.cgi
	$(RM) -f $(CURDIR)/debian/tmp/usr/sbin/{stereorize,streamplayer}
	# override some default configurations. Leave the original ones
	# in the sample configs:
	cp -a debian/ast_config/* $(CURDIR)/debian/tmp/etc/asterisk
	
	mkdir -p $(CURDIR)/debian/asterisk/usr/share/asterisk/bin
	cp debian/asterisk_fix $(CURDIR)/debian/asterisk/usr/share/asterisk/bin
	chmod +x $(CURDIR)/debian/asterisk/usr/share/asterisk/bin/asterisk_fix
	
	mkdir -p $(CURDIR)/debian/tmp/usr/share/asterisk/firmware/iax
	
	# bristuff
	$(MAKE) -C $(BRISTUFF_DIR) DESTDIR=$(CURDIR)/debian/tmp/bristuff install
	mkdir -p $(CURDIR)/debian/tmp/bristuff/etc/default/
	cp debian/asterisk.default $(CURDIR)/debian/tmp/bristuff/etc/default/asterisk
	$(RM) -f $(CURDIR)/debian/tmp/bristuff/usr/sbin/{stereorize,streamplayer}
	dh_install --sourcedir=debian/tmp
	
	install -m 644 include/asterisk.h $(CURDIR)/debian/asterisk-dev/usr/include/asterisk.h

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installlogrotate -i 
	dh_installinit -i -- defaults 21
	dh_installdocs -i -XREADME.cygwin
	dh_installexamples -i -XCVS
	dh_installcron -i
	dh_installchangelogs ChangeLog -i
	dh_link -i 
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i


# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installman -pasterisk-classic -pasterisk-bristuff *.[1-8] debian/*.1 debian/*.8
	dh_installexamples -a -XCVS
	dh_installchangelogs ChangeLog -a
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	#rm debian/asterisk/usr/lib/asterisk/modules/pbx_gtkconsole.so
	rm -f debian/asterisk-classic/usr/lib/asterisk/modules/chan_h323.so
	rm -f debian/asterisk-bristuff/usr/lib/asterisk/modules/chan_h323.so
	rm -f debian/asterisk-bristuff/usr/lib/asterisk/modules/*_capi*.so
	dh_makeshlibs -a 
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

print-version:
	@@echo "Debian version:          $(DEBVERSION)"
	@@echo "Upstream version:        $(UPVERSION)"

get-orig-source:
	@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@echo Downloading $(UPFILENAME) from $(URL) ...
	@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
	@@echo Repacking as DFSG-free...
	@@mkdir -p ../tarballs/asterisk-$(UPVERSION).tmp/
	@@cd ../tarballs/asterisk-$(UPVERSION).tmp ; \
	tar xfz ../$(UPFILENAME) 
	@@find ../tarballs/asterisk-$(UPVERSION).tmp -type f -name 'fpm-*.mp3'|xargs -r rm 
	@@rm -rf ../tarballs/asterisk-$(UPVERSION).tmp/asterisk-$(UPVERSION)/codecs/ilbc 
	@@rm -rf ../tarballs/asterisk-$(UPVERSION).tmp/asterisk-$(UPVERSION)/contrib/firmware/
	@@cd ../tarballs/asterisk-$(UPVERSION).tmp ; \
	tar cfz ../$(FILENAME) *
	@@echo Cleaning up...
	@@$(RM) -rf ../tarballs/asterisk-$(UPVERSION).tmp/

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install clean patch unpatch