File: rules

package info (click to toggle)
courier 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,444 kB
  • sloc: ansic: 130,619; cpp: 33,255; sh: 10,437; perl: 4,250; makefile: 3,447; sed: 39
file content (259 lines) | stat: -rwxr-xr-x 9,472 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
#!/usr/bin/make -f
#
# Copyright 2000-2012 by Stefan Hornburg (Racke) <racke@linuxia.de>
# Copyright 2015 Ondřej Surý <ondrej@debian.org>
# Copyright 2017-2021 Markus Wanner <markus@bluegap.ch>
# Copyright 2025 Soren Stoutner <soren@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA.

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

# Enable the default build hardening flags.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# TODO: Remove this and just reference /debian/tmp directly when needed.
BUILD=$(CURDIR)/debian/tmp

# Get the version numbers of the subprojects from their configure.ac files.
sed_AC_INIT = 's/.*\[PACKAGE_NAME\],\[\([.0-9]*\)\].*/\1/p'
get_version = $(shell sed -ne $(subst PACKAGE_NAME,$(1),$(sed_AC_INIT)) $(2))
IMAPVER=$(call get_version,courier-imap,libs/imap/configure.ac)
SQWEBMAILVER=$(call get_version,sqwebmail,libs/sqwebmail/configure.ac)
MAILDROPVER=$(call get_version,maildrop,libs/maildrop/configure.ac)

# TODO.  This is required to use ${courier-base:Version} in debian/control.
include /usr/share/dpkg/default.mk

%:
	dh $@

#override_dh_autoreconf:
#	find $(CURDIR) -name Makefile.in -delete
#	dh_autoreconf --as-needed

# Common configuration options
COMMON_CONFIGURE = \
		MKDIR_P="mkdir -p" \
		--cache-file=$(CURDIR)/config.cache \
		--with-piddir=/run/courier \
		--sysconfdir=/etc/courier \
		--libexecdir=\$${prefix}/lib/courier \
		--datadir=\$${prefix}/lib/courier \
		--localstatedir=/var/lib/courier \
		--with-mailuser=courier \
		--with-mailgroup=courier \
		--with-mailuid=0 \
		--with-mailgid=0 \
		--without-socks \
		--with-gnutls \
		--enable-workarounds-for-imap-client-bugs \
		--with-authdaemonvar=/run/courier/authdaemon \
		--with-db=gdbm \
		--without-fcgi \
		--with-htmllibdir=/usr/share/sqwebmail \
		--with-ispell=/usr/bin/ispell \
		--enable-imageurl=/sqwebmail \
		--with-mailer="/usr/sbin/sendmail" \
		--enable-sendmail="/usr/sbin/sendmail" \
		--with-cachedir=/var/cache/sqwebmail \
		--with-calendardir=/run/courier/calendar \
		--with-certsdir=/etc/courier \
		--with-certsdb=/etc/ssl/certs/ca-certificates \
		--with-postgresql-includes=/usr/include/postgresql \
		--with-webadmindir=/usr/share/courier/webadmin \
		--with-notice=unicode \
		--enable-authlib \
		--enable-userdb \
		--enable-syslog=1 \
		--enable-unicode \
		--disable-root-check

override_dh_auto_configure:
	CONFIG_SHELL=/bin/sh dh_auto_configure -- $(COMMON_CONFIGURE)

override_dh_auto_install:
	INSTALL_IGNORE_UMASK=1 dh_auto_install -- install

override_dh_installdocs-arch:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	dh_installdocs -a
	install -m 644 debian/sqwebmail.html debian/sqwebmail/usr/share/doc/sqwebmail
	install -m 644 libs/gpglib/README.html debian/sqwebmail/usr/share/doc/sqwebmail/GPG.html
	install -m 644 libs/pcp/README.html debian/sqwebmail/usr/share/doc/sqwebmail/PCP.html
else
	rm -rf usr/lib/courier/htmldoc/*.html
endif

override_dh_installsystemd:
	dh_installsystemd -p courier-mta  --name=courier
	dh_installsystemd -p courier-mta  --name=courierfilter
	dh_installsystemd -p courier-mta  --name=courier-mta
	dh_installsystemd -p courier-mta  --name=courier-mta-ssl
	dh_installsystemd -p courier-mta  --name=courier-msa
	dh_installsystemd -p courier-imap --name=courier-imap
	dh_installsystemd -p courier-imap --name=courier-imap-ssl
	dh_installsystemd -p courier-pop  --name=courier-pop
	dh_installsystemd -p courier-pop  --name=courier-pop-ssl
	dh_installsystemd --package=sqwebmail --name=sqwebmail
	dh_installsystemd --package=sqwebmail --name=sqwebmail-cleancache
	# Don't enable the courier-mlm service by default as it requires the
	# user to create a mailing list first.  See #979545 and #979161.
	dh_installsystemd -p courier-mlm --no-enable --no-start
	dh_installsystemd --remaining-packages

override_dh_installinit:
	dh_installinit -p courier-mta --name=courier
	dh_installinit -p courier-mta --name=courierfilter
	dh_installinit -p courier-mta
	dh_installinit -p courier-mta --name=courier-mta-ssl
	dh_installinit -p courier-mta --name=courier-msa
	dh_installinit -p courier-imap
	dh_installinit -p courier-imap --name=courier-imap-ssl
	dh_installinit -p courier-pop
	dh_installinit -p courier-pop --name=courier-pop-ssl
	# The init script checks for the presense of a mailing list before
	# starting, so it is safe to enable by default.
	dh_installinit -p courier-mlm
	dh_installinit --remaining-packages

POD2MAN := pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version`

override_dh_install:
	# Generate the expected file permissions.
	${MAKE} install-perms

	# Display the expected file permissions in the build log.
	cat permissions.dat

	cd $(CURDIR)/courier && ./perms.sh

# Create additional manpages
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	# Generate the man1 pages.
	for man1 in addcr courier-config; do \
	    $(POD2MAN) --section=1 debian/$${man1}.pod > $(BUILD)/usr/share/man/man1/$${man1}.1; \
	done

	# Generate the man8 pages.
	for man8 in sharedindexinstall sharedindexsplit webgpg webmaild; do \
	    $(POD2MAN) --section=8 debian/$${man8}.pod > $(BUILD)/usr/share/man/man8/$${man8}.8; \
	done

	# Remove any undefined "an-trap" macros from the man pages.  <https://github.com/svarshavchik/courier/issues/58>
	sed -i '/an-trap/d' $(BUILD)/usr/share/man/man1/*
	sed -i '/an-trap/d' $(BUILD)/usr/share/man/man5/*
	sed -i '/an-trap/d' $(BUILD)/usr/share/man/man8/*
else
	# Remove manpages for nodoc builds
	rm -f $(BUILD)/usr/share/man/man?/*.[1234578]
endif

	# Ispell dictionary configuration will be produced by postinst
	rm -f $(BUILD)/usr/lib/courier/sqwebmail/html/en-us/ISPELLDICT

	# Remove examples
	rm -f $(BUILD)/usr/lib/courier/perlfilter-example.pl
	rm -f $(BUILD)/etc/courier/quotawarnmsg.example

	# Remove showmodules so we get rid of the libmysqlclient dependency
	rm -f $(BUILD)/usr/sbin/showmodules

	# Remove *.dist configuration files
	for f in $(BUILD)/etc/courier/*.dist; do \
	  mv $${f} $${f%.dist}; \
	done

	# Replace PAM files with our versions
	rm $(BUILD)/etc/courier/*.authpam
	install -d -m 755 $(BUILD)/etc/pam.d
	install -m 644 debian/common-session.pam $(BUILD)/etc/pam.d/esmtp
	install -m 644 debian/common-session.pam $(BUILD)/etc/pam.d/imap
	install -m 644 debian/common-session.pam $(BUILD)/etc/pam.d/pop3
	install -m 644 debian/common-password.pam $(BUILD)/etc/pam.d/webmail
	install -m 644 debian/common-password.pam $(BUILD)/etc/pam.d/calendar

	# faxmail init is just a shell snippet
	chmod 644 $(BUILD)/usr/lib/courier/faxmail/init

	# Kill duplicate maildrop package
	rm -f \
	  $(BUILD)/etc/courier/maildrop \
	  $(BUILD)/usr/bin/mailbot \
	  $(BUILD)/usr/bin/maildrop \
	  $(BUILD)/usr/bin/makemime \
	  $(BUILD)/usr/bin/reformail \
	  $(BUILD)/usr/bin/reformime \
	  $(BUILD)/usr/share/man/man1/mailbot.1 \
	  $(BUILD)/usr/share/man/man1/maildrop.1 \
	  $(BUILD)/usr/share/man/man1/makemime.1 \
	  $(BUILD)/usr/share/man/man1/reformail.1 \
	  $(BUILD)/usr/share/man/man1/reformime.1 \
	  $(BUILD)/usr/share/man/man7/maildropex.7 \
	  $(BUILD)/usr/share/man/man7/maildropfilter.7 \
	  $(BUILD)/usr/share/man/man7/maildropgdbm.7

	rm -f \
	  $(BUILD)/usr/lib/courier/mkpop3dcert \
	  $(BUILD)/usr/lib/courier/mkimapdcert

	# Delete unneeded and conflicting /usr/sbin/ links.  See <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064787>
	rm $(BUILD)/usr/sbin/imapd
	rm $(BUILD)/usr/sbin/imapd-ssl

	# Create missing directories.
	mkdir debian/tmp/etc/courier/sqwebmail

	# Create empty config files.
	touch debian/tmp/etc/courier/sqwebmail/dictionary
	touch debian/tmp/etc/courier/webadmin/password

	# Run dh_install then check for missing files
	dh_install
	dh_missing --fail-missing

execute_after_dh_auto_install:
	# Make admin-05local.pl executable to fix a lintian warning.
	chmod 755 debian/tmp/usr/share/courier/webadmin/admin-05local.pl

execute_after_dh_installcron:
	# Install the sqwebmail cleancache cron.
	dh_installcron --package=sqwebmail --name=sqwebmail-cleancache

override_dh_installchangelogs-indep:
	dh_installchangelogs -p courier-doc

override_dh_installchangelogs-arch:
	dh_installchangelogs -p courier-base ChangeLog
	dh_installchangelogs -p courier-imap libs/imap/ChangeLog
	dh_installchangelogs -p sqwebmail libs/sqwebmail/ChangeLog
	dh_installchangelogs -a --remaining-packages

override_dh_gencontrol-arch:
	echo "courier-base:Version=$(DEB_VERSION)" >> debian/sqwebmail.substvars
	dh_gencontrol -psqwebmail -- -v$(SQWEBMAILVER)+$(DEB_VERSION_UPSTREAM_REVISION)

	echo "courier-base:Version=$(DEB_VERSION)" >> debian/courier-imap.substvars
	dh_gencontrol -pcourier-imap -- -v$(IMAPVER)+$(DEB_VERSION_UPSTREAM_REVISION)

	dh_gencontrol -a --remaining-packages

override_dh_auto_clean:
	dh_auto_clean

# Update translation files.
	debconf-updatepo