~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#! /usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

export AUTOMAKE = automake-1.11
export ACLOCAL = aclocal-1.11

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CFLAGS = `dpkg-buildflags --get CFLAGS`
CFLAGS += -Wall
CXXFLAGS = `dpkg-buildflags --get CXXFLAGS`
CXXFLAGS += -Wall
LDFLAGS = `dpkg-buildflags --get LDFLAGS`
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`

DEBUG_OPTS=
STRIP_OPTS=

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
        STRIP_OPTS += dh_strip --dbg-package=clamav-dbg -p$@
else
	DEBUG_OPTS += --enable-debug
endif
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  with_check := disabled by DEB_BUILD_OPTIONS.
else
  ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
    with_check := disabled because cross-compiling.
  else
    with_check := yes
  endif
endif

config.status: configure
	dh_testdir
	egrep '^#[[:alpha:]]' etc/clamd.conf | sed -e 's/^#//' | awk '{print $$1}' | while read opt; do \
	  if ! grep -q "$${opt}" debian/clamav-base.postinst.in ; then \
	    echo "Unhandled option(clamd.conf): $${opt}"; \
	    exit 1; \
	  fi;\
	done;
	egrep '^#[[:alpha:]]' etc/freshclam.conf | sed -e 's/^#//' | awk '{print $$1}' | while read opt; do \
	  if ! grep -q "$${opt}" debian/clamav-freshclam.postinst.in ; then \
	    echo "Unhandled option (freshclam.conf): $${opt}"; \
	    exit 1; \
	  fi;\
	done;
	egrep '^#[[:alpha:]]' etc/clamav-milter.conf | sed -e 's/^#//' | awk '{print $$1}' | while read opt; do \
	  if ! grep -q "$${opt}" debian/clamav-milter.postinst.in ; then \
	    echo "Unhandled option (clamav-milter.conf): $${opt}"; \
	    exit 1; \
	  fi;\
	done;
	# Add here commands to configure the package.
	touch libclamav/version.h  # Missing upstream in 0.98
	dh_autoreconf -i
	./configure CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --disable-clamav --with-dbdir=/var/lib/clamav/ --sysconfdir=/etc/clamav --enable-milter --disable-clamuko --with-gnu-ld --enable-dns-fix ${DEBUG_OPTS} --disable-unrar --libdir=\$${prefix}/lib --with-system-tommath  --without-included-ltdl

build: build-stamp
build-stamp: build-arch build-indep
	touch build-stamp

build-indep: build-indep-stamp
build-indep-stamp:
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-base.config.in > debian/clamav-base.config
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-base.postinst.in > debian/clamav-base.postinst
	touch build-indep-stamp

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

ifeq ($(PO2DEBCONF),yes)
	po2debconf -e utf8 debian/clamav-base.templates.master > debian/clamav-base.templates
	po2debconf -e utf8 debian/clamav-freshclam.templates.master > debian/clamav-freshclam.templates
	po2debconf -e utf8 debian/clamav-milter.templates.master > debian/clamav-milter.templates
endif

	$(MAKE) CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" pkgdatadir=/var/lib/clamav/ all
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.init.in > debian/clamav-milter.init
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.config.in > debian/clamav-milter.config
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.postinst.in > debian/clamav-milter.postinst
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-daemon.postinst.in > debian/clamav-daemon.postinst
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-daemon.init.in > debian/clamav-daemon.init
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.init.in > debian/clamav-freshclam.init
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.config.in > debian/clamav-freshclam.config
	perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.postinst.in > debian/clamav-freshclam.postinst
	touch build-arch-stamp
ifeq ($(with_check),yes)
ifneq (,$(filter alpha, $(shell dpkg-architecture -qDEB_BUILD_ARCH)))
	@echo "Ignoring errors because of #521737"
	-$(MAKE) check VERBOSE=1
else
ifneq (,$(filter ia64 sparc, $(shell dpkg-architecture -qDEB_BUILD_ARCH)))
	$(MAKE) check EF_ALIGNMENT=8 VERBOSE=1
else
	$(MAKE) check VERBOSE=1
endif
endif
else
	@echo "Testsuite not run: $(with_check)."
endif

clean:
	debconf-updatepo
	dh_testdir 
	dh_testroot 

ifeq (Makefile,$(wildcard Makefile))
	$(MAKE) distclean
endif
	rm -f target.h config.log
	rm -f build-arch-stamp build-indep-stamp install-indep-stamp install-arch-stamp build-stamp install-stamp
	rm -f debian/clamav-base.config
	rm -f debian/clamav-base.postinst
	rm -f debian/clamav-daemon.postinst
	rm -f debian/clamav-daemon.init
	rm -f debian/clamav-milter.init
	rm -f debian/clamav-milter.config
	rm -f debian/clamav-milter.postinst
	rm -f debian/clamav-freshclam.init
	rm -f debian/clamav-freshclam.config
	rm -f debian/clamav-freshclam.postinst
	rm -f libclamav/c++/llvm/utils/lit/lit/*.pyc
	dh_autoreconf_clean
	dh_clean

install: install-indep install-arch
install-indep: install-indep-stamp
install-indep-stamp: build-indep-stamp
	dh_testdir
	dh_testroot
	dh_clean -k -i -d
	
	touch install-indep-stamp

clamav-base: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@
	dh_install -X.svn -p$@
	chmod +x debian/$@/usr/share/bug/$@/script
	dh_installchangelogs -p$@ ChangeLog 
	dh_installdebconf -p$@
	dh_installman -p$@
	dh_installexamples -p$@
	dh_compress -p$@ -Xexamples/
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

clamav-docs: install-indep
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@
	dh_install -X.svn -p$@
	dh_installchangelogs -p$@ ChangeLog 
	dh_compress -p$@ -X.pdf -X.html -X.css -X.png -X.uu
	rm -rf debian/clamav-docs/usr/share/doc/clamav-docs/html/.svn
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

clamav-testfiles: install-indep
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@
	dh_install -X.svn -p$@
	dh_installchangelogs -p$@ ChangeLog 
	dh_compress -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

install-arch: install-arch-stamp
install-arch-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k -a
	# Add here commands to install the package into debian/clamav.
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/
	sed -i "/dependency_libs/ s/'.*'/''/" `find $(CURDIR)/debian/tmp/ -name '*.la'`
	
	touch install-arch-stamp

clamav-dbg: libclamav6
	dh_testdir
	dh_testroot
	dh_installdocs -p$@
	dh_installchangelogs -p$@ ChangeLog
	dh_compress -p$@
	dh_md5sums -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_installdeb -p$@
	dh_gencontrol -p$@
	dh_builddeb -p$@

clamav: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installexamples -X.svn -p$@
	dh_install -X.svn -p$@
	chmod +x debian/$@/usr/share/bug/$@/script
	dh_installman -p$@
	dh_installchangelogs -p$@ ChangeLog 
	dh_installdocs -p$@ 
	dh_link -p$@
	${STRIP_OPTS}
	dh_compress -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

clamav-freshclam: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@ 
	dh_installchangelogs -p$@ ChangeLog 
	dh_installexamples -p$@
	dh_install -X.svn -p$@
	chmod +x debian/$@/usr/share/bug/$@/script
	dh_installlogcheck -p$@
	dh_installinit -p$@ --noscripts
	dh_installman -p$@
	dh_link -p$@
	${STRIP_OPTS}
	dh_compress -p$@ -Xexamples/
	dh_installdebconf -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@ -Xclamav-freshclam-ifupdown
	chmod +x debian/clamav-freshclam/etc/network/if-up.d/clamav-freshclam-ifupdown
	chmod +x debian/clamav-freshclam/etc/network/if-down.d/clamav-freshclam-ifupdown
	chmod +x debian/clamav-freshclam/etc/ppp/ip-up.d/clamav-freshclam-ifupdown
	chmod +x debian/clamav-freshclam/etc/ppp/ip-down.d/clamav-freshclam-ifupdown
	dh_builddeb -p$@

clamav-daemon: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_install -X.svn -p$@
	chmod +x debian/$@/usr/share/bug/$@/script
	dh_installlogcheck -p$@
	dh_installinit -p$@
	dh_installman -p$@
	dh_installdocs -p$@ 
	dh_installchangelogs -p$@ ChangeLog 
	dh_link -p$@
	${STRIP_OPTS}
	dh_compress -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

clamav-milter: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@
	dh_install -X.svn -p$@
	chmod +x debian/$@/usr/share/bug/$@/script
	dh_installinit -p$@
	dh_installman -p$@
	dh_installdocs -p$@ 
	dh_installchangelogs -p$@ ChangeLog 
	dh_installdebconf -p$@
	dh_installlogcheck -p$@
	dh_link -p$@
	dh_installexamples -p$@
	dh_compress -p$@ -Xexamples/
	${STRIP_OPTS}
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

libclamav6: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installdocs -p$@
	dh_install -X.svn -p$@
	dh_installchangelogs -p$@ ChangeLog 
	dh_lintian -p$@
	${STRIP_OPTS}
	dh_compress -p$@
	dh_makeshlibs -V -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

libclamav-dev: install
	dh_testdir
	dh_testroot
	dh_installdirs -p$@
	dh_installman -p$@
	dh_installdocs -p$@ 
	dh_installchangelogs -p$@ ChangeLog 
	dh_install -X.svn -p$@
	dh_link -p$@
	${STRIP_OPTS}
	dh_compress -p$@
	dh_makeshlibs -V -p$@
	dh_md5sums -p$@
	dh_installdeb -p$@
	dh_shlibdeps -l debian/tmp/usr/lib -p$@
	dh_gencontrol -p$@
	dh_fixperms -p$@
	dh_builddeb -p$@

# Build architecture independant packages using the common target.
binary-indep: build install clamav-base clamav-testfiles clamav-docs

# Build architecture dependant packages using the common target.
binary-arch: build install libclamav6 clamav clamav-daemon clamav-freshclam clamav-milter libclamav-dev clamav-dbg

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