1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
#!/usr/bin/make -f
export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS = qa=-bug
export DEB_BUILD_MAINT_STRIP="-Wincompatible-pointer-types -Wint-conversion"
export DPKG_EXPORT_BUILDFLAGS=1
include /usr/share/dpkg/buildflags.mk
# The magic debhelper rule
%:
dh $@
DESTDIR:=$(CURDIR)/debian/tmp/
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
DO_FLANG:=$(if $(wildcard /usr/bin/flang),true, false)
# See #984251. Don't set flags for gfortran-9, only 10+
GF_FLAGS:=$(if $(filter $(shell readlink /usr/bin/gfortran), gfortran-9), , \
-fallow-invalid-boz -fallow-argument-mismatch )
# Disable these flags added for gcc14 on 32-bit platforms. The work to fix properly is too big
# for a legacy app on obsolete hardware
DISABLE_ERROR_FLAGS:= $(if $(filter $(DEB_TARGET_ARCH), armel armhf i386), \
-Wno-error=incompatible-pointer-types -Wno-error=int-conversion -Wno-error=implicit-function-declaration, \
-Wno-error=int-conversion -Wno-error=implicit-function-declaration)
# For the config file. Done this way to pull in stuff from hardening, etc.
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(DISABLE_ERROR_FLAGS)
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
# LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS:=
FFLAGS=$(shell dpkg-buildflags --get FFLAGS) $(GF_FLAGS)
CC ?= cc
# FC set to f77 by default in make
# Read default compiler name unless FC is actually set
ifeq ($(F77),f77)
F77:=$(shell basename $(shell readlink /etc/alternatives/f77))
endif
ifneq ($(filter flang,$(F77)),)
FFLAGS:=$(shell dpkg-buildflags --get FFLAGS | sed -e 's/-g //')
CTOFLIBS:= -lm
endif
ifneq ($(filter gfortran,$(F77)),)
# export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
FFLAGS:=$(FFLAGS) -fno-second-underscore -fno-range-check
CTOFLIBS:= -lgfortran -lm
endif
ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),)
CFLAGS += -I/usr/include/hdf5/serial
export HDF5_LDFLAGS := -Wl,-L/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial
endif
export LD_LIBRARY_PATH=$(CURDIR)/shared:$(LIBDIR)/fortran/$(F77):$(LIBDIR)/libfakeroot
# Force HDF5 1.10 API to support building against HDF5 1.14
export DEB_CPPFLAGS_MAINT_APPEND = -DH5_USE_110_API
# We built it twice: first shared, to get the shared libraries (with -fpic -fPIC)
# then static, for execution speed.
LIBS:= \
libNGcgm.so libNGctrans.so libNGgksPDF.so libNGgksX.so libNGlluC.so libNGmisc2.so libNGncl.so \
libNGcn.so libNGff.so libNGgksPS.so libNGhlu.so libNGllu.so libNGmisc.so libNGnfp.so \
libNGc.so libNGgksCTXT.so libNGgks.so libNGictrans.so libNGmath.so libNGmp.so libNGras.so \
libfftpack5_dp.so libNGnfpfort.so
# Add extra libs to ensure all shared libs link
EXTRA_LIBS:= -lpng -lz -lX11 -lcairo -lsphere-$(F77)
# This done here to avoid subsitution bug on broken ymake buildsystem
INCS="-I/usr/include/freetype2 -I/usr/include/gdal -I/usr/include/hdf-eos5 -I/usr/include/hdf -I/usr/include/${DEB_HOST_MULTIARCH}/hdf -I/usr/include/mpi"
override_dh_auto_configure:
sed -e 's,@LIBDIR@,$(LIBDIR),' \
-e 's/@PREFIX@/\/usr/' \
-e 's/@VERSION@/$(UPSTREAM_VERSION)/' \
< debian/ncarg.pc.in > ncarg.pc
sed -e 's%@CC@%${CC}%' \
-e 's%@FC@%${FC}%' \
-e 's%@LD@%${CC}%' \
-e 's%@CFLAGS@%${CFLAGS}%' \
-e 's%@FFLAGS@%${FFLAGS}%' \
-e 's%@CTOFLIBS@%${CTOFLIBS}%' \
-e 's%@CPPFLAGS@%${CPPFLAGS}%' \
-e 's%@LDFLAGS@%${LDFLAGS}%' \
-e 's%@DESTDIR@%${DESTDIR}%' \
< debian/Site.local.shared.in > config/Site.local.shared
sed -e 's%@CC@%${CC}%' \
-e 's%@FC@%${FC}%' \
-e 's%@LD@%${CC}%' \
-e 's%@CFLAGS@%${CFLAGS}%' \
-e 's%@FFLAGS@%${FFLAGS}%' \
-e 's%@CTOFLIBS@%${CTOFLIBS}%' \
-e 's%@CPPFLAGS@%${CPPFLAGS}%' \
-e 's%@LDFLAGS@%${LDFLAGS}%' \
-e 's%@DESTDIR@%${DESTDIR}%' \
< debian/Site.local.static.in > config/Site.local.static
sed -e 's%@ARCH@%${DEB_HOST_MULTIARCH}%' \
< config/Project > config/Project.post
mv config/Project.post config/Project
override_dh_auto_build:
cp config/Site.local.shared config/Site.local
cp debian/LINUX.DEBIAN.$(F77) config/LINUX
ln -sf LINUX config/DEBIAN
# regenerate lex file; shipped was non-dfsg
( cd ./ncarview/src/lib/libictrans ; flex -o lex.yy_linux.c lex.l )
echo 'n' | ./Configure -v
$(MAKE) Makefiles includes depend
# Static libraries need to be built first
# Add symlink for non-Linux archs
cp config/Site.local.static config/Site.local
echo 'n' | ./Configure -v
$(MAKE) Makefiles includes depend
for d in common external ngmath/src/lib ncarg2d/src/libncarg_gks ncarg2d/src/libncarg ncarg2d/src/liboptional ncarview ni/src/lib ; do \
$(MAKE) -C $$d install INCSEARCH=${INCS} INC_SEARCH=${INCS} ; done
LD_LIBRARY_PATH=$(DESTDIR)/lib:$(LIBDIR)/fortran/$(F77) $(MAKE) install INCSEARCH=${INCS} INC_SEARCH=${INCS}
# Install them safely in $(DESTDIR) as originals will be removed making shared libs
mkdir -p $(DESTDIR)/staticlibs
mv $(DESTDIR)/lib/*.a $(DESTDIR)/staticlibs
$(MAKE) clean
find . -name '*.[o]' -delete
# Shared libraries next, in the right order.
cp config/Site.local.shared config/Site.local
echo 'n' | ./Configure -v
$(MAKE) Makefiles includes depend
for d in common external ngmath/src/lib ncarg2d/src/libncarg_gks ncarg2d/src/libncarg ncarg2d/src/liboptional ncarview ni/src/lib/nfpfort ni/src/lib ; do \
LD_LIBRARY_PATH=$(DESTDIR)/lib:$(LIBDIR)/fortran/$(F77):$(CURDIR)/shared $(MAKE) -C $$d install \
DEV_SYS_LIBS=$(EXTRA_LIBS) INCSEARCH=${INCS} INC_SEARCH=${INCS}; done
# Then build all the rest
LD_LIBRARY_PATH=$(DESTDIR)/lib:$(LIBDIR)/fortran/$(F77):$(CURDIR)/shared $(MAKE) Everything \
DEV_SYS_LIBS=$(EXTRA_LIBS) INCSEARCH=${INCS} INC_SEARCH=${INCS} LD_REL="ld -zmuldefs" LIBSEARCH=-L$(LIBDIR)/hdf5/serial/lib
mv $(DESTDIR)/staticlibs/* $(DESTDIR)/lib
override_dh_auto_install:
dh_auto_install
mkdir -p debian/libncarg-dev/$(LIBDIR)/ncarg
# TODO: These may not be present on mips64el.
mkdir -p debian/libncarg-data/usr/share/ncarg/nug
[ -d $(DESTDIR)/lib/ncarg/fontcaps ] && cp -a $(DESTDIR)/lib/ncarg/fontcaps debian/libncarg-data/usr/share/ncarg || true
[ -d $(DESTDIR)/lib/ncarg/nclex/nug ] && cp -a $(DESTDIR)/lib/ncarg/nclex/nug debian/libncarg-data/usr/share/ncarg/nug || true
cp $(DESTDIR)/lib/*.a debian/libncarg-dev/$(LIBDIR)/ncarg
find debian -name '*.ksh' -exec chmod +x {} \;
# Sanitise paths for bit reproducibility
for f in $(DESTDIR)/usr/bin/ncargcc \
$(DESTDIR)/usr/bin/ncargf77 \
$(DESTDIR)/usr/bin/ncargf90 \
$(DESTDIR)/usr/bin/nhlcc \
$(DESTDIR)/usr/bin/nhlf77 \
$(DESTDIR)/usr/bin/nhlf90 ; do cat $$f | \
sed -e 's%${CURDIR}%/build/ncl-ncarg%g' \
> debian/tmpff ; \
mv debian/tmpff $$f ; \
done
override_dh_auto_clean:
find . -name '*.so.1' -delete
find . -type l -delete
find . -name '*.o' -delete
rm -f ncarg.pc config/Site.local.* config/DEBIAN
ifneq ($(wildcard config/LINUX.ORIG),)
mv config/LINUX.ORIG config/LINUX
endif
ifneq (,$(filter $(DEB_BUILD_ARCH),mipsel alpha))
override_dh_dwz:
@echo bypass dwz that causes build failues
endif
|