Overhaul debian/rules
authorFerenc Wagner <wferi@niif.hu>
Mon, 16 Jun 2008 10:16:59 +0000 (12:16 +0200)
committerFerenc Wagner <wferi@niif.hu>
Mon, 16 Jun 2008 10:16:59 +0000 (12:16 +0200)
Remove the normal CFLAGS setting and instead pass --enable-debug to
configure.  dh_strip will remove the debugging symbols if appropriate.

Use the right Autoconf logic to handle cross-builds.

Use stamp files for configure and install and better logic for
optionally running make clean.

Always copy config.guess and config.sub before running configure and
delete them in the clean target.

Remove unnecessary debhelper programs.

debian/rules

index 6fbcb84..a662f2a 100755 (executable)
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
+    DEBUG = --enable-debug
 else
-       CFLAGS += -O2
+    DEBUG =
 endif
 
-config.status: configure
-       dh_testdir
-       # Add here commands to configure the package.
-       ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr CFLAGS="$(CFLAGS)" --disable-dependency-tracking
+# Tell Autoconf the correct system types.
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+    SYSTEM = --build $(DEB_HOST_GNU_TYPE)
+else
+    SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+endif
 
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       cp /usr/share/misc/config.guess config.guess
+       cp /usr/share/misc/config.sub config.sub
+       CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
+           --disable-dependency-tracking $(SYSTEM) $(DEBUG)
+       touch $@
 
-#Architecture 
 build: build-arch build-indep
-
 build-arch: build-stamp
-
-build-indep: build-stamp
-
-build-stamp: config.status
+build-indep:
+build-stamp: configure-stamp
+       dh_testdir
        $(MAKE)
        touch $@
 
 clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp #CONFIGURE-STAMP#
-
-       # Add here commands to clean up after the build process.
-       -$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-       cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-       cp -f /usr/share/misc/config.guess config.guess
-endif
-
+       rm -f configure-stamp build-stamp install-stamp
+       [ ! -f Makefile ] || $(MAKE) distclean
+       dh_clean config.guess config.sub
 
-       dh_clean 
-
-install:
+install: install-stamp
+install-stamp:
        dh_testdir
        dh_testroot
-       dh_clean -k -i -s
-       dh_installdirs -i -s
-
-       # Add here commands to install the the package into debian/tmp.
+       dh_clean -k
        $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
        rm $(CURDIR)/debian/tmp/usr/share/doc/opensaml/{LOG4CPP.LICENSE,{LICENSE,NOTICE}.txt}
+       dh_install -s -i --fail-missing --sourcedir=debian/tmp
+       touch $@
 
-       dh_install -i -s --fail-missing --sourcedir=debian/tmp
-
-# Must not depend on anything. This is to be called by
-# binary-arch/binary-indep
-# in another 'make' thread.
-binary-common:
+binary: binary-arch binary-indep
+binary-arch: DH_OPTIONS=-a
+binary-arch: install-stamp
        dh_testdir
        dh_testroot
-       dh_installchangelogs 
+       dh_installchangelogs
        dh_installdocs
-       dh_installexamples
-#      dh_installmenu
-#      dh_installdebconf       
-#      dh_installlogrotate     
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
-#      dh_python
-#      dh_installinit
-#      dh_installcron
-#      dh_installinfo
-       dh_installman
        dh_link
        dh_strip
-       dh_compress 
+       dh_compress
        dh_fixperms
-#      dh_perl
        dh_makeshlibs
        dh_installdeb
        dh_shlibdeps
        dh_gencontrol
        dh_md5sums
        dh_builddeb
-# Build architecture independant packages using the common target.
-binary-indep: build-indep install
-       $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
 
-# Build architecture dependant packages using the common target.
-binary-arch: build-arch install
-       $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
+binary-indep: DH_OPTIONS=-i
+binary-indep: install-stamp
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_link
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
 
-binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install
+.PHONY: binary binary-arch binary-indep build build-arch build-indep clean
+.PHONY: install