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