#!/usr/bin/make -f export DH_VERBOSE=1 # The magic debhelper rule %: dh $@ --with=fortran_mod DESTDIR:=`pwd`/debian/tmp/ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) # To enable all, uncomment following line DEB_BUILD_MAINT_OPTIONS:= hardening=+all DEB_CFLAGS_MAINT_APPEND:= -Wall -pedantic -fPIC export DEB_BUILD_MAINT_OPTIONS export DEB_CFLAGS_MAINT_APPEND CPPFLAGS += -DgFortran -I/usr/include/cdTime ARCH:=$(shell dpkg --print-architecture) AS_NEEDED= -Wl,--as-needed # On powerpc, amd64, arm*, don't do fPIE, only relro ifeq ($(ARCH), amd64) export LDFLAGS= -Wl,-z,relro -Wl,-z,now endif ifeq ($(ARCH), armel) export LDFLAGS= -Wl,-z,relro -Wl,-z,now export AS_NEEDED= export CFLAGS= -g -O2 -Wall endif ifeq ($(ARCH), armhf) export LDFLAGS= -Wl,-z,relro -Wl,-z,now endif ifeq ($(ARCH),powerpc) export LDFLAGS= -Wl,-z,relro -Wl,-z,now export AS_NEEDED= export CFLAGS= -g -O2 -Wall endif ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),) WITH_HDF5:=--with-hdf5=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial else WITH_HDF5:=--with-hdf5=/usr endif ifeq ($(ARCH),hppa) WITH_OPENMP:=--disable-openmp else WITH_OPENMP:=--enable-openmp endif override_dh_auto_clean: dh_auto_clean || echo "distclean ok" #rm -f cdo.settings src/config.h libtool libcdi/config.log libcdi/config.status src/stamp-h1 confdefs.h rm -f Makefile missing config.status config.log libcdi/tests/libcdi.a rm -f config/compile config/mkinstalldirs config/config.guess config/config.sub rm -f src/config.h.in aclocal.m4 config/depcomp config/install-sh config/missing configure INSTALL rm -f libcdi/INSTALL libcdi/aclocal.m4 m4/libtool.m4 m4/ltoptions.m4 m4/ltversion.m4 rm -f libcdi/m4/libtool.m4 libcdi/m4/ltoptions.m4 libcdi/m4/ltversion.m4 libcdi/configure rm -f libcdi/config/config.guess libcdi/config/config.sub libcdi/config/depcomp libcdi/config/install-sh rm -f libcdi/config/missing libcdi/config/mkinstalldirs find . -name Makefile.in -delete find . -name Makefile -delete find . -type l -delete rm -rf src/.deps override_dh_auto_configure: ln -sf /usr/include/cfortran.h libcdi/src/cfortran.h ./configure --prefix=/usr --libdir=$(LIBDIR) \ --enable-cdi-lib --with-zlib=/usr --with-netcdf=/usr --with-proj=/usr \ $(WITH_OPENMP) $(WITH_HDF5) \ --enable-iso-c-interface --with-fftw3 --with-curl=/usr --with-udunits2=/usr \ --with-szlib \ --enable-hirlam-extensions \ --with-libxml2=usr/ \ --with-eccodes=/usr --disable-cgribex --with-magics=/usr FC=gfortran \ LIBS="-lm -ljpeg -lz -lcurl" \ LDFLAGS="$(LDFLAGS) $(AS_NEEDED)" # LIBS="-Wl,-Bstatic -lm -ljpeg -lz -Wl,-Bdynamic -lcurl" override_dh_auto_build: dh_auto_build (cd contrib && ruby makecompl.rb ) override_dh_auto_install: dh_auto_install for d in debian/tmp/$(LIBDIR)/pkgconfig/cdi.pc debian/tmp/$(LIBDIR)/pkgconfig/cdi_f2003.pc ; do \ sed -e 's%${CURDIR}%/build/cdo%g' < $$d > debian/tmp/x ; \ mv debian/tmp/x $$d ; \ done dh_link -p libcdi0 $(LIBDIR)/libcdi.so.0.0.0 $(LIBDIR)/libcdi.so.0 dh_link -p libcdi-dev $(LIBDIR)/libcdi.so.0.0.0 $(LIBDIR)/libcdi.so mkdir -p $(DESTDIR)/etc/bash_completion.d $(DESTDIR)//usr/share/zsh/functions/Completion/Linux cp contrib/cdoCompletion.bash $(DESTDIR)/etc/bash_completion.d/cdo cp contrib/cdoCompletion.zsh $(DESTDIR)//usr/share/zsh/functions/Completion/Linux/_cdo override_dh_auto_test: # Need to define path to 'cdo' for python tests ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) export PATH=$(PATH):$(CURDIR)/src make check endif