| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
export DH_VERBOSE=1 |
| 5 |
export FC_DEFAULT=gfortran |
| 6 |
export DH_NO_ORIG_LIBS=1 |
| 7 |
|
| 8 |
BUILDDIR:=debian/build |
| 9 |
|
| 10 |
|
| 11 |
%: |
| 12 |
dh $@ --builddirectory=$(BUILDDIR) --with fortran |
| 13 |
|
| 14 |
DESTDIR=$(CURDIR)/debian/tmp/ |
| 15 |
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 16 |
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) |
| 17 |
|
| 18 |
|
| 19 |
DEB_BUILD_MAINT_OPTIONS:= hardening=+all |
| 20 |
DEB_CFLAGS_MAINT_APPEND:= -Wall -pedantic -fPIC |
| 21 |
export DEB_BUILD_MAINT_OPTIONS |
| 22 |
export DEB_CFLAGS_MAINT_APPEND DEB_CFLAGS_MAINT_APPEND |
| 23 |
|
| 24 |
|
| 25 |
CPPFLAGS += -DgFortran |
| 26 |
|
| 27 |
CPPFLAGS += -I/usr/include/cdTime |
| 28 |
|
| 29 |
ARCH:=$(shell dpkg --print-architecture) |
| 30 |
|
| 31 |
|
| 32 |
ifeq ($(ARCH), amd64) |
| 33 |
export LDFLAGS= -Wl,-z,relro -Wl,-z,now |
| 34 |
endif |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
BUILD_FLAGS = \ |
| 40 |
--prefix=/usr --libdir=$(LIBDIR) \ |
| 41 |
$(WITH_OPENMP) \ |
| 42 |
--with-hdf5=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial \ |
| 43 |
--with-zlib=/usr \ |
| 44 |
--with-netcdf=/usr \ |
| 45 |
--with-proj=/usr \ |
| 46 |
--with-fftw3 \ |
| 47 |
--with-curl=/usr \ |
| 48 |
--with-udunits2=/usr \ |
| 49 |
--with-szlib \ |
| 50 |
--with-libxml2=/usr \ |
| 51 |
--with-eccodes=/usr \ |
| 52 |
--with-magics=/usr \ |
| 53 |
--enable-iso-c-interface \ |
| 54 |
--with-cmor=/usr \ |
| 55 |
--enable-cdi-lib \ |
| 56 |
--enable-hirlam-extensions \ |
| 57 |
--disable-cgribex |
| 58 |
|
| 59 |
override_dh_auto_clean: |
| 60 |
dh_auto_clean || echo "distclean ok" |
| 61 |
rm -rf $(BUILDDIR) |
| 62 |
if test -f libcdi/src/cfortran.h.orig ; then ( rm libcdi/src/cfortran.h; mv libcdi/src/cfortran.h.orig libcdi/src/cfortran.h); fi |
| 63 |
|
| 64 |
override_dh_auto_configure: |
| 65 |
[ -f libcdi/src/cfortran.h.orig ]|| ( cp libcdi/src/cfortran.h libcdi/src/cfortran.h.orig) |
| 66 |
ln -sf /usr/include/cfortran.h libcdi/src/cfortran.h |
| 67 |
for f in $(FC_DEFAULT) ; do \ |
| 68 |
dh_auto_configure --builddirectory=$(BUILDDIR) -- \ |
| 69 |
FC=$$f $(BUILD_FLAGS) \ |
| 70 |
LIBS="-lgfortran -ljson-c -lm -ljpeg -lz -lcurl" LDFLAGS="$(LDFLAGS) -Wl,--as-needed" ; \ |
| 71 |
done |
| 72 |
|
| 73 |
override_dh_auto_build: |
| 74 |
dh_auto_build --builddirectory=$(BUILDDIR) |
| 75 |
|
| 76 |
- (cd contrib && LC_ALL=C.UTF-8 ruby makecompl.rb ) |
| 77 |
|
| 78 |
override_dh_auto_install: |
| 79 |
dh_auto_install |
| 80 |
for d in debian/tmp/$(LIBDIR)/pkgconfig/cdi.pc $(BUILDDIR)/libcdi/src/pkgconfig/cdi_f2003.pc ; do \ |
| 81 |
sed -e 's%${CURDIR}%/build/cdo%g' < $$d > debian/tmp/x ; \ |
| 82 |
mv debian/tmp/x $$d ; \ |
| 83 |
done |
| 84 |
mkdir -p $(DESTDIR)/usr/share/bash-completions/completions $(DESTDIR)//usr/share/zsh/functions/Completion/Linux |
| 85 |
cp contrib/cdoCompletion.bash $(DESTDIR)/usr/share/bash-completions/completions/cdo |
| 86 |
cp contrib/cdoCompletion.zsh $(DESTDIR)//usr/share/zsh/functions/Completion/Linux/_cdo |
| 87 |
find $(DESTDIR) -name '*.la' -delete -o -name '*.so' -delete -o -name '*.so.0' -delete |
| 88 |
|
| 89 |
|
| 90 |
override_dh_auto_test: |
| 91 |
|
| 92 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 93 |
export PATH=$(PATH):$(CURDIR)/src make check |
| 94 |
endif |