File: rules

package info (click to toggle)
metview 5.23.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 583,480 kB
  • sloc: cpp: 299,652; ansic: 41,801; xml: 19,933; sh: 5,823; python: 4,655; yacc: 1,731; lex: 1,011; perl: 701; f90: 240; makefile: 87
file content (124 lines) | stat: -rwxr-xr-x 4,460 bytes parent folder | download | duplicates (2)
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
#!/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
DEB_CXXFLAGS_MAINT_APPEND:= -Wall -pedantic -fPIC
export DEB_BUILD_MAINT_OPTIONS DEB_CFLAGS_MAINT_APPEND DEB_LDFLAGS_MAINT_PREPEND
CXXFLAGS:= $(shell dpkg-buildflags --get CXXFLAGS) -std=gnu++17 -I /usr/include/eigen3


# 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)
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
export BUILDDIR=$(METVIEW_DIR_DEV)


# 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)

# For bit reproducibility
LC_ALL=C
TZ=UTC+0
export LC_ALL TZ

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

#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:
	mkdir -p $(BUILDDIR)/share/mir/masks
	( cd $(BUILDDIR)/share/mir/masks ; tar axpf $(CURDIR)/../metview_$(DEB_VERSION_UPSTREAM).orig-data.tar.xz )
	dh_auto_configure -- \
		-DENABLE_EXPOSE_SUBPACKAGES=On \
		-DENABLE_BUILD_TOOLS=On \
		-DENABLE_PPROC_MIR=On \
		-DENABLE_URL_DOWNLOAD=On \
		-DENABLE_MPI=On \
		-DENABLE_ODB=On \
		-DENABLE_FDB5=On \
		-DENABLE_PNG=On \
		-DENABLE_RPC=On \
		-DRPC_PATH=${LIBDIR} \
		-DENABLE_MIR_DOWNLOAD_MASKS=On \
		-DENABLE_EXPERIMENTAL=Off \
		-DENABLE_CODE_WEBHELP=Off \
		-DENABLE_CONTRIB=On \
		-DCMAKE_CXX_STANDARD=17 \
		-DCMAKE_CXX_STANDARD_REQUIRED=On \
		-DMETVIEW_SITE=debian  \
		-DMETVIEW_EXTRA_LIBRARIES='terralib -leccodes -leckit -leckit_option' \
		-DMETVIEW_EXTRA_INCLUDE_DIRS=/usr/include/terralib/kernel \
		-DMAGICS_PATH=/usr \
		-DBUILD_SHARED_LIBS=On \
		-DENABLE_RPATHS=Off \
		-DENABLE_RELATIVE_RPATHS=Off \
		-DFLEXTRA_PATH=/usr/bin/flextra \
		-DDISABLE_OS_CHECK=On \
		-DCMAKE_Fortran_FLAGS='$(FCFLAGS)'  

	( 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:
	# Don't fail on tests in this build
	@echo "Ignoring test failures this build"
	# -( 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/lib/*/metview/*.mv
	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 {} \;