Code

rules: Use dpkg-buildflags to get build flags.
[pkg-pfstools.git] / debian / rules
index 760b5c79dff55438170763c6ab343bf6e7a28f1b..3b8f4f0210e8e4b74a4daf7449357bec3ce179f9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 # debian/rules for pfstools
 #
-# Written by Sebastian Harl <sh@tokkee.org>
+# Written by Sebastian Harl <tokkee@debian.org>
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CXXFLAGS = -Wall -g
+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
+CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
+CXXFLAGS += -Wall
 
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CXXFLAGS += -O0
-else
-       CXXFLAGS += -O2
-endif
+MDIR = $(shell octave-config  --print LOCALFCNFILEDIR)
+OCTDIR = $(shell octave-config  --print LOCALOCTFILEDIR)
 
-include /usr/share/octave/debian/defs.make
-include /usr/share/dpatch/dpatch.make
+confflags = --host=$(DEB_HOST_GNU_TYPE) \
+                       --build=$(DEB_BUILD_GNU_TYPE) \
+                       --prefix=/usr \
+                       --mandir=\$${prefix}/share/man \
+                       --with-octave-m-dir=$(MDIR)/pfstools \
+                       --with-octave-oct-dir=$(OCTDIR)/pfstools
+
+# Matlab is not available in Debian.
+confflags += --disable-matlab
 
-config.status: configure $(DPATCH_STAMPFN)
+# These libraries are not available / unusable in Debian.
+confflags += --disable-jpeghdr --disable-gdal
+
+config.status: configure
        dh_testdir
        
        for file in config.guess config.sub; do \
@@ -32,14 +42,12 @@ config.status: configure $(DPATCH_STAMPFN)
                fi \
        done
        
-       CXXFLAGS="$(CXXFLAGS)" ./configure \
-                       --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
-                       --prefix=/usr --mandir=\$${prefix}/share/man \
-                       --with-moc=moc-qt3 \
-                       --with-octave-m-dir=$(MDIR)/pfstools \
-                       --with-octave-oct-dir=$(OCTDIR)/pfstools
+       ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
+               CXXFLAGS="$(CXXFLAGS)"
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 
 build-stamp: config.status
        dh_testdir
@@ -48,10 +56,10 @@ build-stamp: config.status
        
        touch build-stamp
 
-clean: unpatch
+clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp 
+       rm -f build-stamp
        
        [ ! -f Makefile ] || $(MAKE) clean
        [ ! -f Makefile ] || $(MAKE) distclean
@@ -63,20 +71,21 @@ clean: unpatch
                fi \
        done
        
-       dh_clean 
+       dh_clean
 
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k 
+       dh_clean -k
        dh_installdirs
        
        $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
        
-       chmod 644 debian/tmp/usr/share/octave/site/api-v13/m/pfstools/*
+       chmod 644 debian/tmp/$(MDIR)/pfstools/*
        
        # these binaries are not available
        rm debian/tmp/usr/share/man/man1/pfs*jpeghdr.1
+       rm debian/tmp/usr/share/man/man1/pfsingdal.1
 
 binary-indep: build install
        # nothing to do here
@@ -85,10 +94,15 @@ binary-arch: build install
        dh_testdir
        dh_testroot
        dh_installchangelogs ChangeLog
-       dh_installdocs AUTHORS README TODO doc/faq.txt doc/pfs_format_spec.pdf
+       dh_installdocs README TODO doc/faq.txt doc/pfs_format_spec.pdf
+       dh_installdocs -A AUTHORS
        dh_installexamples
-       dh_install --sourcedir=debian/tmp --list-missing
-       dh_installman debian/pfsglview.1
+       dh_install --sourcedir=debian/tmp --fail-missing
+       # these files have been installed twice by dh_install
+       rm -f debian/pfstools/usr/bin/pfs*view debian/pfstools/usr/bin/pfsv \
+               debian/pfstools/usr/share/man/man1/pfsv.1 \
+               debian/pfstools/usr/share/man/man1/pfs*view.1
+       dh_installman
        dh_link
        dh_strip --dbg-package=pfstools-dbg
        # mkoctfile removes any symbol table and relocation information from the
@@ -104,5 +118,5 @@ binary-arch: build install
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+.PHONY: build clean binary-indep binary-arch binary install