3 # Copyright 2004,2005,2008 by Stefan Hornburg (Racke) <racke@linuxia.de>
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.
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.
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,
20 BUILD
=$(shell pwd
)/debian
/tmp
21 RELUP
=$(shell dpkg-parsechangelog | perl
-ne
'print $$1 if /^Version: (.*?)-(.*)$$/')
23 # Uncomment this to turn on verbose mode.
26 # This has to be exported to make some magic below work.
29 # Common configuration options
30 NONSSL_CONFOPTS
=--without-certdb
--without-authpgsql
32 CFLAGS
= `dpkg-buildflags --get CFLAGS`
33 LDFLAGS
= `dpkg-buildflags --get LDFLAGS`
35 CPPFLAGS
= `dpkg-buildflags --get CPPFLAGS`
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 \
53 --with-mysql-includes
=/usr
/include/mysql \
54 --with-mysql-libs
=/usr
/lib \
55 --with-authmysqlrc
=/etc
/courier
/authmysqlrc \
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 \
63 --with-authldaprc
=/etc
/courier
/authldaprc \
67 --with-htmllibdir
=/usr
/share
/sqwebmail \
68 --with-ispell
=/usr
/bin
/ispell \
75 chmod
+x debian
/courier_perms
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
; \
85 .
/configure
$(COMMON_CONFOPTS
) \
86 --with-postgresql-includes
=/usr
/include/postgresql \
87 && $(MAKE
) && touch stamp-build
; \
95 rm -f stamp-build stamp-install
97 # Add here commands to clean up after the build process.
98 [ ! -f Makefile
] ||
$(MAKE
) distclean
101 install: check stamp-build
106 # Add here commands to install the package into debian/tmp.
107 $(MAKE
) DESTDIR
=$(BUILD
) install
109 sed
-i
"/dependency_libs/ s/'.*'/''/" `find $(BUILD) -name '*.la'`
111 # (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
113 # Install authentification test program
114 # mv $(BUILD)/usr/sbin/authtest $(BUILD)/usr/sbin/courierauthtest
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
120 # Symlinks for userdb manpages
121 (cd
$(BUILD
)/usr
/share
/man
/man8
&& ln
-s makeuserdb
.8.gz pw2userdb
.8.gz
)
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
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; \
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
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
152 stamp-install
: install
154 # Build architecture-independent files here.
155 binary-indep
: stamp-build stamp-install
158 # dh_installdebconf -i
159 dh_installexamples
-i
163 dh_installchangelogs
-i
168 debian
/courier_perms
-i
176 calibdir
= debian
/courier-authlib
/usr
/lib
/courier-authlib
178 # Build architecture-dependent files here.
179 binary-arch
: stamp-build stamp-install
182 # dh_installdebconf -a
183 dh_installexamples
-a
188 dh_installchangelogs
-a
193 debian
/courier_perms
-a
195 dh_makeshlibs
-pcourier-authlib
-- -Pdebian
/courier-authlib
-e
$(calibdir
)/libcourier
*.so
196 dh_shlibdeps
-a
-l
$(calibdir
)
198 dh_gencontrol
-- -VRELUP
="$(RELUP)"
204 .PHONY
: check build
clean binary-arch binary
install