Imported Debian patch 0.59.3-1
[hcoop/debian/courier-authlib.git] / debian / rules
CommitLineData
426e7833 1#!/usr/bin/make -f
2#
3# Copyright 2004,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public
16# License along with this program; if not, write to the Free
17# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18# MA 02111-1307 USA.
19
20BUILD=$(shell pwd)/debian/tmp
21RELUP=$(shell dpkg-parsechangelog | perl -ne 'print $$1 if /^Version: (.*?)-(.*)$$/')
22
23# Uncomment this to turn on verbose mode.
24# export DH_VERBOSE=1
25
26# This is the debhelper compatability version to use.
27export DH_COMPAT=4
28
29# This has to be exported to make some magic below work.
30export DH_OPTIONS
31
32# Common configuration options
33NONSSL_CONFOPTS=--without-certdb --without-authpgsql
34
35COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
36 --with-authdaemonvar=/var/run/courier/authdaemon \
37 --sysconfdir=/etc/courier \
38 --with-pkgconfdir=/etc/courier \
39 --libexecdir=\$${prefix}/lib/courier \
40 --datadir=\$${prefix}/lib/courier \
41 --localstatedir=/var/lib/courier \
42 --sbindir=\$${exec_prefix}/sbin \
43 --with-mailuser=daemon \
44 --with-mailgroup=daemon \
45 --without-socks \
46 --with-authpam \
47 --with-authpipe \
48 --without-authpwd \
49 --with-authmysql \
50 --with-mysql-includes=/usr/include/mysql \
51 --with-mysql-libs=/usr/lib \
52 --with-authmysqlrc=/etc/courier/authmysqlrc \
53 --with-authpgsql \
54 --with-pgsql-includes=`pg_config --includedir` \
55 --with-pgsql-libs=/usr/lib \
56 --with-authpgsqlrc=/etc/courier/authpgsqlrc \
57 --without-authshadow \
58 --without-authvchkpw \
59 --with-authdaemonvar=/var/run/courier/authdaemon \
60 --with-authldap \
61 --with-authldaprc=/etc/courier/authldaprc \
62 --with-authcram \
63 --with-db=gdbm \
64 --without-fcgi \
65 --with-htmllibdir=/usr/share/sqwebmail \
66 --with-ispell=/usr/bin/ispell \
67 --enable-userdb \
68 --enable-syslog=1 \
69 --disable-root-check
70
71check:
72 dh_testdir
73
74# check umask
75 if [ `umask` != "0022" ]; then echo "You need to set umask to 022 in order to compile/build courier"; exit 1; fi
76 chmod +x debian/courier_perms
77
78build: check
79# create a list of files that currently exists
80 if [ ! -f stamp-build ]; then \
81 if [ -d /usr/include/postgresql/8.0/libpq_fe.h ]; then \
82 LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
83 --with-postgresql-includes=/usr/include/postgresql/8.0 \
84 && $(MAKE) && touch stamp-build; \
85 else \
86 LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
87 --with-postgresql-includes=/usr/include/postgresql \
88 && $(MAKE) && touch stamp-build; \
89 fi \
90 fi
91
92stamp-build: build
93
94clean: check
95 dh_testroot
96 rm -f stamp-build stamp-install
97
98# Add here commands to clean up after the build process.
99 -$(MAKE) clean
100 dh_clean
101
102install: check stamp-build
103 dh_testroot
104 dh_clean -k
105 dh_installdirs
106
107# Add here commands to install the package into debian/tmp.
108 $(MAKE) DESTDIR=$(BUILD) install
109
110# (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
111
112# Install authentification test program
113# mv $(BUILD)/usr/sbin/authtest $(BUILD)/usr/sbin/courierauthtest
114
115# Additional manpages
116 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
117# 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
118
119# Symlinks for userdb manpages
120 (cd $(BUILD)/usr/share/man/man8 && ln -s makeuserdb.8.gz pw2userdb.8.gz && ln -s makeuserdb.8.gz vchkpw2userdb.8.gz)
121
122 dh_installdocs
123# - change authentification default settings
124 perl -pe 's/^authmodulelist=".*?"/authmodulelist="authpam"/' $(BUILD)/etc/courier/authdaemonrc.dist > $(BUILD)/etc/courier/authdaemonrc
125# - change default LDAP server
126 perl -pe 's/^(LDAP_SERVER\s+)ldap.example.com/$$1localhost/' $(BUILD)/etc/courier/authldaprc.dist > $(BUILD)/etc/courier/authldaprc
127# - change default MySQL server
128 perl -pe 's/^(MYSQL_SERVER\s+)mysql.example.com/$$1localhost/;s%^(#?\s*MYSQL_SOCKET\s+)/.*%$$1/var/run/mysqld/mysqld.sock%' $(BUILD)/etc/courier/authmysqlrc.dist > $(BUILD)/etc/courier/authmysqlrc
129 mv $(BUILD)/etc/courier/authpgsqlrc.dist $(BUILD)/etc/courier/authpgsqlrc
130 rm $(BUILD)/etc/courier/*.dist
131
132# This seems to be necessary for building in fakeroot
133# environment (otherwise dh_strip fails)
134# set all binaries to 755, by checking if user has x-bit
135# debian/courier_perms will set the right permissions
136 find $(BUILD) -perm -u+x -type f | xargs chmod u+rwx,go+rx
137
138 dh_movefiles
139
140# Check if all files have moved out
141 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
142
143 touch stamp-install
144
145stamp-install: install
146
147# Build architecture-independent files here.
148binary-indep: stamp-build stamp-install
149 dh_testdir
150 dh_testroot
151# dh_installdebconf -i
152 dh_installexamples -i
153 dh_installmenu -i
154 dh_installinit -i
155 dh_installinfo -i
156 dh_installchangelogs -i
157 dh_strip -i
158 dh_link -i
159 dh_compress -i
160 dh_fixperms -i
161 debian/courier_perms -i
162 dh_installdeb -i
163 dh_perl -i
164 dh_shlibdeps -i
165 dh_gencontrol -i
166 dh_md5sums -i
167 dh_builddeb -i
168
169# Build architecture-dependent files here.
170binary-arch: stamp-build stamp-install
171 dh_testdir
172 dh_testroot
173# dh_installdebconf -a
174 dh_installexamples -a
175 dh_installmenu -a
176 dh_installinit -a
177 dh_installcron -a
178 dh_installinfo -a
179 dh_installchangelogs -a
180 dh_strip -a
181 dh_link -a
182 dh_compress -a
183 dh_fixperms -a
184 debian/courier_perms -a
185 dh_installdeb -a
186 dh_perl -a
187 dh_makeshlibs -a
188 dh_shlibdeps -a
189 dh_gencontrol -- -VRELUP="$(RELUP)"
190 dh_md5sums -a
191 dh_builddeb -a
192
193binary: binary-arch
194
195.PHONY: check build clean binary-arch binary install