#!/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 libadios-openmpi-dev.postinst \ libadios-mpich-dev.prerm libadios-openmpi-dev.prerm \ python3-adios.preinst python3-adios.postinst python3-adios.prerm 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-9), \ , -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) ABITAG:=$(shell ${PY3VERS} -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))" ) 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' \ -e 's%@ABITAG@%${ABITAG}%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=/usr --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 # MPICH ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) install -D -t debian/tmp/usr/lib build-mpich/src/*.a for p in $(PY3VERS) ; do \ ( set -e ; cd build-mpich/numpy && \ $(MAKE) python3 CYTHON3=y MPI=y && \ $$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 \ ( set -e ; cd build-openmpi/numpy && \ $(MAKE) python3 CYTHON3=y MPI=y && \ $$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 \ ( set -e ; 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 \ ( set -e ; 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 (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 {} \; ; \ chmod -x debian/libadios-examples/usr/share/doc/libadios-examples/examples/skel/geos5/geos5.xml ; \ 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