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.
8
export AUTOMAKE = automake-1.11
9
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`
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.
9
export AUTOMAKE = automake
10
export ACLOCAL = aclocal
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
# Faketime on hurd currently (faketime 0.9.1-2) segfaults and newer versions FTBFS.
22
# Thus don't use it there.
23
# TODO: Use faketime on hurd again, once this is fixed.
24
ifneq (,$(findstring $(DEB_HOST_ARCH),hurd-i386))
27
# Get the date of the latest changelog entry.
28
# This is used to make the build more binary reproducible.
29
DAT = $(shell dpkg-parsechangelog | grep Date: | sed s/Date:\ //)
30
# Change the format to the only one that stops faketime from incresing the time.
31
DATE = $(shell faketime "$(DAT)" date -u +"%Y-%m-%d %H:%M:%S")
32
# NO_FAKE_STAT is necessary in order not to confuse make.
33
FT=NO_FAKE_STAT="true" faketime -f -m "$(DATE)"
36
# LLVM is only used on these archs, so no point in enabling it elsewhere
37
# To add new llvm/jit archs add it here and to the arch list for llvm-dev in
39
ifeq (,$(filter $(DEB_HOST_ARCH), i386 amd64 powerpc kfreebsd-amd64 kfreebsd-i386))
42
# The llvm in squeeze (Debian 6) is older than the internal copy, so don't use it.
43
ifeq ($(shell cut -c1 /etc/debian_version),6)
46
SYSTEM_LLVM = -with-system-llvm=/usr/bin/llvm-config
50
# Set the configure options:
51
# * add the build flags
53
# * disable test for clamav user/group (--disable-clamav)
54
# * disable building of the non-free libclamunrar (--disable-unrar)
55
# * build clamav-milter (--enable-milter)
56
# * enable workaround for broken DNS servers (--enable-dns-fix)
57
# * assume the C compiler uses GNU ld (--with-gnu-ld)
58
# * use system libraries instead of the embedded copies (--with-system-tommath, --without-included-ltdl, -with-system-llvm=/usr/bin/llvm-config)
59
CONFIG := CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
60
--with-dbdir=/var/lib/clamav --sysconfdir=/etc/clamav \
61
--disable-clamav --disable-unrar --enable-milter --enable-dns-fix \
62
--with-gnu-ld --with-system-tommath --without-included-ltdl $(SYSTEM_LLVM)
66
# Enable debug code, if nostrip was given.
26
67
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
27
68
INSTALL_PROGRAM += -s
28
STRIP_OPTS += dh_strip --dbg-package=clamav-dbg -p$@
30
70
DEBUG_OPTS += --enable-debug
32
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
33
with_check := disabled by DEB_BUILD_OPTIONS.
73
# The autotools in squeeze (Debian 6) are too old, so don't use autoreconf.
74
ifeq ($(shell cut -c1 /etc/debian_version),6)
35
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
36
with_check := disabled because cross-compiling.
42
# LLVM doesn't work on these archs, so no point in breaking the build over it.
43
ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386 ppc64 powerpcspe ppc64el))
47
config.status: configure
77
AUTORECONF = --with autoreconf
80
# Use the default debhelper scripts, where possible.
81
# Enable parallel building and autoreconf.
83
dh $@ --parallel $(AUTORECONF)
85
override_dh_auto_configure:
86
$(info DEB_BUILD_OPTIONS = $(DEB_BUILD_OPTIONS))
87
$(info CFLAGS = $(CFLAGS))
88
$(info CXXFLAGS = $(CXXFLAGS))
89
$(info CPPFLAGS = $(CPPFLAGS))
90
$(info LDFLAGS = $(LDFLAGS))
91
# Check for unknown options in the configuration files.
49
92
egrep '^#[[:alpha:]]' etc/clamd.conf.sample | sed -e 's/^#//' | awk '{print $$1}' | while read opt; do \
50
if ! grep -q "$${opt}" debian/clamav-base.postinst.in ; then \
93
if ! grep -q "$${opt}" debian/clamav-daemon.postinst.in ; then \
51
94
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
77
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-base.config.in > debian/clamav-base.config
110
# Configure using the specified flags.
111
$(FT) dh_auto_configure -- $(CONFIG) $(DEBUG_OPTS)
113
override_dh_auto_clean:
114
# Update .po files for debconf.
119
# Add common functions in config and postinst files.
78
120
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
123
ifeq ($(PO2DEBCONF),yes)
86
po2debconf -e utf8 debian/clamav-base.templates.master > debian/clamav-base.templates
124
po2debconf -e utf8 debian/clamav-daemon.templates.master > debian/clamav-daemon.templates
87
125
po2debconf -e utf8 debian/clamav-freshclam.templates.master > debian/clamav-freshclam.templates
88
126
po2debconf -e utf8 debian/clamav-milter.templates.master > debian/clamav-milter.templates
127
@echo debian/clamav-daemon.templates debian/clamav-freshclam.templates debian/clamav-milter.templates \
91
$(MAKE) CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" pkgdatadir=/var/lib/clamav/ all
130
# Add common functions in config and postinst files.
92
131
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.init.in > debian/clamav-milter.init
93
132
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.config.in > debian/clamav-milter.config
94
133
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-milter.postinst.in > debian/clamav-milter.postinst
134
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-daemon.config.in > debian/clamav-daemon.config
95
135
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-daemon.postinst.in > debian/clamav-daemon.postinst
96
136
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-daemon.init.in > debian/clamav-daemon.init
97
137
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.init.in > debian/clamav-freshclam.init
98
138
perl -pe 's~#COMMON-FUNCTIONS#~qx{cat debian/common_functions}~eg' < debian/clamav-freshclam.config.in > debian/clamav-freshclam.config
99
139
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)))
141
# override_dh_auto_build-{indep,arch} doesn't work in squeeze (Debian 6).
142
ifeq ($(shell cut -c1 /etc/debian_version),6)
143
override_dh_auto_build: clamav_build-indep clamav_build-arch
145
$(FT) dh_auto_build -- V=1
147
override_dh_auto_build-indep: clamav_build-indep
148
# Build architecture-independent files.
149
$(FT) dh_auto_build -i -- V=1
151
override_dh_auto_build-arch: clamav_build-arch
152
# Build architecture-dependent files.
153
$(FT) dh_auto_build -a -- V=1
156
override_dh_auto_test:
157
ifneq (,$(filter alpha, $DEB_HOST_ARCH))
103
158
@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
161
ifneq (,$(filter ia64 sparc, $DEB_HOST_ARCH))
162
dh_auto_test -- EF_ALIGNMENT=8 V=1
164
dh_auto_test -- V=1 VERBOSE=1
169
# Move the debug symbols to the debug package:
170
dh_strip --dbg-package=clamav-dbg
172
override_dh_installinit:
173
dh_installinit -pclamav-daemon
174
# Don't change the postinst/postrm scripts for clamav-freshclam, as they need non-standard code.
175
dh_installinit -pclamav-freshclam --noscripts
176
dh_installinit -pclamav-milter
178
override_dh_installdocs-indep:
180
# Make the .rar test files which are no longer created
181
cat test/.split/split.clam-v2.raraa test/.split/split.clam-v2.rarab >debian/clamav-testfiles/usr/share/clamav-testfiles/clam-v2.rar
182
cat test/.split/split.clam-v3.raraa test/.split/split.clam-v3.rarab >debian/clamav-testfiles/usr/share/clamav-testfiles/clam-v3.rar
184
# Install the upstream ChangeLog.
185
override_dh_installchangelogs:
186
dh_installchangelogs -pclamav-base ChangeLog
187
dh_installchangelogs -pclamav-daemon ChangeLog
188
dh_installchangelogs -pclamav-dbg ChangeLog
189
dh_installchangelogs -pclamav-docs ChangeLog
190
dh_installchangelogs -pclamav-freshclam ChangeLog
191
dh_installchangelogs -pclamav-milter ChangeLog
192
dh_installchangelogs -pclamav-testfiles ChangeLog
193
dh_installchangelogs -pclamav ChangeLog
194
dh_installchangelogs -plibclamav-dev ChangeLog
195
dh_installchangelogs -plibclamav6 ChangeLog
197
# Don't compress the example configuration files and the documentation PDFs.
198
override_dh_compress:
199
dh_compress -Xexamples -X.pdf