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