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
|
#!/usr/bin/make -f
#
# Copyright 2000,2001,2002,2003,2004 by Stefan Hornburg (Racke) <racke@linuxia.de>
#
# 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=$(shell pwd)/debian/tmp
RELUP=$(shell dpkg-parsechangelog | perl -ne 'print $$1 if /^Version: (.*?)-(.*)$$/')
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
# This is the debhelper compatability version to use.
export DH_COMPAT=2
# This has to be exported to make some magic below work.
export DH_OPTIONS
# Common configuration options
NONSSL_CONFOPTS=--without-certdb --without-authpgsql
COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
--with-piddir=/var/run/courier \
--sysconfdir=/etc/courier \
--libexecdir=\$${prefix}/lib/courier \
--datadir=\$${prefix}/lib/courier \
--localstatedir=/var/lib/courier \
--sbindir=\$${exec_prefix}/sbin \
--with-mailuser=daemon \
--with-mailgroup=daemon \
--without-socks \
--enable-workarounds-for-imap-client-bugs \
--with-authpam \
--without-authpwd \
--with-authmysql \
--with-mysql-includes=/usr/include/mysql \
--with-mysql-libs=/usr/lib \
--with-authpgsql \
--with-pgsql-includes=/usr/include/postgresql \
--with-pgsql-libs=/usr/lib \
--without-authshadow \
--without-authvchkpw \
--with-authdaemonvar=/var/run/courier/authdaemon \
--with-authldap \
--with-authcram \
--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=/var/run/courier/calendar \
--with-webadmindir=/usr/share/courier/webadmin \
--enable-userdb \
--enable-syslog=1 \
--enable-unicode \
--disable-root-check
check:
dh_testdir
# check for openssl
if [ ! -x /usr/bin/openssl ]; then \
echo "You need to install openssl first"; \
exit 1; \
fi
# check umask
if [ `umask` != "0022" ]; then echo "You need to set umask to 022 in order to compile/build courier"; exit 1; fi
chmod +x debian/fixlinks
chmod +x debian/courier_perms
chmod +x debian/correctpermissions.pl
build: check
# create a list of files that currently exists
chmod +x debian/srcmgr
if [ ! -f srcmgr.list ]; then debian/srcmgr > srcmgr.list; fi
if [ ! -f stamp-build ]; then \
LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
&& $(MAKE) && touch stamp-build; \
fi
stamp-build: build
clean: check
dh_testroot
rm -f stamp-build stamp-install
# Add here commands to clean up after the build process.
-$(MAKE) clean
dh_clean
if [ -f srcmgr.list ]; then debian/srcmgr cleanse < srcmgr.list; rm srcmgr.list; fi
#can be removed later
rm -f debian/permissions
install: check stamp-build
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/tmp.
$(MAKE) DESTDIR=$(BUILD) install
$(MAKE) DESTDIR=$(BUILD) install-perms
perl -i -pe 's%/usr/bin/sendmail%/usr/sbin/sendmail%; s%^/%$(BUILD)/% unless m%/debian/tmp/%' permissions.dat
/usr/bin/perl sysconftool `awk ' $$5 == "config" && $$1 ~ /\.dist$$/ { print $$1 }' <permissions.dat`
debian/correctpermissions.pl < permissions.dat > debian/permissions
# This was missing
echo "/var/run/courier 755 daemon daemon" >> debian/permissions
# Change absolute link made by make install to a relative one
debian/fixlinks $(BUILD)/usr/sbin
(cd $(BUILD)/usr/bin/; ln -fs ../lib/courier/courier/modules/esmtp/addcr ./addcr)
(cd $(BUILD)/usr/bin/; ln -fs ../lib/courier/makedat ./makedat)
(cd $(BUILD)/usr/lib/courier/authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
# We use update-alternatives to manage these, because they're shared
# by other packages, notably qmail, maildrop, mutt, mush
for i in maildirmake deliverquota lockmail preline; do \
(cd $(BUILD)/usr/bin && mv $$i $$i.courier); done
cd $(BUILD)/usr/share/man/man5 && mv maildir.5 maildir.courier.5
cd $(BUILD)/usr/share/man/man1 && mv maildirmake.1 maildirmake.courier.1
cd $(BUILD)/usr/share/man/man7 && mv maildirquota.7 maildirquota.courier.7
cd $(BUILD)/usr/share/man/man8 && mv deliverquota.8 deliverquota.courier.8
cd $(BUILD)/usr/share/man/man1 && mv lockmail.1 lockmail.courier.1
cd $(BUILD)/usr/share/man/man1 && mv preline.1 preline.courier.1
# Install authentification test program
cp authlib/authtest $(BUILD)/usr/sbin/courierauthtest
# Move programs with too generic names
cd $(BUILD)/usr/sbin && mv showconfig courier-mtaconfig
# Install "sendmail" into the right places
mv $(BUILD)/usr/bin/sendmail $(BUILD)/usr/sbin
(cd $(BUILD)/usr/lib; ln -fs ../sbin/sendmail .)
# Install "newaliases" stuff
cp -p debian/newaliases $(BUILD)/usr/sbin
chmod +x $(BUILD)/usr/sbin/newaliases
# Install "logcheck" stuff
install -d $(BUILD)/etc/logcheck/ignore.d.server
install -m 0644 debian/logcheck/courier-* $(BUILD)/etc/logcheck/ignore.d.server
install -d $(BUILD)/etc/logcheck/violations.ignore.d
install -m 0644 debian/logcheck/violations/courier-* $(BUILD)/etc/logcheck/violations.ignore.d
# Additional manpages
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/addcr.pod > $(BUILD)/usr/share/man/man8/addcr.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/authenumerate.pod > $(BUILD)/usr/share/man/man8/authenumerate.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/courierauthtest.pod > $(BUILD)/usr/share/man/man8/courierauthtest.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=1 debian/courier-config.pod > $(BUILD)/usr/share/man/man1/courier-config.1
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/newaliases.pod > $(BUILD)/usr/share/man/man8/newaliases.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/sharedindexinstall.pod > $(BUILD)/usr/share/man/man8/sharedindexinstall.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/sharedindexsplit.pod > $(BUILD)/usr/share/man/man8/sharedindexsplit.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/webgpg.pod > $(BUILD)/usr/share/man/man8/webgpg.8
pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/webmaild.pod > $(BUILD)/usr/share/man/man8/webmaild.8
# Move sqwebmail images
mv $(BUILD)/usr/lib/courier/sqwebmail/images $(BUILD)/usr/share/sqwebmail
# Ispell dictionary configuration will be produced by postinst
rm $(BUILD)/usr/lib/courier/sqwebmail/html/en-us/ISPELLDICT
(cd $(BUILD)/usr/lib/courier/sqwebmail/html/en-us; ln -s /etc/courier/ispelldict ISPELLDICT)
# Remove examples
rm $(BUILD)/usr/lib/courier/perlfilter-example.pl
rm $(BUILD)/etc/courier/quotawarnmsg.example
# Fix Perl paths in webadmin stuff
perl -i -pe 's%^#!\s?perl%#!/usr/bin/perl%' $(BUILD)/usr/share/courier/webadmin/*.pl
# Fix ldapsearch path
perl -i -pe 's%/usr/local/%/usr/%' $(BUILD)/usr/lib/courier/sqwebmail/ldapsearch
# Fix sendit.sh
perl -i -pe 's%sendmail%sendmail -oi -t%' $(BUILD)/usr/lib/courier/sqwebmail/sendit.sh
# Remove showmodules so we get rid of the libmysqlclient dependency
rm $(BUILD)/usr/sbin/showmodules
# Ensure that a valid symlink is used for some manpages
(cd $(BUILD)/usr/share/man/man7; rm authldap.7; ln -sf authlib.7.gz authldap.7.gz)
(cd $(BUILD)/usr/share/man/man7; rm authmysql.7; ln -sf authlib.7.gz authmysql.7.gz)
(cd $(BUILD)/usr/share/man/man8; rm makeuucpneighbors.8; ln -sf courieruucp.8.gz makeuucpneighbors.8.gz)
(cd $(BUILD)/usr/share/man/man8; rm -f esmtpd-ssl.8; ln -sf esmtpd.8.gz esmtpd-ssl.8.gz)
(cd $(BUILD)/usr/share/man/man8; ln -sf pop3d.8.gz pop3d-ssl.8.gz)
(cd $(BUILD)/usr/share/man/man8; ln -sf imapd.8.gz imapd-ssl.8.gz)
dh_installdocs
# Install documentation where dh_installdocs doesn't fit our needs
mkdir -p $(BUILD)/usr/share/doc/sqwebmail
cp -p debian/sqwebmail.html $(BUILD)/usr/share/doc/sqwebmail
cp -p gpglib/README.html $(BUILD)/usr/share/doc/sqwebmail/GPG.html
cp -p pcp/README.html $(BUILD)/usr/share/doc/sqwebmail/PCP.html
# Delete docs so that they don't end in courier-base
rm -rf debian/tmp/usr/lib/courier/htmldoc
# Adapt configuration files to our needs
# - security: disable EXPN and VRFY
perl -i -pe 's/^BOFHNO(EXPN|VRFY)=0/BOFHNO$$1=1/' $(BUILD)/etc/courier/esmtpd
# - start daemon by default
perl -i -pe 's/^ESMTPDSTART=NO/ESMTPDSTART=YES/;' $(BUILD)/etc/courier/esmtpd
# - fix PID location
perl -i -pe 's%^PIDFILE=.*%PIDFILE=/var/run/courier/esmtpd.pid%' $(BUILD)/etc/courier/esmtpd
perl -i -pe 's%^PIDFILE=.*%PIDFILE=/var/run/courier/esmtpd-msa.pid%' $(BUILD)/etc/courier/esmtpd-msa
# - fix location for certificate
perl -i -pe 's%^TLS_CERTFILE=.*%TLS_CERTFILE=/etc/courier/esmtpd.pem%' $(BUILD)/etc/courier/esmtpd
# - start daemons by default
perl -i -pe 's/^POP3DSTART=NO/POP3DSTART=YES/' $(BUILD)/etc/courier/pop3d
perl -i -pe 's/^MAXPERIP=\d+/MAXPERIP=20/; s/^IMAPDSTART=NO/IMAPDSTART=YES/' $(BUILD)/etc/courier/imapd
# - change authentification default settings
perl -i -pe 's/^authmodulelist=".*?"/authmodulelist="authpam"/' $(BUILD)/etc/courier/authdaemonrc
# - change default LDAP server
perl -i -pe 's/^(LDAP_SERVER\s+)ldap.example.com/$$1localhost/' $(BUILD)/etc/courier/authldaprc $(BUILD)/etc/courier/ldapaliasrc
# - change default MySQL server
perl -i -pe 's/^(MYSQL_SERVER\s+)mysql.example.com/$$1localhost/;s%^(#?\s*MYSQL_SOCKET\s+)/.*%$$1/var/run/mysqld/mysqld.sock%' $(BUILD)/etc/courier/authmysqlrc
perl -i -pe 's/^POP3DSSLSTART=NO/POP3DSSLSTART=YES/' $(BUILD)/etc/courier/pop3d-ssl
perl -i -pe 's%^TLS_CERTFILE=.*%TLS_CERTFILE=/etc/courier/pop3d.pem%' $(BUILD)/etc/courier/pop3d-ssl
perl -i -pe 's/^IMAPDSSLSTART=NO/IMAPDSSLSTART=YES/' $(BUILD)/etc/courier/imapd-ssl
perl -i -pe 's%^TLS_CERTFILE=.*%TLS_CERTFILE=/etc/courier/imapd.pem%' $(BUILD)/etc/courier/imapd-ssl
perl -i -pe 's%^SSLPIDFILE=.*%SSLPIDFILE=/var/run/courier/esmtpd-ssl.pid%' $(BUILD)/etc/courier/esmtpd-ssl
perl -i -pe 's/^ESMTPDSSLSTART=NO/ESMTPDSSLSTART=YES/' $(BUILD)/etc/courier/esmtpd-ssl
perl -i -pe 's%^TLS_CERTFILE=.*%TLS_CERTFILE=/etc/courier/esmtpd.pem%' $(BUILD)/etc/courier/esmtpd-ssl
rm $(BUILD)/etc/courier/*.dist
# Links for the certificates
cd $(BUILD)/usr/lib/courier && ln -s /etc/courier/pop3d.pem .
cd $(BUILD)/usr/lib/courier && ln -s /etc/courier/imapd.pem .
cd $(BUILD)/usr/lib/courier && ln -s /etc/courier/esmtpd.pem .
# Replace scripts with symlinks to startup scripts
rm $(BUILD)/usr/sbin/imapd
cd $(BUILD)/usr/sbin && ln -s /etc/init.d/courier-imap imapd
rm $(BUILD)/usr/lib/courier/pop3d-ssl
rm $(BUILD)/usr/sbin/pop3d-ssl
cd $(BUILD)/usr/sbin && ln -s /etc/init.d/courier-pop-ssl pop3d-ssl
rm $(BUILD)/usr/lib/courier/imapd-ssl
rm $(BUILD)/usr/sbin/imapd-ssl
cd $(BUILD)/usr/sbin && ln -s /etc/init.d/courier-imap-ssl imapd-ssl
# Replace PAM files with our versions
rm $(BUILD)/etc/courier/*.authpam
mkdir $(BUILD)/etc/pam.d
cp debian/courier-mta.pam $(BUILD)/etc/pam.d/esmtp
cp debian/courier-imap.pam $(BUILD)/etc/pam.d/imap
cp debian/courier-pop.pam $(BUILD)/etc/pam.d/pop3
cp debian/sqwebmail.pam $(BUILD)/etc/pam.d/webmail
cp debian/sqwebmail.pam $(BUILD)/etc/pam.d/calendar
# This seems to be necessary for building in fakeroot
# environment (otherwise dh_strip fails)
# set all binaries to 755, by checking if user has x-bit
# debian/courier_perms will set the right permissions
find $(BUILD) -perm +u+x -type f | xargs chmod u+rwx,go+rx
dh_movefiles
# Check if all files have moved out
if [ `find $(BUILD) -not -type d | wc -l` -ne 0 ]; then find $(BUILD) -not -type d; echo "File(s) found not belonging to any package, please contact maintainer"; exit 1; fi
touch stamp-install
stamp-install: install
# Build architecture-independent files here.
binary-indep: stamp-build stamp-install
dh_testdir
dh_testroot
dh_installdebconf -i
dh_installexamples -i
dh_installmenu -i
dh_installinit -i
dh_installinfo -i
dh_installchangelogs -p courier-doc
dh_strip -i
dh_link -i
dh_compress -i
dh_fixperms -i
debian/courier_perms -i
dh_installdeb -i
dh_perl -i
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: stamp-build stamp-install
dh_testdir
dh_testroot
dh_installdebconf -a
dh_installexamples -a
dh_installmenu -a
dh_installinit -a
dh_installcron -a
dh_installinfo -a
dh_installchangelogs -p courier-authdaemon
dh_installchangelogs -p courier-authmysql
dh_installchangelogs -p courier-authpostgresql
dh_installchangelogs -p courier-base ChangeLog
dh_installchangelogs -p courier-faxmail
dh_installchangelogs -p courier-imap imap/ChangeLog
dh_installchangelogs -p courier-imap-ssl
dh_installchangelogs -p courier-ldap
dh_installchangelogs -p courier-maildrop
dh_installchangelogs -p courier-mlm
dh_installchangelogs -p courier-mta
dh_installchangelogs -p courier-mta-ssl
dh_installchangelogs -p courier-pcp
dh_installchangelogs -p courier-pop
dh_installchangelogs -p courier-pop-ssl
dh_installchangelogs -p courier-ssl
dh_installchangelogs -p courier-webadmin
dh_installchangelogs -p sqwebmail webmail/ChangeLog
dh_strip -a
dh_link -a
dh_compress -a
dh_fixperms -a
debian/courier_perms -a
dh_installdeb -a
dh_perl -a
dh_shlibdeps -a
dh_gencontrol -a -Ncourier-imap -Ncourier-imap-ssl -- -VRELUP="$(RELUP)"
dh_gencontrol -pcourier-imap -- -VRELUP="$(RELUP)" -v3.0.8-$(shell dpkg-parsechangelog | perl -ne 'print $$2 if /^Version: (.*?)-(.*)$$/')
dh_gencontrol -pcourier-imap-ssl -- -VRELUP="$(RELUP)" -v3.0.8-$(shell dpkg-parsechangelog | perl -ne 'print $$2 if /^Version: (.*?)-(.*)$$/')
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: check build clean binary-indep binary-arch binary install
|