Imported Debian patch 0.59.3-1
[hcoop/debian/courier-authlib.git] / debian / rules
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..3a29bc2
--- /dev/null
@@ -0,0 +1,195 @@
+#!/usr/bin/make -f
+#
+# Copyright 2004,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA  02111-1307  USA.
+
+BUILD=$(shell pwd)/debian/tmp
+RELUP=$(shell dpkg-parsechangelog | perl -ne 'print $$1 if /^Version: (.*?)-(.*)$$/')
+
+# Uncomment this to turn on verbose mode. 
+# export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=4
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+# Common configuration options
+NONSSL_CONFOPTS=--without-certdb --without-authpgsql
+
+COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
+               --with-authdaemonvar=/var/run/courier/authdaemon \
+               --sysconfdir=/etc/courier \
+               --with-pkgconfdir=/etc/courier \
+               --libexecdir=\$${prefix}/lib/courier \
+               --datadir=\$${prefix}/lib/courier \
+               --localstatedir=/var/lib/courier \
+               --sbindir=\$${exec_prefix}/sbin \
+               --with-mailuser=daemon \
+               --with-mailgroup=daemon \
+               --without-socks \
+               --with-authpam \
+               --with-authpipe \
+               --without-authpwd \
+               --with-authmysql \
+               --with-mysql-includes=/usr/include/mysql \
+               --with-mysql-libs=/usr/lib \
+               --with-authmysqlrc=/etc/courier/authmysqlrc \
+               --with-authpgsql \
+               --with-pgsql-includes=`pg_config --includedir` \
+               --with-pgsql-libs=/usr/lib \
+               --with-authpgsqlrc=/etc/courier/authpgsqlrc \
+               --without-authshadow \
+               --without-authvchkpw \
+               --with-authdaemonvar=/var/run/courier/authdaemon \
+               --with-authldap \
+               --with-authldaprc=/etc/courier/authldaprc \
+               --with-authcram \
+               --with-db=gdbm \
+               --without-fcgi \
+               --with-htmllibdir=/usr/share/sqwebmail \
+               --with-ispell=/usr/bin/ispell \
+               --enable-userdb \
+               --enable-syslog=1 \
+               --disable-root-check
+
+check:
+       dh_testdir
+
+# check umask
+       if [ `umask` != "0022" ]; then echo "You need to set umask to 022 in order to compile/build courier"; exit 1; fi
+       chmod +x debian/courier_perms
+
+build: check
+# create a list of files that currently exists
+       if [ ! -f stamp-build ]; then \
+               if [ -d /usr/include/postgresql/8.0/libpq_fe.h ]; then \
+                       LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
+                       --with-postgresql-includes=/usr/include/postgresql/8.0 \
+                       && $(MAKE) && touch stamp-build; \
+               else \
+                       LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
+                       --with-postgresql-includes=/usr/include/postgresql \
+                       && $(MAKE) && touch stamp-build; \
+               fi \
+       fi
+
+stamp-build: build
+
+clean: check
+       dh_testroot
+       rm -f stamp-build stamp-install
+
+# Add here commands to clean up after the build process.
+       -$(MAKE) clean
+       dh_clean
+
+install: check stamp-build
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+# Add here commands to install the package into debian/tmp.
+       $(MAKE) DESTDIR=$(BUILD) install 
+
+#      (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
+
+# Install authentification test program
+#      mv $(BUILD)/usr/sbin/authtest $(BUILD)/usr/sbin/courierauthtest
+
+# Additional manpages
+       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
+#      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
+
+# Symlinks for userdb manpages
+       (cd $(BUILD)/usr/share/man/man8 && ln -s makeuserdb.8.gz pw2userdb.8.gz && ln -s makeuserdb.8.gz vchkpw2userdb.8.gz)
+
+       dh_installdocs
+# - change authentification default settings
+       perl -pe 's/^authmodulelist=".*?"/authmodulelist="authpam"/' $(BUILD)/etc/courier/authdaemonrc.dist > $(BUILD)/etc/courier/authdaemonrc
+# - change default LDAP server
+       perl -pe 's/^(LDAP_SERVER\s+)ldap.example.com/$$1localhost/' $(BUILD)/etc/courier/authldaprc.dist > $(BUILD)/etc/courier/authldaprc
+# - change default MySQL server
+       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
+       mv $(BUILD)/etc/courier/authpgsqlrc.dist $(BUILD)/etc/courier/authpgsqlrc
+       rm $(BUILD)/etc/courier/*.dist
+
+# This seems to be necessary for building in fakeroot 
+# environment (otherwise dh_strip fails)
+# set all binaries to 755, by checking if user has x-bit
+# debian/courier_perms will set the right permissions
+       find $(BUILD) -perm -u+x -type f | xargs chmod u+rwx,go+rx
+
+       dh_movefiles
+
+# Check if all files have moved out
+       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
+
+       touch stamp-install
+
+stamp-install: install
+
+# Build architecture-independent files here.
+binary-indep: stamp-build stamp-install
+       dh_testdir
+       dh_testroot
+#      dh_installdebconf -i
+       dh_installexamples -i
+       dh_installmenu -i
+       dh_installinit -i
+       dh_installinfo -i
+       dh_installchangelogs -i
+       dh_strip -i
+       dh_link -i
+       dh_compress -i 
+       dh_fixperms -i
+       debian/courier_perms -i
+       dh_installdeb -i
+       dh_perl -i
+       dh_shlibdeps -i
+       dh_gencontrol -i
+       dh_md5sums -i
+       dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: stamp-build stamp-install
+       dh_testdir
+       dh_testroot
+#      dh_installdebconf -a
+       dh_installexamples -a
+       dh_installmenu -a
+       dh_installinit -a
+       dh_installcron -a
+       dh_installinfo -a
+       dh_installchangelogs -a
+       dh_strip -a
+       dh_link -a
+       dh_compress -a
+       dh_fixperms -a
+       debian/courier_perms -a
+       dh_installdeb -a
+       dh_perl -a
+       dh_makeshlibs -a
+       dh_shlibdeps -a
+       dh_gencontrol -- -VRELUP="$(RELUP)"
+       dh_md5sums -a
+       dh_builddeb -a
+
+binary: binary-arch
+
+.PHONY: check build clean binary-arch binary install