File: rules

package info (click to toggle)
courier 1.0.16-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 49,264 kB
  • sloc: ansic: 128,070; cpp: 24,331; sh: 8,958; perl: 4,127; makefile: 3,243; sed: 16
file content (226 lines) | stat: -rwxr-xr-x 8,023 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
#!/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>
#
# 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 2 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.

BUILD=$(CURDIR)/debian/tmp

sed_AC_INIT = 's/AC_INIT(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)

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

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --with apache2

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 --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
	dh_installinit --remaining-packages

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

override_dh_install:
	${MAKE} install-perms
	cd $(CURDIR)/courier && ./perms.sh

# Install init-d helper script
	install -m 644 debian/init-d-script-courier $(BUILD)/usr/lib/courier/

# Create additional manpages
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	for man1 in addcr courier-config; do \
	    $(POD2MAN) --section=1 debian/$${man1}.pod > $(BUILD)/usr/share/man/man1/$${man1}.1; \
	done
	for man8 in sharedindexinstall sharedindexsplit webgpg webmaild; do \
	    $(POD2MAN) --section=8 debian/$${man8}.pod > $(BUILD)/usr/share/man/man8/$${man8}.8; \
	done
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

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

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