File: rules

package info (click to toggle)
exim4 4.50-8sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,852 kB
  • ctags: 5,278
  • sloc: ansic: 75,531; sh: 4,380; makefile: 476; perl: 65
file content (388 lines) | stat: -rwxr-xr-x 13,705 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# This file is public domain software, originally written by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

# Uncomment this to turn on verbose mode. 
export DH_VERBOSE=1

buildname=$${build:-`$(SHELL) scripts/os-type`-`$(SHELL) scripts/arch-type`}

# Include dpatch stuff.
include /usr/share/dpatch/dpatch.make

DEBIAN:=$(shell pwd)/debian

CFLAGS := -g -Wall $(shell getconf LFS_CFLAGS) -D_LARGEFILE_SOURCE -fno-strict-aliasing

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

export CFLAGS

# Which packages should we build?
buildbasepackages=yes

builddaemonpackages=exim4-daemon-heavy
# If you want to build a daemon with a configuration tailored to YOUR special
# needs, call "fakeroot debian/rules unpack-configs", copy EDITME.exim4-light
# to EDITME.exim4-custom and modify it.
#
# If you want to create multiple custom packages with different names, use
# the script debian/create-custom-package [suffix].
#
# Afterwards EITHER disable the definition of builddaemonpackages 4 lines above
# by adding a hash-mark (#) at the start of the line and enable the one
# below instead by removing the hash-mark OR simply call
# "fakeroot debian/rules buildbasepackages=no builddaemonpackages=exim4-daemon-custom binary"
#builddaemonpackages=exim4-daemon-custom

# If you want to build a source-package that builds the custom daemon call
# "fakeroot debian/rules pack-configs" after customizing EDITME.exim4-custom

# If you remove exim4-daemon-light from buildpackages to prevent
# exim4-daemon-light from being built, you need to modify the build
# process to pull the helper binaries from the daemon package that you
# actually build. If you simply remove exim4-daemon-light here, you will
# end up with exim4-base sans binaries, which is most probably not what
# you intend to have.
ifeq ($(buildbasepackages),yes)
buildpackages=exim4-base exim4-daemon-light eximon4 $(builddaemonpackages)
else
buildpackages=$(builddaemonpackages)
endif

# generate -pexim4-base -peximon4 ... commandline for debhelper
dhbuildpackages=$(addprefix -p,$(buildpackages))
# exim4-daemon-light --> build-exim4-daemon-light/exim
daemonbinaries=$(addprefix build-,$(addsuffix /exim,$(builddaemonpackages)))
debiandaemonbinaries=$(addprefix $(DEBIAN)/,$(addsuffix /usr/sbin/exim4,$(builddaemonpackages)))

# get upstream-version from debian/changelog, i.e. anything until the first -
UPSTREAMVERSION	:=	$(shell dpkg-parsechangelog | sed -n '/^Version: /{s/^Version: \(.\+\)-[^-]\+/\1/;p;}')
MTACONFLICTS := $(shell cat debian/mtalist)

ifeq (,$(wildcard /usr/bin/po2debconf))
PO2DEBCONF := no
else
PO2DEBCONF := yes
endif

unpack-configs: unpack-configs-stamp
unpack-configs-stamp: patch-stamp
	patch -o EDITME.eximon exim_monitor/EDITME debian/EDITME.eximon.diff
	patch -o EDITME.exim4-light src/EDITME debian/EDITME.exim4-light.diff
	-for editme in debian/EDITME.exim4-*.diff; do \
	  if [ "$$editme" != "debian/EDITME.exim4-light.diff" ]; then \
	    TARGETNAME=`basename $$editme .diff`; \
	    echo patch -o $$TARGETNAME EDITME.exim4-light $$editme; \
	    patch -o $$TARGETNAME EDITME.exim4-light $$editme; \
	  fi; \
	done
	touch unpack-configs-stamp

pack-configs: patch
	-diff -u src/EDITME EDITME.exim4-light > debian/EDITME.exim4-light.diff
	-for editme in EDITME.exim4-*; do \
	  if [ "$$editme" != "EDITME.exim4-light" ]; then \
	    echo diff -u EDITME.exim4-light $$editme; \
	    diff -u EDITME.exim4-light $$editme > debian/$${editme}.diff; \
	  fi; \
	done
	-diff -u exim_monitor/EDITME EDITME.eximon > debian/EDITME.eximon.diff

# only called manually by maintainer before upload.
update-mtaconflicts:
	which grep-available > /dev/null && \
		grep-available --show-field=Package --field=Provides \
		mail-transport-agent --no-field-names \
		/var/lib/apt/lists/*Packages | grep -v exim | sort -u | \
		tr '\n' ',' | sed -e 's/,/, /g;s/, $$//' > debian/mtalist

configure: configure-stamp

# the patches might change src/EDITME.
configure-stamp: patch-stamp unpack-configs-stamp
	dh_testdir
	# Add here commands to configure the package.
	touch configure-stamp

# Build binaries for the base package, the eximon4 package, and the
# exim4-daemon-light package.
build-exim4-daemon-light/exim: configure-stamp
	echo build-exim4-daemon-light
	dh_testdir

	rm -rf build-$(buildname)
	# Add here command to compile/build the package.
	mkdir -p Local
	cp EDITME.exim4-light Local/Makefile
	cp EDITME.eximon Local/eximon.conf
	$(MAKE)
	mv build-$(buildname) build-exim4-daemon-light

build-exim4-daemon-custom/exim: configure-stamp
	echo build-exim4-daemon-custom
	dh_testdir

	rm -rf build-$(buildname)
	# Add here command to compile/build the package.
	mkdir -p Local
	cp EDITME.exim4-custom Local/Makefile
	$(MAKE) Local/Makefile configure
	# This is a kludge. The upstream Makefile should be fixed, really.
	$(MAKE) -C build-$(buildname) checklocalmake Makefile os.h os.c config.h buildpcre buildlookups buildrouters buildtransports buildauths exim
	mv build-$(buildname) build-exim4-daemon-custom

build-exim4-daemon-heavy/exim: configure-stamp
	echo build-exim4-daemon-heavy
	dh_testdir

	rm -rf build-$(buildname)
	# Add here command to compile/build the package.
	mkdir -p Local
	cp EDITME.exim4-heavy Local/Makefile
	$(MAKE) Local/Makefile configure
	# This is a kludge. The upstream Makefile should be fixed, really.
	$(MAKE) -C build-$(buildname) checklocalmake Makefile os.h os.c config.h buildpcre buildlookups buildrouters buildtransports buildauths exim
	mv build-$(buildname) build-exim4-daemon-heavy

build-indep: build-indep-stamp
build-indep-stamp:
	dh_testdir

	# Add here command to compile/build the arch indep package.
	# It's ok not to do anything here, if you don't need to build
	#  anything for this package.
	#/usr/bin/docbook-to-man debian/exim.sgml > exim.1

	touch build-indep-stamp

build-arch: build-arch-stamp

ifeq ($(buildbasepackages),yes)
build-arch-stamp: build-exim4-daemon-light/exim $(daemonbinaries)
else
build-arch-stamp: $(daemonbinaries)
endif
	dh_testdir
	touch build-arch-stamp

build: build-arch build-indep

clean: cleanfiles unpatch

cleanfiles:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp installbase-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) clean
	-rm -rf build-* doc/tmp
	-rm -f EDITME.* Local/Makefile Local/eximon.conf unpack-configs-stamp
	-rm -f debian/debconf/exim4.conf.template debian/files

	#these are identical for all daemon-* and therefore symlinked
	@cd $(DEBIAN) && find . -maxdepth 1 \
		-regex '^\./exim4-daemon-.*\.\(postinst\|prerm\)$$' \
		-and -not -name 'exim4-daemon-light.*' -print0 \
		| xargs -0r rm -v
	
	pwd
	chmod 755 $(DEBIAN)/exim-gencert
ifeq ($(PO2DEBCONF),yes)
		# Compatibility with woody.
		echo 1 > debian/po/output
		for i in debian/*.templates.master ; do \
			po2debconf $$i > debian/`basename $$i .master`; \
		done
		rm -f debian/po/output
endif
	dh_clean podebconfize
	rm -rf Local
	# fix broken (0600) permissions in original tarball
	find OS doc scripts exim_monitor src util -perm -044 -or -print0 |\
		xargs -0r chmod -c og+r

installbase-stamp: build-exim4-daemon-light/exim
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	rm -rf build-$(buildname)
	ln -s build-exim4-daemon-light build-$(buildname)
	$(MAKE) install \
		INSTALL_ARG=-no_symlink \
		inst_conf=$(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf \
		inst_aliases=$(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/aliases \
                inst_dest=$(DEBIAN)/exim4-base/usr/sbin
	sed -e 's,/[a-zA-Z/0-9.-]*exim4-base/examples/,/etc/,' \
		< $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf \
		> $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf.tmp
	mv $(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf.tmp \
		$(DEBIAN)/exim4-base/usr/share/doc/exim4-base/examples/example.conf
	sed -e 's,PERL_COMMAND,/usr/bin/perl,' < src/convert4r4.src \
		> $(DEBIAN)/exim4-base/usr/sbin/exim_convert4r4
	chmod 755 $(DEBIAN)/exim4-base/usr/sbin/exim_convert4r4
	mv $(DEBIAN)/exim4-base/usr/sbin/exim \
		$(DEBIAN)/exim4-daemon-light/usr/sbin/exim4
	# fix permssions of /usr/sbin/exim4 if running with restrictive umask,
	# dh_fixperms sanitizes anything else
	chmod 4755 $(DEBIAN)/exim4-daemon-light/usr/sbin/exim4
	mv $(DEBIAN)/exim4-base/usr/sbin/eximon \
		$(DEBIAN)/eximon4/usr/sbin
	mv $(DEBIAN)/exim4-base/usr/sbin/eximon.bin \
		$(DEBIAN)/eximon4/usr/lib/exim4
	pod2man --center=EXIM4 --section=8 \
		$(DEBIAN)/exim4-base/usr/sbin/exipick \
		$(DEBIAN)/exim4-base/usr/share/man/man8/exipick.8
	pod2man --center=EXIM4 --section=8 \
		$(DEBIAN)/exim4-base/usr/sbin/eximstats \
		$(DEBIAN)/exim4-base/usr/share/man/man8/eximstats.8
	install -m755 $(DEBIAN)/syslog2eximlog $(DEBIAN)/exim4-base/usr/sbin/
	pod2man --center=EXIM4 --section=8 \
		$(DEBIAN)/syslog2eximlog \
		$(DEBIAN)/exim4-base/usr/share/man/man8/syslog2eximlog.8
	# if you change anything here, you will have to change
	# config-custom/debian/rules as well
	sed -e \
	"s/^UPEX4C_version=\"\"/UPEX4C_version=\"`dpkg-parsechangelog | sed -n '/^Version: /s/^Version: //p'`\"/" \
	< $(DEBIAN)/debconf/update-exim4.conf \
	> $(DEBIAN)/exim4-config/usr/sbin/update-exim4.conf
	chmod 755 $(DEBIAN)/exim4-config/usr/sbin/update-exim4.conf
	install -m 755 $(DEBIAN)/update-exim4defaults $(DEBIAN)/exim4-config/usr/sbin

	cd $(DEBIAN)/debconf/conf.d && \
		tar cf - `find \( -path '*/.svn/*' -prune \) -or \( -type f -print \)` | \
		{ cd $(DEBIAN)/exim4-config/etc/exim4/conf.d/ && \
		tar xf - ; }

	# ship a copy in examples
	# install -m644 debian/debconf/exim4.conf.template debian/exim4-config/usr/share/doc/exim4-config/examples/exim4.conf.template.debconf
	install -m644 debian/email-addresses debian/exim4-config/etc/
	install -m755 debian/ip-up.d debian/exim4-config/etc/ppp/ip-up.d/exim4
	install -m640 -oroot -groot debian/passwd.client $(DEBIAN)/exim4-config/etc/exim4/
	chmod 755 debian/debconf/update-exim4.conf.template
	CONFDIR=$(DEBIAN)/debconf debian/debconf/update-exim4.conf.template --nobackup --run
	# escape dashes in manpages
	cd $(DEBIAN)/exim4-base/usr/share/man/man8/ &&\
		perl -pi -e 's/(?<!\\)-/\\-/g' \
		syslog2eximlog.8 eximstats.8 exipick.8
#	dh_movefiles
	touch installbase-stamp


# This dependency expands to
#   debian/exim4-daemon-heavy/usr/sbin/exim4: build-exim4-daemon-heavy/exim
$(debiandaemonbinaries): $(DEBIAN)/%/usr/sbin/exim4: build-%/exim
	dh_testdir
	dh_testroot
	dh_installdirs
	install -m4755 -oroot -groot $< $@


podebconfize:
ifeq ($(PO2DEBCONF),yes)
	# let debhelper do po2debconf if it is new enough.
	if dh_testversion 4.1.16 >/dev/null 2>&1 ; then \
		for i in debian/*.templates.master ; do \
			cat $$i > debian/`basename $$i .master`; \
			touch --reference=$$i debian/`basename $$i .master` ; \
		done \
	fi
endif
	touch $@

# Build architecture-independent files here.
# this is just exim4-config and exim4.
binary-indep: build $(install) podebconfize
ifeq ($(buildbasepackages),yes)
	dh_testdir -i
	dh_testroot -i
	# upstream changelog is only in exim4-base
	dh_link -i
	dh_installchangelogs -i
	dh_installdocs -i
	dh_installexamples -i
	#dh_installmenu -i
	dh_installdebconf -i
	dh_installlogrotate -i
#	dh_installemacsen -i
	#dh_installpam -i
	#dh_installmime -i
#	dh_installinit -i
	dh_installcron -i
#	dh_installinfo -i
#	dh_undocumented -i
	dh_installman -i
	dh_install -i
	dh_strip -i
	dh_compress -i
	dh_fixperms -i -X/etc/exim4/passwd.client
#	dh_makeshlibs -i
	dh_installdeb -i
#	dh_perl -i
	dh_shlibdeps -i
	dh_gencontrol -i -- -VUpstream-Version=$(UPSTREAMVERSION) -VMTA-Conflicts="$(MTACONFLICTS)"
	dh_md5sums -i
	dh_builddeb -i
endif

# Build architecture-dependent files here.
ifeq ($(buildbasepackages),yes)
install=installbase-stamp $(debiandaemonbinaries)
else
install=$(debiandaemonbinaries)
endif

binary-arch: build $(install) podebconfize
	dh_testdir $(dhbuildpackages)
	dh_testroot $(dhbuildpackages)
	# symlink identical maintainerscripts
	@for i in $(builddaemonpackages) ; do \
		ln -sfv exim4-daemon-light.prerm \
			"$(DEBIAN)/$$i.prerm" ; \
		ln -sfv exim4-daemon-light.postinst \
			"$(DEBIAN)/$$i.postinst" ; \
	done
	# upstream changelog is only in exim4-base, the other packages include
	# a symlink
	dh_installchangelogs -pexim4-base doc/ChangeLog
	# remove "-pexim4-base" from "-pexim4-base -pexim4-daemon-light ..."
	dh_installchangelogs $(subst -pexim4-base,,$(dhbuildpackages))
	dh_installdocs $(dhbuildpackages)
	dh_installexamples $(dhbuildpackages)
	dh_installmenu $(dhbuildpackages)
	dh_installdebconf $(dhbuildpackages)
	dh_installlogrotate $(dhbuildpackages)
#	dh_installemacsen $(dhbuildpackages)
	dh_installpam $(dhbuildpackages)
	dh_installmime $(dhbuildpackages)
	dh_installinit $(dhbuildpackages) --noscripts --init-script=exim4
	dh_installcron $(dhbuildpackages)
#	dh_installinfo $(dhbuildpackages)
#	dh_undocumented $(dhbuildpackages)
	dh_installman $(dhbuildpackages)
	dh_install $(dhbuildpackages)
	dh_strip $(dhbuildpackages)
	dh_link $(dhbuildpackages)
	dh_compress $(dhbuildpackages)
	dh_fixperms $(dhbuildpackages) -Xusr/sbin/exim4
#	dh_makeshlibs $(dhbuildpackages)
	dh_installdeb $(dhbuildpackages)
#	dh_perl $(dhbuildpackages)
	dh_shlibdeps $(dhbuildpackages)
	dh_gencontrol $(dhbuildpackages) -- -VUpstream-Version=$(UPSTREAMVERSION) -VMTA-Conflicts="$(MTACONFLICTS)"
	dh_md5sums $(dhbuildpackages)
	dh_builddeb $(dhbuildpackages)

binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install