Imported Debian patch 0.63.0-6
[hcoop/debian/courier-authlib.git] / debian / rules
index 3a29bc2..e14ab47 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 #
-# Copyright 2004,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
+# Copyright 2004,2005,2008 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
@@ -23,17 +23,20 @@ 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
 
+CFLAGS = `dpkg-buildflags --get CFLAGS`
+LDFLAGS = `dpkg-buildflags --get LDFLAGS`
+LDFLAGS += -lcrypt
+CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
+
 COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
                --with-authdaemonvar=/var/run/courier/authdaemon \
+               CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
                --sysconfdir=/etc/courier \
                --with-pkgconfdir=/etc/courier \
                --libexecdir=\$${prefix}/lib/courier \
@@ -55,7 +58,6 @@ COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
                --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 \
@@ -70,20 +72,17 @@ COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
 
 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) \
+                       ./configure $(COMMON_CONFOPTS) \
                        --with-postgresql-includes=/usr/include/postgresql/8.0 \
                        && $(MAKE) && touch stamp-build; \
                else \
-                       LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
+                       ./configure $(COMMON_CONFOPTS) \
                        --with-postgresql-includes=/usr/include/postgresql \
                        && $(MAKE) && touch stamp-build; \
                fi \
@@ -96,7 +95,7 @@ clean: check
        rm -f stamp-build stamp-install
 
 # Add here commands to clean up after the build process.
-       -$(MAKE) clean
+       [ ! -f Makefile ] || $(MAKE) distclean
        dh_clean
 
 install: check stamp-build
@@ -105,7 +104,9 @@ install: check stamp-build
        dh_installdirs
 
 # Add here commands to install the package into debian/tmp.
-       $(MAKE) DESTDIR=$(BUILD) install 
+       $(MAKE) DESTDIR=$(BUILD) install
+       
+       sed -i "/dependency_libs/ s/'.*'/''/" `find $(BUILD) -name '*.la'`
 
 #      (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
 
@@ -117,7 +118,7 @@ install: check stamp-build
 #      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)
+       (cd $(BUILD)/usr/share/man/man8 && ln -s makeuserdb.8.gz pw2userdb.8.gz)
 
        dh_installdocs
 # - change authentification default settings
@@ -129,6 +130,12 @@ install: check stamp-build
        mv $(BUILD)/etc/courier/authpgsqlrc.dist $(BUILD)/etc/courier/authpgsqlrc
        rm $(BUILD)/etc/courier/*.dist
 
+# Lintian overrides
+       mkdir -p $(BUILD)/usr/share/lintian/overrides
+       for package in courier-authdaemon courier-authlib-ldap courier-authlib-mysql courier-authlib-postgresql; do \
+               cp debian/$$package.lintian $(BUILD)/usr/share/lintian/overrides/$$package; \
+       done
+
 # 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
@@ -166,6 +173,8 @@ binary-indep: stamp-build stamp-install
        dh_md5sums -i
        dh_builddeb -i
 
+calibdir = debian/courier-authlib/usr/lib/courier-authlib
+
 # Build architecture-dependent files here.
 binary-arch: stamp-build stamp-install
        dh_testdir
@@ -182,10 +191,10 @@ binary-arch: stamp-build stamp-install
        dh_compress -a
        dh_fixperms -a
        debian/courier_perms -a
-       dh_installdeb -a
        dh_perl -a
-       dh_makeshlibs -a
-       dh_shlibdeps -a
+       dh_makeshlibs -pcourier-authlib -- -Pdebian/courier-authlib -e$(calibdir)/libcourier*.so
+       dh_shlibdeps -a -l$(calibdir)
+       dh_installdeb -a
        dh_gencontrol -- -VRELUP="$(RELUP)"
        dh_md5sums -a
        dh_builddeb -a