2
# Sample debian/rules that uses debhelper.
3
# GNU copyright 1997 to 1999 by Joey Hess.
5
3
# Uncomment this to turn on verbose mode.
6
# Use automake 1.11 due to bug in automake-1.14.
7
# see: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16375
8
# TODO: Remove this, when the bug is fixed.
8
9
export AUTOMAKE = automake-1.11
9
10
export ACLOCAL = aclocal-1.11
11
# These are used for cross-compiling and for saving the configure script
12
# from having to guess our platform (since we know it already)
13
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
14
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16
CFLAGS = `dpkg-buildflags --get CFLAGS`
18
CXXFLAGS = `dpkg-buildflags --get CXXFLAGS`
20
LDFLAGS = `dpkg-buildflags --get LDFLAGS`
21
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
12
# This is needed to work around arch-specific quirks in the test suite.
13
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
15
# Get the hardening build flags and enable all compiler warnings:
16
CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall
17
CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) -Wall
18
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
19
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
21
# Get the date of the latest changelog entry.
22
# This is used to make the build more binary reproducible.
23
DAT = $(shell dpkg-parsechangelog | grep Date: | sed s/Date:\ //)
24
# Change the format to the only one that stops faketime from incresing the time.
25
DATE = $(shell faketime "$(DAT)" date -u +"%Y-%m-%d %H:%M:%S")
26
# NO_FAKE_STAT is necessary in order not to confuse make.
27
FT=NO_FAKE_STAT="true" faketime -f -m "$(DATE)"
29
# Set the configure options:
30
# * add the build flags
32
# * disable test for clamav user/group (--disable-clamav)
33
# * disable building of the non-free libclamunrar (--disable-unrar)
34
# * build clamav-milter (--enable-milter)
35
# * enable workaround for broken DNS servers (--enable-dns-fix)
36
# * assume the C compiler uses GNU ld (--with-gnu-ld)
37
# * use system libraries instead of the embedded copies (--with-system-tommath, --without-included-ltdl)
38
CONFIG := CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
39
--with-dbdir=/var/lib/clamav --sysconfdir=/etc/clamav \
40
--disable-clamav --disable-unrar --enable-milter --enable-dns-fix \
41
--with-gnu-ld --with-system-tommath --without-included-ltdl
45
# Enable debug code, if nostrip was given.
26
46
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
27
47
INSTALL_PROGRAM += -s
28
STRIP_OPTS += dh_strip --dbg-package=clamav-dbg -p$@
30
49
DEBUG_OPTS += --enable-debug
32
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
33
with_check := disabled by DEB_BUILD_OPTIONS.
35
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
36
with_check := disabled because cross-compiling.
42
52
# LLVM doesn't work on these archs, so no point in breaking the build over it.
43
53
ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386 ppc64 powerpcspe ppc64el))
44
54
export enable_llvm=no
47
config.status: configure
57
# The autotools in squeeze (Debian 6) are too old, so don't use autoreconf.
58
ifeq ($(shell cut -c1 /etc/debian_version),6)
61
AUTORECONF = --with autoreconf
64
# Use the default debhelper scripts, where possible.
65
# Enable parallel building and autoreconf.
67
dh $@ --parallel $(AUTORECONF)
69
override_dh_auto_configure:
70
$(info DEB_BUILD_OPTIONS = $(DEB_BUILD_OPTIONS))
71
$(info CFLAGS = $(CFLAGS))
72
$(info CXXFLAGS = $(CXXFLAGS))
73
$(info CPPFLAGS = $(CPPFLAGS))
74
$(info LDFLAGS = $(LDFLAGS))
75
# Check for unknown options in the configuration files.
49
76
egrep '^#[[:alpha:]]' etc/clamd.conf.sample | sed -e 's/^#//' | awk '{print $$1}' | while read opt; do \
50
77
if ! grep -q "$${opt}" debian/clamav-base.postinst.in ; then \
51
78
echo "Unhandled option(clamd.conf): $${opt}"; \
67
# Add here commands to configure the package.
69
./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
72
build-stamp: build-arch build-indep
75
build-indep: build-indep-stamp
94
# Configure using the specified flags.
95
$(FT) dh_auto_configure -- $(CONFIG) $(DEBUG_OPTS)
97
override_dh_auto_clean:
98
# Update .po files for debconf.
103
# Add common functions in config and postinst files.
77
104
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-base.config.in > debian/clamav-base.config
78
105
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-base.postinst.in > debian/clamav-base.postinst
79
touch build-indep-stamp
81
build-arch: build-arch-stamp
82
build-arch-stamp: config.status
85
108
ifeq ($(PO2DEBCONF),yes)
86
109
po2debconf -e utf8 debian/clamav-base.templates.master > debian/clamav-base.templates
87
110
po2debconf -e utf8 debian/clamav-freshclam.templates.master > debian/clamav-freshclam.templates
88
111
po2debconf -e utf8 debian/clamav-milter.templates.master > debian/clamav-milter.templates
112
@echo debian/clamav-base.templates debian/clamav-freshclam.templates debian/clamav-milter.templates \
91
$(MAKE) CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" pkgdatadir=/var/lib/clamav/ all
115
# Add common functions in config and postinst files.
92
116
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.init.in > debian/clamav-milter.init
93
117
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.config.in > debian/clamav-milter.config
94
118
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.postinst.in > debian/clamav-milter.postinst
97
121
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.init.in > debian/clamav-freshclam.init
98
122
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.config.in > debian/clamav-freshclam.config
99
123
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.postinst.in > debian/clamav-freshclam.postinst
100
touch build-arch-stamp
101
ifeq ($(with_check),yes)
102
ifneq (,$(filter alpha, $(shell dpkg-architecture -qDEB_BUILD_ARCH)))
125
# override_dh_auto_build-{indep,arch} doesn't work in squeeze (Debian 6).
126
ifeq ($(shell cut -c1 /etc/debian_version),6)
127
override_dh_auto_build: clamav_build-indep clamav_build-arch
131
override_dh_auto_build-indep: clamav_build-indep
132
# Build architecture-independent files.
133
$(FT) dh_auto_build -i
135
override_dh_auto_build-arch: clamav_build-arch
136
# Build architecture-dependent files.
137
$(FT) dh_auto_build -a
140
override_dh_auto_test:
141
ifneq (,$(filter alpha, $DEB_HOST_ARCH))
103
142
@echo "Ignoring errors because of #521737"
104
-$(MAKE) check VERBOSE=1
106
ifneq (,$(filter ia64 sparc, $(shell dpkg-architecture -qDEB_BUILD_ARCH)))
107
$(MAKE) check EF_ALIGNMENT=8 VERBOSE=1
109
$(MAKE) check VERBOSE=1
113
@echo "Testsuite not run: $(with_check)."
121
ifeq (Makefile,$(wildcard Makefile))
124
rm -f target.h config.log
125
rm -f build-arch-stamp build-indep-stamp install-indep-stamp install-arch-stamp build-stamp install-stamp
126
rm -f debian/clamav-base.config
127
rm -f debian/clamav-base.postinst
128
rm -f debian/clamav-daemon.postinst
129
rm -f debian/clamav-daemon.init
130
rm -f debian/clamav-milter.init
131
rm -f debian/clamav-milter.config
132
rm -f debian/clamav-milter.postinst
133
rm -f debian/clamav-freshclam.init
134
rm -f debian/clamav-freshclam.config
135
rm -f debian/clamav-freshclam.postinst
136
rm -f libclamav/c++/llvm/utils/lit/lit/*.pyc
140
install: install-indep install-arch
141
install-indep: install-indep-stamp
142
install-indep-stamp: build-indep-stamp
147
touch install-indep-stamp
154
dh_install -X.svn -p$@
155
chmod +x debian/$@/usr/share/bug/$@/script
156
dh_installchangelogs -p$@ ChangeLog
157
dh_installdebconf -p$@
159
dh_installexamples -p$@
160
dh_compress -p$@ -Xexamples/
167
clamav-docs: install-indep
172
dh_install -X.svn -p$@
173
dh_installchangelogs -p$@ ChangeLog
174
dh_compress -p$@ -X.pdf -X.html -X.css -X.png -X.uu
175
rm -rf debian/clamav-docs/usr/share/doc/clamav-docs/html/.svn
182
clamav-testfiles: install-indep
187
dh_install -X.svn -p$@
188
dh_installchangelogs -p$@ ChangeLog
196
install-arch: install-arch-stamp
197
install-arch-stamp: build-stamp
201
# Add here commands to install the package into debian/clamav.
202
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/
203
sed -i "/dependency_libs/ s/'.*'/''/" `find $(CURDIR)/debian/tmp/ -name '*.la'`
205
touch install-arch-stamp
207
clamav-dbg: libclamav6
211
dh_installchangelogs -p$@ ChangeLog
214
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
223
dh_installexamples -X.svn -p$@
224
dh_install -X.svn -p$@
225
chmod +x debian/$@/usr/share/bug/$@/script
227
dh_installchangelogs -p$@ ChangeLog
234
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
239
clamav-freshclam: install
244
dh_installchangelogs -p$@ ChangeLog
245
dh_installexamples -p$@
246
dh_install -X.svn -p$@
247
chmod +x debian/$@/usr/share/bug/$@/script
248
dh_installlogcheck -p$@
249
dh_installinit -p$@ --noscripts
253
dh_compress -p$@ -Xexamples/
254
dh_installdebconf -p$@
257
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
259
dh_fixperms -p$@ -Xclamav-freshclam-ifupdown
260
chmod +x debian/clamav-freshclam/etc/network/if-up.d/clamav-freshclam-ifupdown
261
chmod +x debian/clamav-freshclam/etc/network/if-down.d/clamav-freshclam-ifupdown
262
chmod +x debian/clamav-freshclam/etc/ppp/ip-up.d/clamav-freshclam-ifupdown
263
chmod +x debian/clamav-freshclam/etc/ppp/ip-down.d/clamav-freshclam-ifupdown
266
clamav-daemon: install
270
dh_install -X.svn -p$@
271
chmod +x debian/$@/usr/share/bug/$@/script
272
dh_installlogcheck -p$@
276
dh_installchangelogs -p$@ ChangeLog
282
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
287
clamav-milter: install
292
dh_install -X.svn -p$@
293
chmod +x debian/$@/usr/share/bug/$@/script
297
dh_installchangelogs -p$@ ChangeLog
298
dh_installdebconf -p$@
299
dh_installlogcheck -p$@
301
dh_installexamples -p$@
302
dh_compress -p$@ -Xexamples/
306
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
316
dh_install -X.svn -p$@
317
dh_installchangelogs -p$@ ChangeLog
321
dh_makeshlibs -V -p$@
324
dh_shlibdeps -l debian/libclamav6/usr/lib -p$@
329
libclamav-dev: install
335
dh_installchangelogs -p$@ ChangeLog
336
dh_install -X.svn -p$@
340
dh_makeshlibs -V -p$@
343
dh_shlibdeps -l debian/tmp/usr/lib -p$@
348
# Build architecture independant packages using the common target.
349
binary-indep: build install clamav-base clamav-testfiles clamav-docs
351
# Build architecture dependant packages using the common target.
352
binary-arch: build install libclamav6 clamav clamav-daemon clamav-freshclam clamav-milter libclamav-dev clamav-dbg
354
binary: binary-indep binary-arch
355
.PHONY: build clean binary-indep binary-arch binary install
143
-dh_auto_test -- VERBOSE=1
145
ifneq (,$(filter ia64 sparc, $DEB_HOST_ARCH))
146
dh_auto_test -- EF_ALIGNMENT=8 VERBOSE=1
148
dh_auto_test -- VERBOSE=1
153
# Move the debug symbols to the debug package:
154
dh_strip --dbg-package=clamav-dbg
156
override_dh_installinit:
157
dh_installinit -pclamav-daemon
158
# Don't change the postinst/postrm scripts for clamav-freshclam, as they need non-standard code.
159
dh_installinit -pclamav-freshclam --noscripts
160
dh_installinit -pclamav-milter
162
# Install the upstream ChangeLog.
163
override_dh_installchangelogs:
164
dh_installchangelogs -pclamav-base ChangeLog
165
dh_installchangelogs -pclamav-daemon ChangeLog
166
dh_installchangelogs -pclamav-dbg ChangeLog
167
dh_installchangelogs -pclamav-docs ChangeLog
168
dh_installchangelogs -pclamav-freshclam ChangeLog
169
dh_installchangelogs -pclamav-milter ChangeLog
170
dh_installchangelogs -pclamav-testfiles ChangeLog
171
dh_installchangelogs -pclamav ChangeLog
172
dh_installchangelogs -plibclamav-dev ChangeLog
173
dh_installchangelogs -plibclamav6 ChangeLog
175
# Don't compress the example configuration files and the documentation PDFs.
176
override_dh_compress:
177
dh_compress -Xexamples -X.pdf