chiark / gitweb /
finalise 2.1.2
[authbind.git] / debian / rules
index b6fc00bed694f05a14839865463f34ed4f20d871..b4f4dc5f367397359ebfcd279106f9e4d2003515 100755 (executable)
 #! /usr/bin/make -f
-#   -*- mode: makefile; -*-
 #
-# Modified by Ian Jackson for authbind.
-# Then last updated: Sat Dec 17 10:52:20 EST 1994 by imurdock.
+# debian/rules for authbind
+# 
+# authbind is Copyright (C) 1998 Ian Jackson
 #
-# To make the binary distribution package, the ``Debianized'' source package
-# and the context diff to the original package, type `./debian.rules dist'.
-# Make sure that `debian.rules' is executable before the final distribution
-# is made.
+# 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, or (at your option)
+# any later version.
 #
-# Invoke each target with `./debian.rules <target>'.  All targets should be
-# invoked with the package root as the current directory.
+# 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.
 #
-# The `binary' target must be run as root, as it needs to install files with
-# specific ownerships.  The `diff' target assumes that you have the original
-# source package available, unpacked, in ../$(p)-$(v).orig, or that you have
-# the previous revision of the ``Debianized'' source package and context diff
-# in the parent directory.
+# 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. 
+#
+# $Id$
 
-CC = gcc
+SHELL=/bin/bash
 
 package=authbind
-major=0
-minor=1
+major=1
+minor=0
 
 arch = $(shell dpkg --print-architecture)
 
+TOOL_PREFIX = $(shell set -x; a=`dpkg-architecture -q DEB_HOST_GNU_TYPE`; echo $$a$${a+-})
+ifeq ($(origin CC),default)
+CC=$(TOOL_PREFIX)gcc
+endif
+
+export SOURCE_DATE_EPOCH = $(shell date -d "$$(dpkg-parsechangelog --count 1 -SDate)" +%s)
+
+INSTALL = install
+INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
+INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
+INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
+INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
+
+CFLAGS = -O2 -Wall
+LDFLAGS = 
+
+
+CFLAGS += -g
+LDFLAGS += -g 
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+STRIP=$(TOOL_PREFIX)strip
+INSTALL_PROGRAM += -s --strip-program=$(STRIP)
+else
+STRIP=:
+endif
+
+export CFLAGS
+export LDFLAGS
+export INSTALL
+export INSTALL_FILE
+export INSTALL_PROGRAM
+export INSTALL_SCRIPT
+export INSTALL_DIR
+export STRIP
+
+
 build: 
-       $(MAKE)
+       $(MAKE) prefix=/usr CC='$(CC)' LD='$(TOOL_PREFIX)ld'
 
 clean: 
-       rm -rf debian/{files,substvars,tmp} build 
        $(MAKE) distclean
+       rm -rf debian/{files,substvars,tmp} build
+       rm -f debian/*~ debian/#*# debian/core debian/*.bak
 
 binary-indep:   checkroot build
-        $(checkdir)
+       $(checkdir)
 # There are no architecture-independent files to be uploaded
 # generated by this package.  If there were any they would be
 # made here.
 
 lab=libauthbind.so.$(major).$(minor)
+udp=debian/tmp/usr/share/doc/$(package)
 
 binary-arch:   checkroot build
        rm -rf debian/tmp
-       install -d -g root -m 755 -o root debian/tmp/DEBIAN \
-               debian/tmp/usr/{bin,lib/$(package),doc/$(package)} \
-               debian/tmp/etc/authbind/{byport,byname,byuid}
-       install -s -g root -o root -m 755 authbind debian/tmp/usr/bin/.
-       install -s -g root -o root -m 4755 helper debian/tmp/usr/lib/authbind/.
-       install -s -g root -o root -m 755 $(lab) debian/tmp/usr/lib/authbind/.
-       ln -s $(lab) debian/tmp/usr/lib/authbind/libauthbind.so.$(major)
-       strip --strip-unneeded debian/tmp/usr/lib/authbind/$(lab)
-       install -g root -o root -m 644 debian/copyright debian/tmp/usr/doc/$(package)/
-       install -g root -o root -m 644 debian/changelog \
-               debian/tmp/usr/doc/$(package)/changelog.Debian
-       gzip -9 debian/tmp/usr/doc/$(package)/*
-ifneq ($(arch),alpha)
-       install -g root -o root -m 644 debian/shlibs debian/tmp/DEBIAN
-else
-       install -g root -o root -m 644 debian/shlibs.alpha debian/tmp/DEBIAN/shlibs
-endif
+       install -d -g root -m 755 -o root debian/tmp/DEBIAN $(udp) \
+               debian/tmp/usr/{bin,lib/$(package),share/man}
+       $(MAKE) prefix=debian/tmp/usr etc_dir=debian/tmp/etc/authbind \
+               man_dir=debian/tmp/usr/share/man  install install_man
+       $(INSTALL_FILE) debian/changelog $(udp)/changelog
+       gzip -9n debian/tmp/usr/share/man/man*/* $(udp)/*
+       $(INSTALL_FILE) debian/copyright $(udp)/.
+       $(INSTALL_SCRIPT) debian/{postrm,prerm,postinst} debian/tmp/DEBIAN
        dpkg-shlibdeps ./authbind
-       dpkg-gencontrol
+       dpkg-gencontrol -isp
        chown -R root.root debian/tmp
        chmod -R g-ws debian/tmp
-       #/bin/bash #-c "ls debian/tmp"
-       #bash -c "dpkg --build debian/tmp .."
+       find debian/tmp -newermt "@$$SOURCE_DATE_EPOCH" -print0 | \
+               xargs -0r touch --no-dereference --date="@$$SOURCE_DATE_EPOCH"
        dpkg --build debian/tmp ..
 
 binary:         binary-indep binary-arch