File: rules

package info (click to toggle)
adios 1.13.1-26
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 23,664 kB
  • sloc: ansic: 133,236; f90: 8,791; sh: 7,781; python: 7,648; xml: 3,793; makefile: 2,997; cpp: 2,340; java: 626; sed: 16; perl: 8
file content (233 lines) | stat: -rwxr-xr-x 9,619 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/make -f

export DH_VERBOSE=1

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

ARCH:=$(shell dpkg --print-architecture)

AUTOGENERATED:=   adios_config control libadios-bin.postinst  \
 		libadios-mpich-dev.postinst.in libadios-openmpi-dev.postinst.in \
		 python3-adios.postinst

MPI_LIBS_OPENMPI:= $(pkg-config ompi-fort --libs)
MPI_LIBS_MPICH:= $(pkg-config mpich-fort --libs)

include /usr/share/mpi-default-dev/debian_defaults

WITH_IBVERBS:= --with-infiniband=/usr
ifeq ($(ARCH),hurd-i386)
  WITH_IBVERBS:=
endif
ifeq ($(ARCH),kfreebsd-amd64)
  WITH_IBVERBS:=
endif
ifeq ($(ARCH),kfreebsd-i386)
  WITH_IBVERBS:=
endif

# TODO: also mpich2 for x32 ...
# DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# See  #966966
GF10_FLAGS:=$(if $(filter $(shell readlink /usr/bin/gfortran), gfortran-10), \
                 -fallow-invalid-boz -fallow-argument-mismatch, )
export FFLAGS=$(shell dpkg-buildflags --get FFLAGS) $(GF10_FLAGS)
export FCFLAGS=$(shell dpkg-buildflags --get FCFLAGS) $(GF10_FLAGS)


DESTDIR:=$(shell pwd)/debian/tmp
DEB_HOST_MULTIARCH?=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
BINDIR:=$(DESTDIR)/usr/bin
PY3VERS:=$(shell py3versions -s)
CFLAGS:=$(shell  dpkg-buildflags --get CFLAGS )

MPIDESTDIR:=$(DESTDIR)/$(ARCH_DEFAULT_MPI_IMPL)
BUILD_MPI:=build-$(ARCH_DEFAULT_MPI_IMPL)

export VERSION=${DEB_VERSION_UPSTREAM}
export DEFAULT_MPI=${ARCH_DEFAULT_MPI_IMPL}

TOP:=$(shell pwd)
# to find adios_config
export PATH:=$(TOP):$(PATH)

# magic debhelper rule
%:
	dh $@ 

override_dh_auto_clean:
	dh_clean	
	find . -name '*.pyc'  -o -name '*.o'  -o  -name '*.a' -o  -name '*.mod' -delete
	rm -fr  build-* 
	# Remove dodgy symlinks
	find . -type l -delete
	rm -f ./examples/staging/stage_write/writer_adios config.log 
	rm -f libtool config.h  config.status adios_config.flags  adios_config
	rm -f adios.pc stamp-h1
	find . -name .gitignore -delete

override_dh_auto_configure:
	for f in ${AUTOGENERATED} ; do \
                sed 	-e 's%@VERSION@%${DEB_VERSION_UPSTREAM}%g' < debian/$$f.in     \
			-e 's%@OMPIARCHS@%${OPENMPI_AVAILABLE_ARCHITECTURES}%g' \
	    		-e 's%@MPICHARCHS@%${MPICH_AVAILABLE_ARCHITECTURES}%g' \
	    		-e 's%@DEB_HOST_MULTIARCH@%${DEB_HOST_MULTIARCH}%g' \
			-e 's%@DEFAULT_MPI@%${ARCH_DEFAULT_MPI_IMPL}%g' \
		      < debian/$$f.in > debian/$$f ; \
                done
ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES)))
	CONFIG_SHELL=/bin/bash dh_auto_configure --builddirectory=build-mpich  -- \
		$(WITH_LUSTRE) $(WITH_IBVERBS) --enable-shared \
		--with-nc4par=yes \
		--with-nc4par-incdir=$(LIBDIR)/netcdf/mpi/include \
		--with-nc4par-libdir=$(LIBDIR)/netcdf/mpi \
		--with-hdf5-incdir=/usr/include/hdf5/serial \
		--with-hdf5-libdir=$(LIBDIR)/hdf5/serial \
		--with-phdf5-incdir=/usr/include/hdf5/mpich \
		--with-phdf5-libdir=$(LIBDIR)/hdf5/mpich \
		--with-lz4=/usr --with-szip=/usr --with-blosc=/usr \
		--with-bzip2=/usr  --with-zlib=/usr --with-glib=/usr \
		--prefix=/usr MPICC=mpicc.mpich MPIFC=mpif90.mpich CFLAGS='$(CFLAGS) -I$(LIBDIR)/glib-2.0/include' \
		LIBS=' $(MPI_LIBS_MPICH) -lpthread'  SHELL=/bin/bash CONFIG_SHELL=/bin/bash
	cp -a wrappers/numpy build-mpich
endif
ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES)))
	CONFIG_SHELL=/bin/bash dh_auto_configure --builddirectory=build-openmpi  -- \
		$(WITH_LUSTRE) $(WITH_IBVERBS) --enable-shared \
		--with-nc4par=yes \
		--with-nc4par-incdir=$(LIBDIR)/netcdf/mpi/include \
		--with-nc4par-libdir=$(LIBDIR)/netcdf/mpi \
		--with-hdf5-incdir=/usr/include/hdf5/serial \
		--with-hdf5-libdir=$(LIBDIR)/hdf5/serial \
		--with-phdf5-incdir=/usr/include/hdf5/openmpi \
		--with-phdf5-libdir=$(LIBDIR)/hdf5/openmpi \
		--with-lz4=/sr --with-szip=/usr --with-blosc=/usr \
		--with-bzip2=/usr  --with-zlib=/usr --with-glib=/usr \
		--prefix=/usr MPICC=mpicc.openmpi MPIFC=mpif90.openmpi CFLAGS='$(CFLAGS) -I$(LIBDIR)/glib-2.0/include' \
		LIBS=' $(MPI_LIBS) -lpthread'  SHELL=/bin/bash CONFIG_SHELL=/bin/bash
	cp -a wrappers/numpy build-openmpi
endif

override_dh_auto_build:
	# First do a build shared, with -fPIC, for the python lib.
ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES)))
	dh_auto_build --builddirectory=build-mpich -- CFLAGS='$(CFLAGS) -fPIC' VERBOSE=1
endif
ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES)))
	dh_auto_build --builddirectory=build-openmpi -- CFLAGS='$(CFLAGS) -fPIC' VERBOSE=1
endif
	# Need to hack the libs into the right place, to match adios_configs view
	# as this is then used by setup.py
	install -D -t debian/tmp/usr/lib $(BUILD_MPI)/src/*.a 
	install -m 755 -t $(TOP) $(BUILD_MPI)/adios_config $(BUILD_MPI)/adios_config.flags
	$(MAKE) -C wrappers/numpy python3  CYTHON3=y MPI=y
	# MPICH 
ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES)))
	install -D -t debian/tmp/usr/lib build-mpich/src/*.a
	for p in $(PY3VERS) ; do \
		( cd build-mpich/numpy && \
		$$p ./setup_mpi.py build_ext --mpicc=mpicc.mpich --mpicxx=mpicxx.mpich ) ;  \
		done
endif
	# OpenMPI
ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES)))
	install -D -t debian/tmp/usr/lib build-openmpi/src/*.a
	for p in $(PY3VERS) ; do \
		( cd build-openmpi/numpy && \
		$$p ./setup_mpi.py build_ext --mpicc=mpicc.openmpi --mpicxx=mpicxx.openmpi ) ;  \
		done
endif
	# Now the static build
	dh_auto_build

override_dh_auto_install:
	mkdir -p $(BINDIR) debian/tmp/usr/lib/python3/dist-packages $(DESTDIR)/usr/etc
ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES)))
	dh_auto_install --builddirectory=build-mpich --destdir=$(TOP)/debian/tmp/mpich -- VERBOSE=1
	install -D -m 644  build-mpich/adios.pc $(TOP)/debian/tmp/$(LIBDIR)/pkgconfig/adios-mpich.pc
	for p in  $(PY3VERS) ; do \
		( cd build-mpich/numpy && \
		$$p ./setup_mpi.py install --prefix=$(DESTDIR)/mpich  ) ;  \
		mv debian/tmp/mpich/lib/$$p/site-packages/adios_mpi \
		   debian/tmp/mpich/lib/$$p/site-packages/adios_mpich ; \
		done
	for p in $(PY3VERS) ; do \
		cp -a debian/tmp/mpich/lib/$$p/site-packages/* debian/tmp/usr/lib/python3/dist-packages ; \
		done
	for p in bp2bp bp2ncd bpappend bpdump bpgettime bpls bpsplit skeldump adios_lint ; do \
		cp debian/tmp/mpich/usr/bin/$$p $(BINDIR)/$$p.mpich ; \
		done
	cp -a debian/tmp/mpich/usr/etc/skel $(DESTDIR)/usr/etc/skel.mpich
endif
ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES)))
	dh_auto_install --builddirectory=build-openmpi --destdir=$(TOP)/debian/tmp/openmpi -- VERBOSE=1
	install -D -m 644  build-openmpi/adios.pc debian/tmp/$(LIBDIR)/pkgconfig/adios-openmpi.pc
	# Sort python stuff
	for p in $(PY3VERS) ; do \
		( cd build-openmpi/numpy && \
		$$p ./setup_mpi.py install --prefix=$(DESTDIR)/openmpi  ) ;  \
		mv debian/tmp/openmpi/lib/$$p/site-packages/adios_mpi \
	           debian/tmp/openmpi/lib/$$p/site-packages/adios_openmpi ; \
		done
	for p in $(PY3VERS) ; do \
		cp -a debian/tmp/openmpi/lib/$$p/site-packages/* debian/tmp/usr/lib/python3/dist-packages ; \
		done
	for p in bp2bp bp2ncd bpappend bpdump bpgettime bpls bpsplit skeldump adios_lint skel ; do \
		cp debian/tmp/openmpi/usr/bin/$$p $(BINDIR)/$$p.openmpi ; \
		done
	cp -a debian/tmp/openmpi/usr/etc/skel $(DESTDIR)/usr/etc/skel.openmpi
endif
	# serial
	install -D -t debian/tmp/usr/lib $(BUILD_MPI)/src/*.a 
	for p in  $(PY3VERS) ; do \
		( cd wrappers/numpy && \
		$$p ./setup.py     install --prefix=$(DESTDIR) ) ;\
		done
	mkdir -p debian/tmp/usr/lib/python3/dist-packages
	for p in $(PY3VERS) ; do \
		cp -a debian/tmp/lib/$$p/site-packages/* debian/tmp/usr/lib/python3/dist-packages ; \
		done
	(find debian/tmp/usr/lib/python3/ -name '__pycache__' -exec rm -rf {} \; ) || true
	# renamed as per Adios CCS issue #118716, Debbug #639257
	mkdir -p $(BINDIR)
	mv $(MPIDESTDIR)/usr/bin/gpp.py $(BINDIR)/adiosxml2h
	mv $(MPIDESTDIR)/usr/bin/skel_cat.py $(BINDIR)/skel_cat
	mv $(MPIDESTDIR)/usr/bin/skel_extract.py $(BINDIR)/skel_extract
	# These are non-mpi / neutral. move
	mv $(MPIDESTDIR)/usr/bin/skel $(BINDIR)
	mv $(MPIDESTDIR)/usr/include $(DESTDIR)/usr
	cp debian/adios_config $(BINDIR)/adios_config
	find debian -name .libs -delete
	rm -rf debian/tmp/usr/lib/python3/dist-packages/adios_mpi
	dh_install
	rm -f debian/libadios-mpich-dev/usr/lib/*/adios/mpich/*_nompi*
	rm -f debian/libadios-openmpi-dev/usr/lib/*/adios/openmpi/*_nompi*
	mkdir -p python3-adios/usr/lib/python3/dist-packages/adios_mpi
	dh_link -p python3-adios /usr/lib/python3/dist-packages/adios_$(ARCH_DEFAULT_MPI_IMPL)/__init__.py \
			         /usr/lib/python3/dist-packages/adios_mpi/__init__.py
	dh_link -p python3-adios /usr/lib/python3/dist-packages/adios_$(ARCH_DEFAULT_MPI_IMPL)/_hl \
				/usr/lib/python3/dist-packages/adios_mpi/_hl

override_dh_auto_test:
	dh_auto_test --builddirectory=build-mpich 
	dh_auto_test --builddirectory=build-openmpi
	# TODO Add testing of python work

override_dh_installexamples:
	dh_installexamples
	if test -d debian/libadios-examples/usr/share/doc/libadios-examples/examples ; then \
		find debian/libadios-examples/usr/share/doc/libadios-examples/examples -name '*.o' -delete  ; \
		find debian/libadios-examples/usr/share/doc/libadios-examples/examples/C -type f -exec chmod -x {} \; ; \
	fi 

override_dh_fixperms-arch:
	dh_fixperms
	chmod +x debian/libadios-bin/etc/adios/skel*/templates/submit*.tpl
	chmod +x debian/libadios-bin/etc/adios/skel*/templates/*.tmpl
	chmod -x debian/libadios-bin/etc/adios/skel*/templates/xml.tmpl
	chmod -x debian/libadios-bin/etc/adios/skel*/templates/source*tmpl
	chmod -x debian/libadios-bin/etc/adios/skel*/templates/Makefile.tmpl
	chmod -x debian/libadios-bin/etc/adios/skel*/templates/submit_sith.tmpl