Merge from debian.
[hcoop/debian/courier-authlib.git] / debian / rules
CommitLineData
426e7833 1#!/usr/bin/make -f
2#
0fde1ce3 3# Copyright 2004,2005,2008 by Stefan Hornburg (Racke) <racke@linuxia.de>
426e7833 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
426e7833 26# This has to be exported to make some magic below work.
27export DH_OPTIONS
28
29# Common configuration options
30NONSSL_CONFOPTS=--without-certdb --without-authpgsql
31
32COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
33 --with-authdaemonvar=/var/run/courier/authdaemon \
34 --sysconfdir=/etc/courier \
35 --with-pkgconfdir=/etc/courier \
36 --libexecdir=\$${prefix}/lib/courier \
37 --datadir=\$${prefix}/lib/courier \
38 --localstatedir=/var/lib/courier \
39 --sbindir=\$${exec_prefix}/sbin \
40 --with-mailuser=daemon \
41 --with-mailgroup=daemon \
42 --without-socks \
43 --with-authpam \
44 --with-authpipe \
45 --without-authpwd \
46 --with-authmysql \
47 --with-mysql-includes=/usr/include/mysql \
48 --with-mysql-libs=/usr/lib \
49 --with-authmysqlrc=/etc/courier/authmysqlrc \
50 --with-authpgsql \
51 --with-pgsql-includes=`pg_config --includedir` \
52 --with-pgsql-libs=/usr/lib \
53 --with-authpgsqlrc=/etc/courier/authpgsqlrc \
54 --without-authshadow \
426e7833 55 --with-authdaemonvar=/var/run/courier/authdaemon \
56 --with-authldap \
57 --with-authldaprc=/etc/courier/authldaprc \
58 --with-authcram \
59 --with-db=gdbm \
60 --without-fcgi \
61 --with-htmllibdir=/usr/share/sqwebmail \
62 --with-ispell=/usr/bin/ispell \
63 --enable-userdb \
64 --enable-syslog=1 \
65 --disable-root-check
66
67check:
68 dh_testdir
69
70# check umask
71 if [ `umask` != "0022" ]; then echo "You need to set umask to 022 in order to compile/build courier"; exit 1; fi
72 chmod +x debian/courier_perms
73
74build: check
75# create a list of files that currently exists
76 if [ ! -f stamp-build ]; then \
77 if [ -d /usr/include/postgresql/8.0/libpq_fe.h ]; then \
78 LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
79 --with-postgresql-includes=/usr/include/postgresql/8.0 \
80 && $(MAKE) && touch stamp-build; \
81 else \
82 LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
83 --with-postgresql-includes=/usr/include/postgresql \
84 && $(MAKE) && touch stamp-build; \
85 fi \
86 fi
87
88stamp-build: build
89
90clean: check
91 dh_testroot
92 rm -f stamp-build stamp-install
93
94# Add here commands to clean up after the build process.
0fde1ce3 95 [ ! -f Makefile ] || $(MAKE) clean
426e7833 96 dh_clean
97
98install: check stamp-build
99 dh_testroot
100 dh_clean -k
101 dh_installdirs
102
103# Add here commands to install the package into debian/tmp.
104 $(MAKE) DESTDIR=$(BUILD) install
105
106# (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
107
108# Install authentification test program
109# mv $(BUILD)/usr/sbin/authtest $(BUILD)/usr/sbin/courierauthtest
110
111# Additional manpages
112 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
113# 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
114
115# Symlinks for userdb manpages
0fde1ce3 116 (cd $(BUILD)/usr/share/man/man8 && ln -s makeuserdb.8.gz pw2userdb.8.gz)
426e7833 117
118 dh_installdocs
119# - change authentification default settings
120 perl -pe 's/^authmodulelist=".*?"/authmodulelist="authpam"/' $(BUILD)/etc/courier/authdaemonrc.dist > $(BUILD)/etc/courier/authdaemonrc
121# - change default LDAP server
122 perl -pe 's/^(LDAP_SERVER\s+)ldap.example.com/$$1localhost/' $(BUILD)/etc/courier/authldaprc.dist > $(BUILD)/etc/courier/authldaprc
123# - change default MySQL server
124 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
125 mv $(BUILD)/etc/courier/authpgsqlrc.dist $(BUILD)/etc/courier/authpgsqlrc
126 rm $(BUILD)/etc/courier/*.dist
127
128# This seems to be necessary for building in fakeroot
129# environment (otherwise dh_strip fails)
130# set all binaries to 755, by checking if user has x-bit
131# debian/courier_perms will set the right permissions
132 find $(BUILD) -perm -u+x -type f | xargs chmod u+rwx,go+rx
133
134 dh_movefiles
135
136# Check if all files have moved out
137 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
138
139 touch stamp-install
140
141stamp-install: install
142
143# Build architecture-independent files here.
144binary-indep: stamp-build stamp-install
145 dh_testdir
146 dh_testroot
147# dh_installdebconf -i
148 dh_installexamples -i
149 dh_installmenu -i
150 dh_installinit -i
151 dh_installinfo -i
152 dh_installchangelogs -i
153 dh_strip -i
154 dh_link -i
155 dh_compress -i
156 dh_fixperms -i
157 debian/courier_perms -i
158 dh_installdeb -i
159 dh_perl -i
160 dh_shlibdeps -i
161 dh_gencontrol -i
162 dh_md5sums -i
163 dh_builddeb -i
164
165# Build architecture-dependent files here.
166binary-arch: stamp-build stamp-install
167 dh_testdir
168 dh_testroot
169# dh_installdebconf -a
170 dh_installexamples -a
171 dh_installmenu -a
172 dh_installinit -a
173 dh_installcron -a
174 dh_installinfo -a
175 dh_installchangelogs -a
176 dh_strip -a
177 dh_link -a
178 dh_compress -a
179 dh_fixperms -a
180 debian/courier_perms -a
181 dh_installdeb -a
182 dh_perl -a
183 dh_makeshlibs -a
184 dh_shlibdeps -a
185 dh_gencontrol -- -VRELUP="$(RELUP)"
186 dh_md5sums -a
187 dh_builddeb -a
188
189binary: binary-arch
190
191.PHONY: check build clean binary-arch binary install