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
74 dhstripparm
=--dbg-package
=$(exim4dbg
)
76 extraadbgpackage
=$(basedaemonpackages
) $(extradaemonpackages
)
83 extraadbgpackage
=$(extradaemonpackages
)
86 # If you want to build with OpenSSL instead of GnuTLS, uncomment this
88 # Please note that building exim4-daemon-heavy with OpenSSL is a GPL
92 # list of all arch dependent packages to be built
93 buildpackages
=$(combinedadbgpackage
) $(extraadbgpackage
) $(addsuffix -dbg
,$(extraadbgpackage
)) $(exim4dbg
) $(exim4dev
)
94 # generate -pexim4-base -peximon4 ... commandline for debhelper
95 dhbuildpackages
=$(addprefix -p
,$(buildpackages
))
96 dhcombinedadbgpackage
=$(addprefix -p
,$(combinedadbgpackage
))
98 # exim4-daemon-heavy --> b-exim4-daemon-heavy/build-Linux-x86_64/exim
99 daemonbinaries
=$(addprefix b-
,$(addsuffix /build-
$(buildname
)/exim
,$(extradaemonpackages
)))
100 debiandaemonbinaries
=$(addprefix $(DEBIAN
)/,$(addsuffix /usr
/sbin
/exim4
,$(extradaemonpackages
)))
101 BDIRS
=$(addprefix b-
,$(extradaemonpackages
) $(basedaemonpackages
))
104 # get upstream-version from debian/changelog, i.e. anything until the first -
105 DEBVERSION
:= $(shell dpkg-parsechangelog | sed
-n
'/^Version: /s/^Version: //p')
106 UPSTREAMVERSION
:= $(shell echo
$(DEBVERSION
) | sed
-n
's/\(.\+\)-[^-]\+/\1/p')
107 DEBTIME
:= $(shell dpkg-parsechangelog
--show-field Date
)
109 $(shell env LC_ALL
=C TZ
=UTC date
--date
="$(DEBTIME)" '+%b %e %Y')
111 $(shell env LC_ALL
=C TZ
=UTC date
--date
="$(DEBTIME)" '+%H:%M:%S')
113 PROVIDE_DEFAULT_MTA
:= $(shell if dpkg-vendor
--is Ubuntu || \
114 dpkg-vendor
--derives-from Ubuntu
; then
: ; else \
115 echo
"default-mta" ; fi
)
116 # for reproducible build. If set exim would use $TZ as default value for
122 # set up build directory b-exim4-daemon-heavy/
123 $(addsuffix /Makefile
,$(BDIRS
)): %/Makefile
:
125 find .
-mindepth
1 -maxdepth
1 \
126 -name debian
-prune
-o \
127 -name
'b-*' -o
-print0 | \
128 xargs
--no-run-if-empty
--null \
129 cp
-a
--target-directory
=$*
130 printf
'#define REPBUILDDATE "$(REPBUILDDATE)"\n' \
131 > $*/src
/repbuildtime.h
&& \
132 printf
'#define REPBUILDTIME "$(REPBUILDTIME)"\n' \
133 >> $*/src
/repbuildtime.h
136 unpack-configs
: unpack-configs-stamp
137 unpack-configs-stamp
: src
/EDITME exim_monitor
/EDITME
138 patch
-o EDITME.eximon exim_monitor
/EDITME \
139 $(DEBIAN
)/EDITME.eximon.diff
140 patch
-o EDITME.exim4-light src
/EDITME \
141 $(DEBIAN
)/EDITME.exim4-light.diff
143 patch EDITME.exim4-light
$(DEBIAN
)/EDITME.openssl.exim4-light.diff
145 for editme in
$(DEBIAN
)/EDITME.exim4-
*.diff
; do \
146 if
[ "$$editme" != "$(DEBIAN)/EDITME.exim4-light.diff" ]; then \
147 TARGETNAME
=`basename $$editme .diff`; \
148 echo patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme; \
149 patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme || \
153 touch unpack-configs-stamp
156 -diff
-u src
/EDITME EDITME.exim4-light \
157 > $(DEBIAN
)/EDITME.exim4-light.diff
158 -for editme in EDITME.exim4-
*; do \
159 if
[ "$$editme" != "EDITME.exim4-light" ]; then \
160 echo diff
-u EDITME.exim4-light
$$editme; \
161 diff
-u EDITME.exim4-light
$$editme > $(DEBIAN
)/$${editme}.diff
; \
164 -diff
-u exim_monitor
/EDITME EDITME.eximon \
165 > $(DEBIAN
)/EDITME.eximon.diff
167 # only called manually by maintainer before upload.
169 which grep-available
> /dev
/null
&& \
170 grep-available
--show-field
=Package
--field
=Provides \
171 mail-transport-agent
--no-field-names \
172 /var
/lib
/apt
/lists
/*Packages | grep
-v exim |
sort -u | \
173 tr
'\n' ',' | sed
-e
's/,/, /g;s/, $$//' > $(DEBIAN
)/mtalist
175 # Generate README.Debian as text/html ...
176 debian
/README.Debian.html
: debian
/README.Debian.xml
177 xsltproc
--nonet
--stringparam section.autolabel
1 \
179 /usr
/share
/xml
/docbook
/stylesheet
/nwalsh
/html
/docbook.xsl \
182 debian
/README.Debian
: debian
/README.Debian.html
183 chmod
755 $(DEBIAN
)/lynx-dump-postprocess
184 lynx
-force_html
-dump
$< |
$(DEBIAN
)/lynx-dump-postprocess
> $@.tmp
187 configure
: configure-stamp
189 configure-stamp
: $(addsuffix /Makefile
,$(BDIRS
)) unpack-configs-stamp
191 # Add here commands to configure the package.
194 # Build binaries for the base package, the eximon4 package, and the
195 # exim4-daemon-light package.
196 b-exim4-daemon-light
/build-
$(buildname
)/exim
: b-exim4-daemon-light
/Makefile configure-stamp
202 cp EDITME.exim4-light
$(<D
)/Local
/Makefile
203 cp EDITME.eximon
$(<D
)/Local
/eximon.conf
204 cd
$(<D
) && $(MAKE
) FULLECHO
=''
206 b-exim4-daemon-heavy
/build-
$(buildname
)/exim
: b-exim4-daemon-heavy
/Makefile configure-stamp
212 cp EDITME.exim4-heavy
$(<D
)/Local
/Makefile
213 cd
$(<D
) && $(MAKE
) FULLECHO
=''
215 b-exim4-daemon-custom
/build-
$(buildname
)/exim
: b-exim4-daemon-custom
/Makefile configure-stamp
221 cp EDITME.exim4-custom
$(<D
)/Local
/Makefile
222 cd
$(<D
) && $(MAKE
) FULLECHO
=''
224 build-indep
: build-indep-stamp
225 build-indep-stamp
: debian
/README.Debian
229 build-arch
: build-arch-stamp test-stamp
231 ifeq ($(buildbasepackages
),yes
)
232 build-arch-stamp
: b-exim4-daemon-light
/build-
$(buildname
)/exim
$(daemonbinaries
)
234 build-arch-stamp
: $(daemonbinaries
)
237 # Which version of Berkeley DB are we building against?
238 printf
'#include <db.h>\ninstdbversionis DB_VERSION_MAJOR DB_VERSION_MINOR\n' | \
239 cpp -P | grep instdbversionis |\
240 sed
-e
's/[[:space:]]*instdbversionis[[:space:]]//' \
241 -e
's/[[:space:]][[:space:]]*/./' \
242 -e
's_^_s/^BDBVERSION=.*/BDBVERSION=_' \
244 > $(DEBIAN
)/berkeleydb.sed
245 # Store Berkeley DB version in postinst script.
246 sed
-i
-f
$(DEBIAN
)/berkeleydb.sed \
247 $(DEBIAN
)/exim4-base.postinst
248 touch build-arch-stamp
250 test-stamp
: build-arch-stamp
251 # it is not possible to run exim unless the compile-time specified
253 if id
-u Debian-exim
; then \
254 echo Debian-exim user found
, running minimal testsuite
; \
255 chmod
+x debian
/minimaltest
; \
256 rm -rf
$(CURDIR
)/test ; \
257 for i in b-exim4-daemon-light
/build-
$(buildname
)/exim \
259 do mkdir
$(CURDIR
)/test && \
260 debian
/minimaltest
$(CURDIR
)/test $$i || \
261 { echo testsuite error
; exit
1 ; } ; \
262 rm -rf
$(CURDIR
)/test ; \
267 build
: build-arch build-indep
277 rm -f build-stamp configure-stamp installbase-stamp test-stamp
279 # Add here commands to clean up after the build process.
280 [ ! -f Makefile
] ||
$(MAKE
) distclean
281 -rm -rf build-
* doc
/tmp
test/
282 -rm -f EDITME.
* unpack-configs-stamp
283 -rm -f
$(DEBIAN
)/debconf
/exim4.conf.template
$(DEBIAN
)/files \
284 $(DEBIAN
)/README.Debian
$(DEBIAN
)/README.Debian.html \
285 $(DEBIAN
)/berkeleydb.sed
287 #these are identical for all daemon-* and therefore symlinked
288 @cd
$(DEBIAN
) && find .
-maxdepth
1 \
289 -regex
'^\./exim4-daemon-.*\.\(postinst\|prerm\)$$' \
290 -and
-not
-name
'exim4-daemon-light.*' -print0 \
294 chmod
755 $(DEBIAN
)/exim-gencert \
295 $(DEBIAN
)/lynx-dump-postprocess
$(DEBIAN
)/script \
296 $(DEBIAN
)/exim-adduser
$(DEBIAN
)/exim4_refresh_gnutls-params
300 installbase-stamp
: b-exim4-daemon-light
/build-
$(buildname
)/exim debian
/README.Debian debian
/README.Debian.html
306 cd b-exim4-daemon-light
&& \
307 $(MAKE
) install FULLECHO
='' \
308 INSTALL_ARG
=-no_symlink \
309 inst_conf
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
310 inst_aliases
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/aliases \
311 inst_dest
=$(DEBIAN
)/exim4-base
/usr
/sbin
312 if
[ -e
"$(DEBIAN)/example.conf.md5" ] && [ "$$(< $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum)" != "$$(cat $(DEBIAN)/example.conf.md5)" ] ; then \
313 echo
"upstream example configuration has changed, new md5sum:"; \
314 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
; \
315 echo
"aborting build."; \
318 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
> $(DEBIAN
)/example.conf.md5
319 sed
-e
's,/[a-zA-Z/0-9.-]*exim4-base/examples/,/etc/,' \
320 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
321 > $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp
322 mv
$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp \
323 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf
324 install -m755 b-exim4-daemon-light
/build-
$(buildname
)/convert4r4 \
325 $(DEBIAN
)/exim4-base
/usr
/sbin
/exim_convert4r4
327 b-exim4-daemon-light
/build-
$(buildname
)/transport-filter.pl \
328 b-exim4-daemon-light
/util
/ratelimit.pl \
329 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
330 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/exim \
331 $(DEBIAN
)/exim4-daemon-light
/usr
/sbin
/exim4
332 # fix permissions of /usr/sbin/exim4 if running with restrictive umask,
333 # dh_fixperms sanitizes anything else
334 chmod
4755 $(DEBIAN
)/exim4-daemon-light
/usr
/sbin
/exim4
335 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon \
336 $(DEBIAN
)/eximon4
/usr
/sbin
337 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon.bin \
338 $(DEBIAN
)/eximon4
/usr
/lib
/exim4
339 pod2man
--center
=EXIM4
--section
=8 \
340 $(DEBIAN
)/exim4-base
/usr
/sbin
/exipick \
341 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/exipick
.8
342 pod2man
--center
=EXIM4
--section
=8 \
343 $(DEBIAN
)/exim4-base
/usr
/sbin
/eximstats \
344 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/eximstats
.8
345 install -m755
$(DEBIAN
)/syslog2eximlog
$(DEBIAN
)/exim4-base
/usr
/sbin
/
346 pod2man
--center
=EXIM4
--section
=8 \
347 $(DEBIAN
)/syslog2eximlog \
348 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/syslog2eximlog
.8
349 # if you change anything here, you will have to change
350 # config-custom/debian/rules as well
352 "s/^UPEX4C_version=\"\"/UPEX4C_version=\"$(DEBVERSION)\"/" \
353 < $(DEBIAN
)/debconf
/update-exim4.conf \
354 > $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
355 chmod
755 $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
356 install -m
755 $(DEBIAN
)/update-exim4defaults \
357 $(DEBIAN
)/exim4-config
/usr
/sbin
359 cd
$(DEBIAN
)/debconf
/conf.d
&& \
360 tar cf
- `find \( -path '*/.svn/*' -prune \) -or \
361 \( -type f -print \)` | \
362 { cd
$(DEBIAN
)/exim4-config
/etc
/exim4
/conf.d
/ && \
365 install -m644
$(DEBIAN
)/email-addresses
$(DEBIAN
)/exim4-config
/etc
/
366 install -m640
-oroot
-groot
$(DEBIAN
)/passwd.client \
367 $(DEBIAN
)/exim4-config
/etc
/exim4
/
368 chmod
755 $(DEBIAN
)/debconf
/update-exim4.conf.template
369 env CONFDIR
=$(DEBIAN
)/debconf \
370 $(DEBIAN
)/debconf
/update-exim4.conf.template
--nobackup
--run
374 # This dependency expands to
375 # debian/exim4-daemon-heavy/usr/sbin/exim4: b-exim4-daemon-heavy/build-Linux-x86_64/exim
376 $(debiandaemonbinaries
): $(DEBIAN
)/%/usr
/sbin
/exim4
: b-
%/build-
$(buildname
)/exim
380 install -m4755
-oroot
-groot
$< $@
383 ifeq ($(buildbasepackages
),yes
)
384 install=installbase-stamp
$(debiandaemonbinaries
)
386 install=$(debiandaemonbinaries
)
389 override_dh_installchangelogs
:
390 dh_installchangelogs
-pexim4-base doc
/ChangeLog
391 dh_installchangelogs
--no-package
=exim4-base \
392 -XCHANGES
-Xdoc
/ChangeLog
394 override_dh_installppp
:
395 dh_installppp
--name
=exim4
397 override_dh_strip-arch
:
398 dh_strip
$(dhcombinedadbgpackage
) $(dhstripparm
)
399 for pkg in
$(extraadbgpackage
); do \
400 dh_strip
-p
$$pkg --dbg-package
=$${pkg}-dbg
; \
403 override_dh_fixperms
:
404 dh_fixperms
-X
/etc
/exim4
/passwd.client
-Xusr
/sbin
/exim4
406 override_dh_gencontrol
:
408 -VUpstream-Version
=$(UPSTREAMVERSION
) \
409 -VMTA-Conflicts
="$(shell cat $(DEBIAN)/mtalist)" \
410 -Vdist
:Provides
:exim4-daemon-light
="$(PROVIDE_DEFAULT_MTA)"
412 override_dh_installlogrotate
:
414 dh_installlogrotate
--name
=exim4-paniclog
416 override_dh_installinit
:
417 dh_installinit
--noscripts
--name
=exim4
420 # install config.h from daemon package, but not from exim4-daemon-light
421 dh_install
-p exim4-dev \
422 $(shell ls
-1 b-exim4-daemon-
*/build-
$(buildname
)/config.h | grep
-v ^b-exim4-daemon-light
/) \
427 rm -rf debian
/exim4
/usr
/share
/doc
/exim4
430 override_dh_auto_install
:
433 # Build architecture-independent files here.
434 # this is just exim4-config and exim4.
435 binary-indep
: build
$(install)
436 ifeq ($(buildbasepackages
),yes
)
440 # Build architecture-dependent files here.
441 binary-arch
: build
$(install)
442 # symlink identical maintainerscripts
443 @for i in
$(extradaemonpackages
) ; do \
444 ln
-sfv exim4-daemon-light.prerm \
445 "$(DEBIAN)/$$i.prerm" ; \
446 ln
-sfv exim4-daemon-light.postinst \
447 "$(DEBIAN)/$$i.postinst" ; \
451 binary
: binary-arch binary-indep
452 .PHONY
: build
clean binary-indep binary-arch binary
install