File: rules

package info (click to toggle)
netcdf-parallel 1:4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 101,668 kB
  • sloc: ansic: 200,241; sh: 10,807; yacc: 2,522; makefile: 1,306; lex: 1,153; xml: 173; awk: 2
file content (136 lines) | stat: -rwxr-xr-x 6,379 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

# Enable hardening build flags, except:
#  pie: causes build failure
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
INCDIR:=/usr/include

UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
SO_MAJOR:=13
SO_VERSION:=13

PNETCDF_ARCHS:= amd64 arm64 mips64el ppc64el s390x alpha ia64 sparc64 kfreebsd-amd64 ppc64 riscv64

include /usr/share/mpi-default-dev/debian_defaults
MPI:=$(ARCH_DEFAULT_MPI_IMPL)

include /usr/share/dpkg/pkg-info.mk


# Verbose test output
export VERBOSE=1
export DH_VERBOSE=1

CFLAGS:= $(shell dpkg-buildflags --get CFLAGS)

%:
	dh $@ --buildsystem=cmake

CMAKE_FLAGS:=   -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_SKIP_RPATH:BOOL=ON \
		-DENABLE_TESTS:BOOL=ON \
		-DENABLE_DOXYGEN:BOOL=ON \
		-DENABLE_MMAP=ON \
		-DUSE_SZIP=ON 

override_dh_auto_configure:
ifneq ($(filter $(PNETCDF_ARCHS),$(DEB_HOST_ARCH)),)
	dh_auto_configure --builddirectory=build-pnetcdf -- \
		$(CMAKE_FLAGS) \
		-DHDF5_INCLUDE_PATH=$(INCDIR)/hdf5/serial \
		-DHDF5_LIBRARY_PATH=$(LIBDIR)//hdf5/serial \
		-DENABLE_PNETCDF=ON \
		-DPNETCDF_INCLUDE_DIR=/usr/include \
		-DLIBLIB_VERSION_SCRIPT=-Wl,--version-script,$(CURDIR)/debian/netcdf-pnetcdf.ver \
		-DCMAKE_C_COMPILER=mpicc  \
		-DNETCDF_LIB_NAME=netcdf_pnetcdf 
endif
	dh_auto_configure --builddirectory=build-mpi --  \
		$(CMAKE_FLAGS) \
		-DENABLE_PARALLEL_TESTS:BOOL=OFF \
		-DUSE_HDF5=ON \
	        -DHDF5_INCLUDE_PATH=$(INCDIR)/hdf5/$(MPI) \
		-DHDF5_LIBRARY_PATH=$(LIBDIR)/hdf5/$(MPI) \
		-DHDF5_C_LIBRARIES=$(LIBDIR)/hdf5/$(MPI)/libhdf5.so \
		-DHDF5_HL_LIBRARIES=$(LIBDIR)/hdf5/$(MPI)/libhdf5_hl.so \
		-DCMAKE_C_FLAGS="${CFLAGS} -DHDF5_PARALLEL" \
		-DLIBLIB_VERSION_SCRIPT=-Wl,--version-script,$(CURDIR)/debian/netcdf-mpi.ver \
		-DCMAKE_C_COMPILER=mpicc  \
		-DNETCDF_LIB_NAME=netcdf_mpi

override_dh_auto_build:
ifneq ($(filter $(PNETCDF_ARCHS),$(DEB_HOST_ARCH)),)
	$(MAKE) -C build-pnetcdf
endif
	$(MAKE) -C build-mpi

override_dh_auto_clean:
	rm -rf build-* debian/tmp* debian/*.postinst

override_dh_auto_install:
	$(MAKE) -C build-mpi install DESTDIR=$(CURDIR)/debian/tmp-mpi
	mkdir -p debian/tmp/$(LIBDIR)/netcdf/mpi/cmake debian/tmp/$(LIBDIR)/cmake debian/tmp/$(LIBDIR)/pkgconfig
	cp debian/tmp-mpi/$(LIBDIR)/libnetcdf.settings debian/tmp/$(LIBDIR)/netcdf/mpi/libnetcdf.settings
	mkdir -p debian/tmp/$(LIBDIR)/netcdf/mpi/include
	cp debian/tmp-mpi/usr/include/*	debian/tmp/$(LIBDIR)/netcdf/mpi/include
	cp -a debian/tmp-mpi/$(LIBDIR)/cmake/netCDF	debian/tmp/$(LIBDIR)/cmake/netCDF_mpi
	cp -a debian/tmp-mpi/$(LIBDIR)/libnetcdf_*.so* debian/tmp/$(LIBDIR)
	dh_link -p libnetcdf-mpi-dev  $(LIBDIR)/cmake/netCDF_mpi $(LIBDIR)/netcdf/mpi/cmake/netCDF
	cp debian/tmp-mpi/$(LIBDIR)/libnetcdf_mpi.so.$(SO_VERSION) debian/tmp/$(LIBDIR)/libnetcdf_mpi.so.$(SO_VERSION)
	# sed -e 's%@MULTIARCH@%$(DEB_HOST_MULTIARCH)%g' < debian/libnetcdf-mpi-dev.postinst.in \
	# > debian/libnetcdf-mpi-dev.postinst
	echo "prefix=$(LIBDIR)/netcdf/mpi" > debian/tmp/$(LIBDIR)/pkgconfig/netcdf-mpi.pc
	sed -e 's/-lnetcdf/-lnetcdf_mpi/' < debian/tmp-mpi/$(LIBDIR)/pkgconfig/netcdf.pc \
		| grep -v "prefix=" \
		>> debian/tmp/$(LIBDIR)/pkgconfig/netcdf-mpi.pc
	dh_link -p libnetcdf-mpi-dev $(LIBDIR)/libnetcdf_mpi.so.$(SO_VERSION) $(LIBDIR)/netcdf/mpi/libnetcdf.so
	dh_link -p libnetcdf-mpi-dev $(LIBDIR)/libnetcdf_mpi.so.$(SO_VERSION) $(LIBDIR)/libnetcdf_mpi.so
	dh_link -p libnetcdf-mpi-dev $(LIBDIR)/netcdf/mpi  $(LIBDIR)/netcdf/mpi/lib
	dh_link -p libnetcdf-mpi-dev  $(LIBDIR)/pkgconfig/netcdf-mpi.pc $(LIBDIR)/netcdf/mpi/pkgconfig/netcdf.pc

ifneq ($(filter $(PNETCDF_ARCHS),$(DEB_HOST_ARCH)),)
	$(MAKE) -C build-pnetcdf install DESTDIR=$(CURDIR)/debian/tmp-pnetcdf 
	mkdir -p debian/tmp/$(LIBDIR)/netcdf/pnetcdf/cmake debian/tmp/$(LIBDIR)/cmake debian/tmp/$(LIBDIR)/pkgconfig 
	cp debian/tmp-pnetcdf/$(LIBDIR)/libnetcdf.settings debian/tmp/$(LIBDIR)/netcdf/pnetcdf/libnetcdf.settings 
	mkdir -p debian/tmp/$(LIBDIR)/netcdf/pnetcdf/include 
	cp debian/tmp-pnetcdf/usr/include/*	debian/tmp/$(LIBDIR)/netcdf/pnetcdf/include 
	cp -a debian/tmp-pnetcdf/$(LIBDIR)/cmake/netCDF	debian/tmp/$(LIBDIR)/cmake/netCDF_pnetcdf 
	cp -a debian/tmp-pnetcdf/$(LIBDIR)/libnetcdf_*.so* debian/tmp/$(LIBDIR) 
	dh_link -p libnetcdf-pnetcdf-dev  $(LIBDIR)/cmake/netCDF_pnetcdf $(LIBDIR)/netcdf/pnetcdf/cmake/netCDF 
	cp debian/tmp-pnetcdf/$(LIBDIR)/libnetcdf_pnetcdf.so.$(SO_VERSION) debian/tmp/$(LIBDIR)/libnetcdf_pnetcdf.so.$(SO_VERSION) 
	# sed -e 's%@MULTIARCH@%$(DEB_HOST_MULTIARCH)%g' < debian/libnetcdf-pnetcdf-dev.postinst.in \
 	#		> debian/libnetcdf-pnetcdf-dev.postinst 
	echo "prefix=$(LIBDIR)/netcdf/pnetcdf" > debian/tmp/$(LIBDIR)/pkgconfig/netcdf-pnetcdf.pc 
	sed -e 's/-lnetcdf/-lnetcdf_pnetcdf/' < debian/tmp-pnetcdf/$(LIBDIR)/pkgconfig/netcdf.pc \
		| grep -v "prefix=" \
		>> debian/tmp/$(LIBDIR)/pkgconfig/netcdf-pnetcdf.pc 
	dh_link -p libnetcdf-pnetcdf-dev $(LIBDIR)/libnetcdf_pnetcdf.so.$(SO_VERSION) $(LIBDIR)/netcdf/pnetcdf/libnetcdf.so 
	dh_link -p libnetcdf-pnetcdf-dev $(LIBDIR)/libnetcdf_pnetcdf.so.$(SO_VERSION) $(LIBDIR)/libnetcdf_pnetcdf.so
	dh_link -p libnetcdf-pnetcdf-dev $(LIBDIR)/netcdf/pnetcdf  $(LIBDIR)/netcdf/pnetcdf/lib
	dh_link -p libnetcdf-pnetcdf-dev  $(LIBDIR)/pkgconfig/netcdf-pnetcdf.pc $(LIBDIR)/netcdf/pnetcdf/pkgconfig/netcdf.pc
endif
	# Strip RPATH
	-find $(CURDIR)/debian/tmp/usr/bin -type f -not -name nc-config -exec chrpath --delete {} \;
	-find $(CURDIR)/debian/tmp/usr/lib -type f -name "*.so*" -exec chrpath --delete {} \;
	cp include/netcdf_par.h debian/tmp/$(LIBDIR)/netcdf/mpi/include 
	find $(CURDIR)/debian/tmp/usr/lib -type f \( -name "*.settings" -or -name "*.cmake" \) -print0 | \
		xargs -0r sed -i -e 's@ [^ ]*-f\(file\|debug\)-prefix-map=[^ ]*@@g'

override_dh_auto_test:
	ARGS="--output-on-failure" dh_auto_test --max-parallel=1 || echo "Ignoring test failures"
	# Disable tests for pnetcdf. Multiple failures in nc_test where char conversions give:
	# test_put.c: NetCDF: Numeric conversion not representablea
	# This for 1.7.0pre1
	# LD_LIBRARY_PATH=$(CURDIR)/build-pnetcdf/liblib    $(MAKE) -C build-pnetcdf test

override_dh_installchangelogs:
	dh_installchangelogs RELEASE_NOTES.md

override_dh_strip:
	dh_strip --dbgsym-migration='netcdf-dbg (<< 1:4.5.0-2~)'

override_dh_makeshlibs:
	dh_makeshlibs -- -v$(UPSTREAM_VERSION)