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 export DEB_BUILD_MAINT_OPTIONS
:= hardening
=+all
12 include /usr
/share
/dpkg
/buildflags.mk
13 include /usr
/share
/dpkg
/pkg-info.mk
14 # SOURCE_DATE_EPOCH is exported by pkg-info.mk since dpkg 1.18.8/July 2016
15 # fall back to current date otherwise.
16 SOURCE_DATE_EPOCH ?
= $(shell date
'+%s')
19 # The build system ignores CPPFLAGS, append them to CFLAGS
20 CFLAGS
+= $(shell getconf LFS_CFLAGS
) -D_LARGEFILE_SOURCE \
21 -fno-strict-aliasing
-Wall
$(CPPFLAGS
)
23 # LFLAGS is used where GNU would use LDFLAGS
24 export LFLAGS
= $(LDFLAGS
)
29 # If you want to build a daemon with a configuration tailored to YOUR special
30 # needs, uncomment the exim4-daemon-custom package in debian/control,
31 # call "debian/rules unpack-configs", copy EDITME.exim4-light to
32 # EDITME.exim4-custom and modify it, then call "debian/rules pack-configs".
34 # Afterwards EITHER uncomment the customdaemon definition below, or set it
35 # to the desired value via the environment.
37 # env customdaemon=exim4-daemon-custom dpkg-buildpackage -uc -us
39 # If you want to create multiple custom packages with different names, use
40 # the script debian/create-custom-package [suffix].
42 # customdaemon = exim4-daemon-custom
43 daemons
= exim4-daemon-light exim4-daemon-heavy
$(customdaemon
)
45 # If you want to build with OpenSSL instead of GnuTLS, uncomment this
47 # Please note that building exim4-daemon-heavy with OpenSSL is a GPL
50 PROVIDE_DEFAULT_MTA
:= $(shell if dpkg-vendor
--is Ubuntu || \
51 dpkg-vendor
--derives-from Ubuntu
; then
: ; else \
52 echo
"default-mta" ; fi
)
53 # for reproducible build. If set exim would use $TZ as default value for
59 unpack-configs
: unpack-configs-stamp
61 unpack-configs-stamp
: src
/EDITME exim_monitor
/EDITME
62 patch
-o EDITME.eximon exim_monitor
/EDITME \
63 $(DEBIAN
)/EDITME.eximon.diff
64 patch
-o EDITME.exim4-light src
/EDITME \
65 $(DEBIAN
)/EDITME.exim4-light.diff
67 patch EDITME.exim4-light
$(DEBIAN
)/EDITME.openssl.exim4-light.diff
69 for editme in
$(DEBIAN
)/EDITME.exim4-
*.diff
; do \
70 if
[ "$$editme" != "$(DEBIAN)/EDITME.exim4-light.diff" ]; then \
71 TARGETNAME
=`basename $$editme .diff`; \
72 echo patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme; \
73 patch
-o
$$TARGETNAME EDITME.exim4-light
$$editme || \
77 touch unpack-configs-stamp
80 -diff
-u src
/EDITME EDITME.exim4-light \
81 > $(DEBIAN
)/EDITME.exim4-light.diff
82 -for editme in EDITME.exim4-
*; do \
83 if
[ "$$editme" != "EDITME.exim4-light" ]; then \
84 echo diff
-u EDITME.exim4-light
$$editme; \
85 diff
-u EDITME.exim4-light
$$editme > $(DEBIAN
)/$${editme}.diff
; \
88 -diff
-u exim_monitor
/EDITME EDITME.eximon \
89 > $(DEBIAN
)/EDITME.eximon.diff
91 bdir-stamp
: unpack-configs-stamp
92 for i in
$(daemons
) ; do \
94 find .
-mindepth
1 -maxdepth
1 \
95 -name debian
-prune
-o \
96 -name
'b-*' -o
-print0 | \
97 xargs
--no-run-if-empty
--null \
98 cp
-a
--target-directory
=b-
$$i ; \
102 override_dh_auto_configure
: unpack-configs-stamp bdir-stamp
103 for i in
$(daemons
) ; do \
104 mkdir
-p b-
$$i/Local
&& \
105 cp EDITME.
`echo $$i | sed -e s/exim4-daemon/exim4/` \
106 b-
$$i/Local
/Makefile
&& \
107 cp EDITME.eximon b-
$$i/Local
/eximon.conf
;\
110 override_dh_auto_build
:
111 for i in
$(daemons
) ; do \
113 cd
$(CURDIR
)/b-
$$i && \
114 $(MAKE
) FULLECHO
='' ; \
116 # Which version of Berkeley DB are we building against?
117 printf
'#include <db.h>\ninstdbversionis DB_VERSION_MAJOR DB_VERSION_MINOR\n' | \
118 cpp -P | grep instdbversionis |\
119 sed
-e
's/[[:space:]]*instdbversionis[[:space:]]//' \
120 -e
's/[[:space:]][[:space:]]*/./' \
121 -e
's_^_s/^BDBVERSION=.*/BDBVERSION=_' \
123 > $(DEBIAN
)/berkeleydb.sed
124 # Store Berkeley DB version in postinst script.
125 sed
-i
-f
$(DEBIAN
)/berkeleydb.sed \
126 $(DEBIAN
)/exim4-base.postinst
127 # symlink identical maintainerscripts
128 for i in
`echo $(daemons) | sed -e s/exim4-daemon-light//` ; do \
129 ln
-sfv exim4-daemon-light.prerm \
130 "$(DEBIAN)/$$i.prerm" ; \
131 ln
-sfv exim4-daemon-light.postinst \
132 "$(DEBIAN)/$$i.postinst" ; \
135 override_dh_auto_install-arch
: debian
/README.Debian
136 cd b-exim4-daemon-light
&& \
137 $(MAKE
) install FULLECHO
='' \
138 INSTALL_ARG
=-no_symlink \
139 inst_conf
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
140 inst_aliases
=$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/aliases \
141 inst_dest
=$(DEBIAN
)/exim4-base
/usr
/sbin
142 if
[ -e
"$(DEBIAN)/example.conf.md5" ] && [ "$$(< $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf md5sum)" != "$$(cat $(DEBIAN)/example.conf.md5)" ] ; then \
143 echo
"upstream example configuration has changed, new md5sum:"; \
144 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
; \
145 echo
"aborting build."; \
148 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf md5sum
> $(DEBIAN
)/example.conf.md5
149 sed
-e
's,/[a-zA-Z/0-9.-]*exim4-base/examples/,/etc/,' \
150 < $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf \
151 > $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp
152 mv
$(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf.tmp \
153 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
/example.conf
154 install -m755 b-exim4-daemon-light
/build-
$(buildname
)/convert4r4 \
155 $(DEBIAN
)/exim4-base
/usr
/sbin
/exim_convert4r4
157 b-exim4-daemon-light
/build-
$(buildname
)/transport-filter.pl \
158 b-exim4-daemon-light
/util
/ratelimit.pl \
159 $(DEBIAN
)/exim4-base
/usr
/share
/doc
/exim4-base
/examples
160 rm $(DEBIAN
)/exim4-base
/usr
/sbin
/exim
161 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon \
162 $(DEBIAN
)/eximon4
/usr
/sbin
163 mv
$(DEBIAN
)/exim4-base
/usr
/sbin
/eximon.bin \
164 $(DEBIAN
)/eximon4
/usr
/lib
/exim4
165 pod2man
--center
=EXIM4
--section
=8 \
166 $(DEBIAN
)/exim4-base
/usr
/sbin
/exipick \
167 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/exipick
.8
168 pod2man
--center
=EXIM4
--section
=8 \
169 $(DEBIAN
)/exim4-base
/usr
/sbin
/eximstats \
170 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/eximstats
.8
171 install -m755
$(DEBIAN
)/syslog2eximlog
$(DEBIAN
)/exim4-base
/usr
/sbin
/
172 pod2man
--center
=EXIM4
--section
=8 \
173 $(DEBIAN
)/syslog2eximlog \
174 $(DEBIAN
)/exim4-base
/usr
/share
/man
/man8
/syslog2eximlog
.8
175 for i in b-exim4-daemon-
*/build-
$(buildname
)/exim
; do \
176 install -m4755
-oroot
-groot
$$i \
177 $(DEBIAN
)/`echo $$i | sed -e 's/^b-//' -e 's_/.*__'`/usr
/sbin
/exim4
; \
180 override_dh_auto_install-indep
: debian
/README.Debian
181 # if you change anything here, you will have to change
182 # config-custom/debian/rules as well
184 "s/^UPEX4C_version=\"\"/UPEX4C_version=\"$(DEB_VERSION)\"/" \
185 < $(DEBIAN
)/debconf
/update-exim4.conf \
186 > $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
187 chmod
755 $(DEBIAN
)/exim4-config
/usr
/sbin
/update-exim4.conf
188 install -m
755 $(DEBIAN
)/update-exim4defaults \
189 $(DEBIAN
)/exim4-config
/usr
/sbin
191 cd
$(DEBIAN
)/debconf
/conf.d
&& \
192 tar cf
- `find \( -path '*/.svn/*' -prune \) -or \
193 \( -type f -print \)` | \
194 { cd
$(DEBIAN
)/exim4-config
/etc
/exim4
/conf.d
/ && \
197 install -m644
$(DEBIAN
)/email-addresses
$(DEBIAN
)/exim4-config
/etc
/
198 install -m640
-oroot
-groot
$(DEBIAN
)/passwd.client \
199 $(DEBIAN
)/exim4-config
/etc
/exim4
/
200 chmod
755 $(DEBIAN
)/debconf
/update-exim4.conf.template
201 env CONFDIR
=$(DEBIAN
)/debconf \
202 $(DEBIAN
)/debconf
/update-exim4.conf.template
--nobackup
--run
204 # only called manually by maintainer before upload.
206 which grep-aptavail
> /dev
/null
&& \
207 grep-aptavail
--show-field
=Package
--field
=Provides \
208 mail-transport-agent
--no-field-names \
209 | grep
-v exim |
sort -u | \
210 tr
'\n' ',' | sed
-e
's/,/, /g;s/, $$//' > $(DEBIAN
)/mtalist
212 # Generate README.Debian as text/html ...
213 debian
/README.Debian.html
: debian
/README.Debian.xml
214 xsltproc
--nonet
--stringparam section.autolabel
1 \
216 /usr
/share
/xml
/docbook
/stylesheet
/nwalsh
/html
/docbook.xsl \
219 debian
/README.Debian
: debian
/README.Debian.html
220 chmod
755 $(DEBIAN
)/lynx-dump-postprocess
221 lynx
-force_html
-dump
$< |
$(DEBIAN
)/lynx-dump-postprocess
> $@.tmp
224 override_dh_auto_test
:
225 ifeq (,$(filter nocheck
,$(DEB_BUILD_OPTIONS
)))
226 # it is not possible to run exim unless the compile-time specified
228 if id
-u Debian-exim
; then \
229 echo Debian-exim user found
, running minimal testsuite
; \
230 chmod
+x debian
/minimaltest
; \
231 rm -rf
$(CURDIR
)/test ; \
232 for i in b-exim4-daemon
*/build-
$(buildname
)/exim
;\
233 do mkdir
$(CURDIR
)/test && \
234 debian
/minimaltest
$(CURDIR
)/test $$i || \
235 { echo testsuite error
; exit
1 ; } ; \
236 rm -rf
$(CURDIR
)/test ; \
241 override_dh_auto_clean
:
244 -rm -rf build-
* doc
/tmp
test/ b-exim
*
245 -rm -f EDITME.
* unpack-configs-stamp bdir-stamp
246 -rm -f
$(DEBIAN
)/debconf
/exim4.conf.template
$(DEBIAN
)/files \
247 $(DEBIAN
)/README.Debian
$(DEBIAN
)/README.Debian.html \
248 $(DEBIAN
)/berkeleydb.sed
250 #these are identical for all daemon-* and therefore symlinked
251 @cd
$(DEBIAN
) && find .
-maxdepth
1 \
252 -regex
'^\./exim4-daemon-.*\.\(postinst\|prerm\)$$' \
253 -and
-not
-name
'exim4-daemon-light.*' -delete
255 chmod
755 $(DEBIAN
)/exim-gencert \
256 $(DEBIAN
)/lynx-dump-postprocess
$(DEBIAN
)/script \
257 $(DEBIAN
)/exim-adduser
$(DEBIAN
)/exim4_refresh_gnutls-params
259 override_dh_installchangelogs
:
260 dh_installchangelogs
-pexim4-base doc
/ChangeLog
261 dh_installchangelogs
--no-package
=exim4-base \
262 -XCHANGES
-Xdoc
/ChangeLog
264 override_dh_installppp
:
265 dh_installppp
--name
=exim4
267 override_dh_fixperms
:
268 dh_fixperms
-X
/etc
/exim4
/passwd.client
-Xusr
/sbin
/exim4
270 override_dh_gencontrol
:
272 -VUpstream-Version
=$(DEB_VERSION_EPOCH_UPSTREAM
) \
273 -VMTA-Conflicts
="$(shell cat $(DEBIAN)/mtalist)" \
274 -Vdist
:Provides
:exim4-daemon-light
="$(PROVIDE_DEFAULT_MTA)"
276 override_dh_installlogrotate
:
278 dh_installlogrotate
--name
=exim4-paniclog
280 override_dh_installinit
:
281 dh_installinit
--noscripts
--name
=exim4
284 # install config.h from daemon package, but not from exim4-daemon-light
285 dh_install
-p exim4-dev \
286 $(shell ls
-1 b-exim4-daemon-
*/build-
$(buildname
)/config.h | grep
-v ^b-exim4-daemon-light
/) \
291 rm -rf debian
/exim4
/usr
/share
/doc
/exim4
297 .PHONY
: pack-configs unpack-configs update-mtaconflicts