File: rules

package info (click to toggle)
metview 5.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 240,424 kB
  • sloc: cpp: 434,262; ansic: 41,730; xml: 19,945; f90: 12,702; sh: 6,070; python: 3,829; yacc: 1,770; lex: 1,119; perl: 700; makefile: 100
file content (136 lines) | stat: -rwxr-xr-x 4,679 bytes parent folder | download
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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1


DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

# DEB_LDFLAGS_MAINT_PREPEND:= -Wl,-z,defs -Wl,--as-needed
DEB_BUILD_MAINT_OPTIONS:= hardening=+all,-format
DEB_CFLAGS_MAINT_APPEND:= -Wall -pedantic -fPIC
export DEB_BUILD_MAINT_OPTIONS DEB_CFLAGS_MAINT_APPEND DEB_LDFLAGS_MAINT_PREPEND
export QT_SELECT=5
CXXFLAGS:= $(shell dpkg-buildflags --get CXXFLAGS) -std=gnu++14

# Fixes for 32-bit archss
ARCH_32BIT:=   i386 armel armhf mipsel hppa hurd-i386 m68k powerpc sh4 x32
ifneq ($(filter $(ARCH_32BIT),$(DEB_HOST_ARCH)),)
ENABLE_32BIT:= -DENABLE_32_BIT_HOST=On 
endif

# Needed for sbuild. metview creates temp directories during build
export HOME:=/tmp
export METVIEW_LOCALHOST:=127.0.0.1
export METVIEW_DEBUG:=1

# Test suite requires 4 processors. Fake it
export OMPI_MCA_rmaps_base_oversubscribe=1

# Code should import these from eccodes-import but doesn't
export ECCODES_SAMPLES_PATH=/usr/share/eccodes/samples
export ECCODES_DEFINITION_PATH=/usr/share/eccodes/definitions
export ECCODES_IFS_SAMPLES_PATH=/usr/share/eccodes/ifs_samples

DESTDIR:=$(CURDIR)/debian/tmp/
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
TARGET_ARCH ?= $(shell dpkg-architecture -qDEB_TARGET_ARCH_CPU)
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
MV_DIR:=/usr/lib/$(DEB_HOST_MULTIARCH)/metview
export METVIEW_DIR_DEV:=$(CURDIR)/debian/build
export METVIEW_BIN:=$(METVIEW_DIR_DEV)/bin


# Hack until complter  uses this directory
FC:=$(shell basename $(shell readlink -f /usr/bin/f95))
FMODDIR:=$(LIBDIR)/fortran/$(FC)
FCFLAGS:=$(shell dpkg-buildflags --get FCFLAGS) -I $(FMODDIR)

LC_ALL=C
TZ=UTC+0
export LC_ALL TZ

FPIC:= ''
ifeq ($(TARGET_ARCH), i386)
	FPIC:= -fPIC
endif

# magic debhelper rule
%:
	dh $@ --buildsystem=ecbuild --builddirectory=$(METVIEW_DIR_DEV) 

#override_dh_auto_clean:
#	dh_auto_clean
#	rm -f metview/src/images/metview.png

# magics++ upstream ships with a copy of terralib, which is not used in Debian. 
# Instead we use # a shared terralib library, and so need to include terralib.
# Also -fPIC, for some reason.

override_dh_auto_configure:
	dh_auto_configure -- \
		-DENABLE_EXPOSE_SUBPACKAGES=On \
		-DODB_PATH=/usr \
		-DENABLE_MIR_TOOLS=On \
		-DENABLE_PPROC_MIR=On \
		-DENABLE_URL_DOWNLOAD=On \
		-DENABLE_MPI=On \
		-DENABLE_PNG=On \
		-DENABLE_MIR_DOWNLOAD_MASKS=Off \
		-DENABLE_SCM_RTTOV=On \
		-DENABLE_EXPERIMENTAL=Off \
		-DENABLE_CODE_WEBHELP=Off \
		-DENABLE_CONTRIB=On \
		-DCMAKE_CXX_STANDARD=14 \
		-DCMAKE_CXX_STANDARD_REQUIRED=On \
		-DMETVIEW_SITE=debian  \
		-DMETVIEW_EXTRA_LIBRARIES='terralib -lemosR64 -leccodes -leckit -leckit_option' \
		-DMETVIEW_EXTRA_INCLUDE_DIRS=/usr/include/terralib/kernel \
		-DMAGICS_HAVE_METVIEW=True \
		-DMAGICS_HAVE_NETCDF=True \
		-DMAGICS_PATH=/usr \
		-DBUILD_SHARED_LIBS=On \
		-DSKIP_INSTALL_RPATHS=On \
		-DENABLE_RPATHS=Off \
		-DENABLE_RELATIVE_RPATHS=Off \
		-DENABLE_ODB=On \
		-Dodb_api_DIR=${LIBDIR}/cmake/odb_api \
		-DFLEXTRA_PATH=/usr/bin/flextra \
		-DDISABLE_OS_CHECK=On \
		-DCMAKE_Fortran_FLAGS=$(FCFLAGS) \
		-DFPIC=${FPIC} \
		-DCMAKE_Fortran_FLAGS='$(FCFLAGS)'  \
		$(ENABLE_32BIT)

	( cd ${METVIEW_DIR_DEV}/share ; tar axpf $(CURDIR)/../metview_$(DEB_VERSION_UPSTREAM).orig-data.tar.xz )
	# These get generated ok on a machine with network connection, but fail on sbuilds, etc.
	# so copy pre-generated versions stored in etc
	mkdir -p debian/build/share/metview/etc/
	cp debian/etc/* debian/build/share/metview/etc/
	# cd debian/build/share/metview/etc && $(MAKE) ObjectListAllTarget
	cp metview/src/images/metview_logo.png metview/src/images/metview.png

override_dh_auto_test:
	echo IGNORING TESTS FOR THE MOMENT
	# ( LD_LIBRARY_PATH=$(CURDIR)/debian/build/lib dh_auto_test  )

override_dh_fixperms-arch:
	dh_fixperms
	rm -f debian/metview/usr/lib/*/metvidew/metview_post_install_tests.sh
	# chmod 755 debian/metview/$(MV_DIR)/mv_compress
	mv debian/metview/$(MV_DIR)/metview_bin/* debian/metview/$(MV_DIR)
	rmdir debian/metview/$(MV_DIR)/metview_bin
	chmod 644 debian/metview/$(MV_DIR)/metview_*.common
	chmod 644 debian/metview/$(MV_DIR)/metview_stat
	chmod 644 debian/metview/$(MV_DIR)/metview_patches
	chmod 644 debian/metview/usr/share/images/metview/*
	file debian/metview/$(MV_DIR)/* | grep ELF | cut -f1 -d: | xargs chrpath -d
	chrpath -d debian/libmetview0d/usr/lib/*/lib*so.*

override_dh_fixperms-indep:
	dh_fixperms
	rm -rf debian/metview-data/usr/share/applications
	find debian/metview-data/usr/share/metview -type f -exec chmod 644 {} \;
	find debian/metview-data/usr/share/metview -type d -exec chmod 755 {} \;