chiark / gitweb /
miscellaneous debianization fixes
[disorder] / debian / autorules.m4
index 37d1004b4b51f1a65863cc56ce81f69fbaea2951..6b98a5c3fc92364201a5c2911a8d68555d8c34f2 100644 (file)
@@ -1,6 +1,6 @@
 #! /usr/bin/make -f
 #
-# Copyright (C) 2004, 2005, 2006 Richard Kettlewell
+# Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell
 #
 # 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
 INSTALL=install
 CONFIGURE=--prefix=/usr
 
+INSTALL_DATA=$(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
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS=-O0 -g
+else
+CFLAGS=-O2 -g
+endif
+export CFLAGS
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+INSTALL_PROGRAM += -s
+endif
+export INSTALL_DATA
+export INSTALL_SCRIPT
+export INSTALL_PROGRAM
+
 m4_divert(-1)m4_dnl
 
 m4_changequote([,])
@@ -30,7 +47,9 @@ m4_changequote([,])
 m4_define([build], [.PHONY: [build]
 [build]:
 m4_syscmd([test -f ../configure || test -f ../config.status])m4_dnl
-m4_ifelse(m4_sysval,0,[        ./configure ${CONFIGURE} ${CONFIGURE_EXTRA}
+m4_ifelse(m4_sysval,0,[        if test -f config.status; then \
+         ./config.status; else\
+         ./configure ${CONFIGURE} ${CONFIGURE_EXTRA}; fi
 ])m4_dnl
        $(MAKE) prefix=/usr])m4_dnl
 
@@ -56,6 +75,12 @@ pkg-$1: [build]
        cp debian/changelog \
                debian/$1/usr/share/doc/$1/changelog.Debian
        gzip -9 debian/$1/usr/share/doc/$1/changelog.Debian
+       @for f in preinst postinst prerm postrm conffiles templates config; do\
+         if test -e debian/$$f.$1; then\
+           echo cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \
+           cp debian/$$f.$1 debian/$1/DEBIAN/$$f; \
+         fi;\
+       done
 $2     dpkg-gencontrol -isp -p$1 -Pdebian/$1 -Tdebian/substvars.$1
        chown -R root:root debian/$1
        chmod -R g-ws debian/$1