2 # debian/rules for exim4
3 # This file is public domain software, originally written by Joey Hess.
5 # Uncomment this to turn on verbose mode.
8 buildname
:= $(shell scripts
/os-type
)-$(shell scripts
/arch-type
)
9 DEBIAN
:= $(shell pwd
)/debian
11 ifeq ($(wildcard /usr
/share
/dpkg
/buildflags.mk
),)
13 ifneq (,$(findstring noopt
,$(DEB_BUILD_OPTIONS
)))
19 export DEB_BUILD_MAINT_OPTIONS
:= hardening
=+bindnow
,+pie
20 DPKG_EXPORT_BUILDFLAGS
:= 1
21 include /usr
/share
/dpkg
/buildflags.mk
24 # The build system ignores CPPFLAGS, append them to CFLAGS
25 CFLAGS
:= $(CFLAGS
) $(shell getconf LFS_CFLAGS
) -D_LARGEFILE_SOURCE
-fno-strict-aliasing
-Wall
$(CPPFLAGS
)
27 # LFLAGS is used where GNU would use LDFLAGS
28 export LFLAGS
+= $(LDFLAGS
)
33 # Which packages should we build?
34 ifndef buildbasepackages
38 ifndef extradaemonpackages
39 extradaemonpackages
=exim4-daemon-heavy
41 # If you want to build a daemon with a configuration tailored to YOUR special
42 # needs, uncomment the two custom packages in debian/control
43 # call "fakeroot debian/rules unpack-configs", copy EDITME.exim4-light
44 # to EDITME.exim4-custom and modify it. Please note that you _need_ to
45 # modify EDITME.exim4-custom or your build will fail due to #386188.
47 # If you want to create multiple custom packages with different names, use
48 # the script debian/create-custom-package [suffix].
50 # Afterwards EITHER change the definition of extradaemonpackages above OR
51 # simply set extradaemonpackages to the desired value via the environment.
53 # If you want your changes to survive a debian/rules clean, call
54 # "fakeroot debian/rules pack-configs" after customizing EDITME.exim4-custom
56 # If you remove exim4-daemon-light from basedaemonpackages to prevent
57 # exim4-daemon-light from being built, you need to modify the build
58 # process to pull the helper binaries from the daemon package that you
59 # actually build. If you simply remove exim4-daemon-light here, you will
60 # end up with exim4-base sans binaries, which is most probably not what
63 # combined[ai]dbgpackage has a list of packages whose debug information
64 # goes into the combined debug package exim4-dbg, separated as arch
65 # independent and arch dependent list.
66 # extraadbgpackage has a list of packages whose debug information
67 # goes into one debug package foo-dbg per package. This is currently
68 # only implemented and needed for arch dependent packages.
70 ifeq ($(buildbasepackages
),yes
)
71 basedaemonpackages
=exim4-daemon-light
72 combinedadbgpackage
=exim4-base eximon4
73 combinedidbgpackage
=exim4-config exim4
75 dhstripparm
=--dbg-package
=$(exim4dbg
)
77 extraadbgpackage
=$(basedaemonpackages
) $(extradaemonpackages
)
85 extraadbgpackage
=$(extradaemonpackages
)
87 #DEBUGOUT:=$(shell echo >&2 buildbasepackages $(buildbasepackages))
88 #DEBUGOUT:=$(shell echo >&2 extradaemonpackages $(extradaemonpackages))
90 # If you want to build with OpenSSL instead of GnuTLS, uncomment this
92 # Please note that building exim4-daemon-heavy with OpenSSL is a GPL
96 # list of all arch dependent packages to be built
97 buildpackages
=$(combinedadbgpackage
) $(extraadbgpackage
) $(addsuffix -dbg
,$(extraadbgpackage
)) $(exim4dbg
) $(exim4dev
)
98 # generate -pexim4-base -peximon4 ... commandline for debhelper
99 dhbuildpackages
=$(addprefix -p
,$(buildpackages
))
100 dhcombinedadbgpackage
=$(addprefix -p
,$(combinedadbgpackage
))
101 dhcombinedidbgpackage
=$(addprefix -p
,$(combinedidbgpackage
))
103 # exim4-daemon-heavy --> b-exim4-daemon-heavy/build-Linux-x86_64/exim
104 daemonbinaries
=$(addprefix b-
,$(addsuffix /build-
$(buildname
)/exim
,$(extradaemonpackages
)))
105 debiandaemonbinaries
=$(addprefix $(DEBIAN
)/,$(addsuffix /usr
/sbin
/exim4
,$(extradaemonpackages
)))
106 BDIRS
=$(addprefix b-
,$(extradaemonpackages
) $(basedaemonpackages
))
109 # get upstream-version from debian/changelog, i.e. anything until the first -
110 DEBVERSION
:= $(shell dpkg-parsechangelog | sed
-n
'/^Version: /s/^Version: //p')
111 UPSTREAMVERSION
:= $(shell echo
$(DEBVERSION
) | sed
-n
's/\(.\+\)-[^-]\+/\1/p')
112 MTACONFLICTS
:= $(shell cat
$(DEBIAN
)/mtalist
)
114 # set up build directory b-exim4-daemon-heavy/
115 $(addsuffix /Makefile
,$(BDIRS
)): %/Makefile
:
117 find .
-mindepth
1 -maxdepth
1 \
118 -name debian
-prune
-o \
119 -name
'b-*' -o
-print0 | \
120 xargs
--no-run-if-empty
--null \
121 cp
-a
--target-directory
=$*
124 unpack-configs
: unpack-configs-stamp
125 unpack-configs-stamp
: src
/EDITME exim_monitor
/EDITME
126 patch
-o EDITME.eximon exim_monitor
/EDITME \
127 $(DEBIAN
)/EDITME.eximon.diff
128 patch
-o EDITME.exim4-light src
/EDITME \
129 $(DEBIAN
)/EDITME.exim4-light.diff
131 patch EDITME.exim4-light
$(DEBIAN
)/EDITME.openssl.exim4-light.diff
133 -for editme in
$(DEBIAN
)/EDITME.exim4-
*.diff
; do \
134 if
[ "$$editme" != "$(DEBIAN)/EDITME.exim4-light.diff" ]; then \
135 TARGETNAME
=`basename $$editme .diff`; \
136 echo patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme; \
137 patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme; \
140 touch unpack-configs-stamp
143 -diff
-u src
/EDITME EDITME.exim4-light \
144 > $(DEBIAN
)/EDITME.exim4-light.diff
145 -for editme in EDITME.exim4-
*; do \
146 if
[ "$$editme" != "EDITME.exim4-light" ]; then \
147 echo diff
-u EDITME.exim4-light
$$editme; \
148 diff
-u EDITME.exim4-light
$$editme > $(DEBIAN
)/$${editme}.diff
; \
151 -diff
-u exim_monitor
/EDITME EDITME.eximon \
152 > $(DEBIAN
)/EDITME.eximon.diff
154 # only called manually by maintainer before upload.
156 which grep-available
> /dev
/null
&& \
157 grep-available
--show-field
=Package
--field
=Provides \
158 mail-transport-agent
--no-field-names \
159 /var
/lib
/apt
/lists
/*Packages | grep
-v exim |
sort -u | \
160 tr
'\n' ',' | sed
-e
's/,/, /g;s/, $$//' > $(DEBIAN
)/mtalist
162 # Generate README.Debian as text/html ...
163 debian
/README.Debian.html
: debian
/README.Debian.xml
164 xsltproc
--nonet
--stringparam section.autolabel
1 \
166 /usr
/share
/xml
/docbook
/stylesheet
/nwalsh
/html
/docbook.xsl \
169 debian
/README.Debian
: debian
/README.Debian.html
170 chmod
755 $(DEBIAN
)/lynx-dump-postprocess
171 lynx
-force_html
-dump
$< |
$(DEBIAN
)/lynx-dump-postprocess
> $@.tmp
174 configure
: configure-stamp
176 configure-stamp
: $(addsuffix /Makefile
,$(BDIRS
)) unpack-configs-stamp
178 # Add here commands to configure the package.
179 # We currently do not want to build depend on debhelper 7.2.3 just to
180 # keep it from installing the wrong upstream changelog. 490937
184 # Build binaries for the base package, the eximon4 package, and the
185 # exim4-daemon-light package.
186 b-exim4-daemon-light
/build-
$(buildname
)/exim
: b-exim4-daemon-light
/Makefile configure-stamp
192 cp EDITME.exim4-light
$(<D
)/Local
/Makefile
193 cp EDITME.eximon
$(<D
)/Local
/eximon.conf
194 cd
$(<D
) && $(MAKE
) FULLECHO
=''
196 b-exim4-daemon-heavy
/build-
$(buildname
)/exim
: b-exim4-daemon-heavy
/Makefile configure-stamp
202 cp EDITME.exim4-heavy
$(<D
)/Local
/Makefile
203 cd
$(<D
) && $(MAKE
) FULLECHO
=''
205 b-exim4-daemon-custom
/build-
$(buildname
)/exim
: b-exim4-daemon-custom
/Makefile configure-stamp
211 cp EDITME.exim4-custom
$(<D
)/Local
/Makefile
212 cd
$(<D
) && $(MAKE
) FULLECHO
=''
214 build-indep
: build-indep-stamp
218 # Add here command to compile/build the arch indep package.
219 # It's ok not to do anything here, if you don't need to build
220 # anything for this package.
221 #/usr/bin/docbook-to-man $(DEBIAN)/exim.sgml > exim.1
223 touch build-indep-stamp
225 build-arch
: build-arch-stamp test-stamp
227 ifeq ($(buildbasepackages
),yes
)
228 build-arch-stamp
: b-exim4-daemon-light
/build-
$(buildname
)/exim
$(daemonbinaries
)
230 build-arch-stamp
: $(daemonbinaries
)
233 # Which version of Berkeley DB are we building against?
234 printf
'#include <db.h>\ninstdbversionis DB_VERSION_MAJOR DB_VERSION_MINOR\n' | \
235 cpp | grep instdbversionis |\
236 sed
-e
's/[[:space:]]*instdbversionis[[:space:]]//' \
237 -e
's/[[:space:]][[:space:]]*/./' \
238 -e
's_^_s/^BDBVERSION=.*/BDBVERSION=_' \
240 > $(DEBIAN
)/berkeleydb.sed
241 # Store Berkeley DB version in postinst script.
242 sed
-i
-f
$(DEBIAN
)/berkeleydb.sed \
243 $(DEBIAN
)/exim4-base.postinst
244 touch build-arch-stamp
246 test-stamp
: build-arch-stamp
247 # it is not possible to run exim unless the compile-time specified
249 if id
-u Debian-exim
; then \
250 echo Debian-exim user found
, running minimal testsuite
; \
251 chmod
+x debian
/minimaltest
; \
252 rm -rf
$(CURDIR
)/test ; \
253 for i in b-exim4-daemon-light
/build-
$(buildname
)/exim \
255 do mkdir
$(CURDIR
)/test && \
256 debian
/minimaltest
$(CURDIR
)/test $$i || \
257 { echo testsuite error
; exit
1 ; } ; \
258 rm -rf
$(CURDIR
)/test ; \
263 build
: build-arch build-indep
273 rm -f build-stamp configure-stamp installbase-stamp test-stamp
275 # Add here commands to clean up after the build process.
276 [ ! -f Makefile
] ||
$(MAKE
) distclean
277 -rm -rf build-
* doc
/tmp
test/
278 -rm -f EDITME.
* unpack-configs-stamp
279 -rm -f
$(DEBIAN
)/debconf
/exim4.conf.template
$(DEBIAN
)/files \
280 $(DEBIAN
)/README.Debian
$(DEBIAN
)/README.Debian.html \
281 $(DEBIAN
)/berkeleydb.sed
283 #these are identical for all daemon-* and therefore symlinked
284 @cd
$(DEBIAN
) && find .
-maxdepth
1 \
285 -regex
'^\./exim4-daemon-.*\.\(postinst\|prerm\)$$' \
286 -and
-not
-name
'exim4-daemon-light.*' -print0 \
290 chmod
755 $(DEBIAN
)/exim-gencert \
291 $(DEBIAN
)/lynx-dump-postprocess
$(DEBIAN
)/script \
292 $(DEBIAN
)/exim-adduser
295 # fix broken (0600) permissions in original tarball
296 #find OS doc scripts exim_monitor src util -perm -044 -or -print0 |\
297 # xargs -0r chmod -c og+r
299 installbase-stamp
: b-exim4-daemon-light
/build-
$(buildname
)/exim debian
/README.Debian debian
/README.Debian.html
305 cd b-exim4-daemon-light
&& \
306 $(MAKE
) install FULLECHO
='' \
307 INSTALL_ARG
=-no_symlink \
308 inst_conf
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
309 inst_aliases
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/aliases \
310 inst_dest
=$(DEBIAN
)/exim4-base
/usr
/sbin
311 if
[ -e
"$(DEBIAN)/example.conf.md5" ] && [ "$$(< $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum)" != "$$(cat $(DEBIAN)/example.conf.md5)" ] ; then \
312 echo
"upstream example configuration has changed, new md5sum:"; \
313 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
; \
314 echo
"aborting build."; \
317 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
> $(DEBIAN
)/example.conf.md5
318 sed
-e
's,/[a-zA-Z/0-9.-]*exim4-base/examples/,/etc/,' \
319 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
320 > $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp
321 mv
$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp \
322 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf
323 install -m755 b-exim4-daemon-light
/build-
$(buildname
)/convert4r4 \
324 $(DEBIAN
)/exim4-base
/usr
/sbin
/exim_convert4r4
326 b-exim4-daemon-light
/build-
$(buildname
)/transport-filter.pl \
327 b-exim4-daemon-light
/util
/ratelimit.pl \
328 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
329 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/exim \
330 $(DEBIAN
)/exim4-daemon-light
/usr
/sbin
/exim4
331 # fix permissions of /usr/sbin/exim4 if running with restrictive umask,
332 # dh_fixperms sanitizes anything else
333 chmod
4755 $(DEBIAN
)/exim4-daemon-light
/usr
/sbin
/exim4
334 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon \
335 $(DEBIAN
)/eximon4
/usr
/sbin
336 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon.bin \
337 $(DEBIAN
)/eximon4
/usr
/lib
/exim4
338 pod2man
--center
=EXIM4
--section
=8 \
339 $(DEBIAN
)/exim4-base
/usr
/sbin
/exipick \
340 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/exipick
.8
341 pod2man
--center
=EXIM4
--section
=8 \
342 $(DEBIAN
)/exim4-base
/usr
/sbin
/eximstats \
343 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/eximstats
.8
344 install -m755
$(DEBIAN
)/syslog2eximlog
$(DEBIAN
)/exim4-base
/usr
/sbin
/
345 pod2man
--center
=EXIM4
--section
=8 \
346 $(DEBIAN
)/syslog2eximlog \
347 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/syslog2eximlog
.8
348 # if you change anything here, you will have to change
349 # config-custom/debian/rules as well
351 "s/^UPEX4C_version=\"\"/UPEX4C_version=\"$(DEBVERSION)\"/" \
352 < $(DEBIAN
)/debconf
/update-exim4.conf \
353 > $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
354 chmod
755 $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
355 install -m
755 $(DEBIAN
)/update-exim4defaults \
356 $(DEBIAN
)/exim4-config
/usr
/sbin
358 cd
$(DEBIAN
)/debconf
/conf.d
&& \
359 tar cf
- `find \( -path '*/.svn/*' -prune \) -or \
360 \( -type f -print \)` | \
361 { cd
$(DEBIAN
)/exim4-config
/etc
/exim4
/conf.d
/ && \
364 # ship a copy in examples
365 # install -m644 $(DEBIAN)/debconf/exim4.conf.template $(DEBIAN)/exim4-config/usr/share/doc/exim4-config/examples/exim4.conf.template.debconf
366 install -m644
$(DEBIAN
)/email-addresses
$(DEBIAN
)/exim4-config
/etc
/
367 install -m640
-oroot
-groot
$(DEBIAN
)/passwd.client \
368 $(DEBIAN
)/exim4-config
/etc
/exim4
/
369 chmod
755 $(DEBIAN
)/debconf
/update-exim4.conf.template
370 env CONFDIR
=$(DEBIAN
)/debconf \
371 $(DEBIAN
)/debconf
/update-exim4.conf.template
--nobackup
--run
373 touch installbase-stamp
376 # This dependency expands to
377 # debian/exim4-daemon-heavy/usr/sbin/exim4: b-exim4-daemon-heavy/build-Linux-x86_64/exim
378 $(debiandaemonbinaries
): $(DEBIAN
)/%/usr
/sbin
/exim4
: b-
%/build-
$(buildname
)/exim
382 install -m4755
-oroot
-groot
$< $@
385 # Build architecture-independent files here.
386 # this is just exim4-config and exim4.
387 binary-indep
: build
$(install)
388 ifeq ($(buildbasepackages
),yes
)
391 # upstream changelog is only in exim4-base
393 dh_installchangelogs
-i
-XCHANGES
395 dh_installexamples
-i
398 dh_installlogrotate
-i
399 # dh_installemacsen -i
406 dh_installppp
-i
--name
=exim4
410 dh_strip
$(dhcombinedidbgpackage
) $(dhstripparm
)
411 #for pkg in $(extraidbgpackage); do \
412 # dh_strip -p$$pkg --dbg-package=$${pkg}-dbg; \
415 dh_fixperms
-i
-X
/etc
/exim4
/passwd.client
420 dh_gencontrol
-i
-- -VUpstream-Version
=$(UPSTREAMVERSION
) \
421 -VMTA-Conflicts
="$(MTACONFLICTS)"
426 # Build architecture-dependent files here.
427 ifeq ($(buildbasepackages
),yes
)
428 install=installbase-stamp
$(debiandaemonbinaries
)
430 install=$(debiandaemonbinaries
)
433 binary-arch
: build
$(install)
434 dh_testdir
$(dhbuildpackages
)
435 dh_testroot
$(dhbuildpackages
)
436 # symlink identical maintainerscripts
437 @for i in
$(extradaemonpackages
) ; do \
438 ln
-sfv exim4-daemon-light.prerm \
439 "$(DEBIAN)/$$i.prerm" ; \
440 ln
-sfv exim4-daemon-light.postinst \
441 "$(DEBIAN)/$$i.postinst" ; \
443 # upstream changelog is only in exim4-base, the other packages include
445 dh_installchangelogs
-pexim4-base doc
/ChangeLog
446 # remove "-pexim4-base" from "-pexim4-base -pexim4-daemon-light ..."
447 dh_installchangelogs
$(subst -pexim4-base
,,$(dhbuildpackages
)) \
449 dh_installdocs
$(dhbuildpackages
)
450 dh_installexamples
$(dhbuildpackages
)
451 dh_installmenu
$(dhbuildpackages
)
452 dh_installdebconf
$(dhbuildpackages
)
453 dh_installlogrotate
$(dhbuildpackages
)
454 dh_installlogrotate
$(dhbuildpackages
) --name
=exim4-paniclog
455 # dh_installemacsen $(dhbuildpackages)
456 dh_installpam
$(dhbuildpackages
)
457 dh_installmime
$(dhbuildpackages
)
458 #dh_installinit $(dhbuildpackages) --noscripts --name=exim4
459 # work around #347577 (fixed in debhelper 5.0.15)
460 dh_installinit
$(dhbuildpackages
) -n
--name
=exim4
461 dh_installcron
$(dhbuildpackages
)
462 # dh_installinfo $(dhbuildpackages)
463 # dh_undocumented $(dhbuildpackages)
464 dh_installman
$(dhbuildpackages
)
465 dh_install
$(dhbuildpackages
)
466 # install config.h from daemon package, but not from exim4-daemon-light
467 dh_install
-p exim4-dev \
468 $(shell ls
-1 b-exim4-daemon-
*/build-
$(buildname
)/config.h | grep
-v ^b-exim4-daemon-light
/) \
470 dh_lintian
$(dhbuildpackages
)
471 dh_strip
$(dhcombinedadbgpackage
) $(dhstripparm
)
472 for pkg in
$(extraadbgpackage
); do \
473 dh_strip
-p
$$pkg --dbg-package
=$${pkg}-dbg
; \
475 dh_link
$(dhbuildpackages
)
476 dh_compress
$(dhbuildpackages
)
477 dh_fixperms
$(dhbuildpackages
) -Xusr
/sbin
/exim4
478 # dh_makeshlibs $(dhbuildpackages)
479 dh_installdeb
$(dhbuildpackages
)
480 # dh_perl $(dhbuildpackages)
481 dh_shlibdeps
$(dhbuildpackages
)
482 dh_gencontrol
$(dhbuildpackages
) -- \
483 -VUpstream-Version
=$(UPSTREAMVERSION
) \
484 -VMTA-Conflicts
="$(MTACONFLICTS)"
485 dh_md5sums
$(dhbuildpackages
)
486 dh_builddeb
$(dhbuildpackages
)
488 binary
: binary-arch binary-indep
489 .PHONY
: build
clean binary-indep binary-arch binary
install