#!/usr/bin/make -f export DH_VERBOSE=1 include /usr/share/dpkg/pkg-info.mk include /usr/share/debhelper/dh-fortran/fortran-support.mk include /usr/share/mpi-default-dev/debian_defaults 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.postinst python3-adios.prerm MPI_LIBS_OPENMPI:= $(pkgconf ompi-fort --libs) MPI_LIBS_MPICH:= $(pkgconf mpich-fort --libs) NO_VERBS_ARCH:= hurd-i386 kfreebsd-amd64 freebsd-i386 WITH_IBVERBS:= $(if $(filter $(DEB_TARGET_ARCH), $(NO_VERBS_ARCH)), , --with-infiniband=/usr ) # 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) INCDIR:=/usr/include/$(DEB_HOST_MULTIARCH) BINDIR:=$(DESTDIR)/usr/bin PY3VERS:=python3.12 PY3VERD:=python3.12 ABITAG:=$(shell ${PY3VERD} -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))" ) # Disable extra flags. Breaking autogenerated cython-legacy codes CFLAGS:=$(shell dpkg-buildflags --get CFLAGS ) \ -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -Wno-error=implicit-function-declaration MPIDESTDIR:=$(DESTDIR)/$(ARCH_DEFAULT_MPI_IMPL) BUILD_MPI:=build-$(ARCH_DEFAULT_MPI_IMPL)-$(PY3VERD) 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-mpi.pc 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))) for p in $(PY3VERS) ; do \ CONFIG_SHELL=/bin/bash dh_auto_configure --builddirectory=build-mpich-$$p -- \ $(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$(INCDIR)/mpich -I$(LIBDIR)/glib-2.0/include' \ LIBS=' $(MPI_LIBS_MPICH) -lpthread' SHELL=/bin/bash CONFIG_SHELL=/bin/bash ; \ cp -a wrappers/numpy build-mpich-$$p ; \ done endif ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) for p in $(PY3VERS) ; do \ CONFIG_SHELL=/bin/bash dh_auto_configure --builddirectory=build-openmpi-$$p -- \ $(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$(INCDIR)/openmpi -I$(LIBDIR)/glib-2.0/include' \ LIBS=' $(MPI_LIBS) -lpthread' SHELL=/bin/bash CONFIG_SHELL=/bin/bash ; \ cp -a wrappers/numpy build-openmpi-$$p ; \ done endif override_dh_auto_build: # First do a build shared, with -fPIC, for the python lib. ifneq (,$(findstring $(ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) for p in $(PY3VERS) ; do \ dh_auto_build --builddirectory=build-mpich-$$p -- CFLAGS='$(CFLAGS) -I$(INCDIR)/mpich -fPIC' VERBOSE=1 ; \ done endif ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) for p in $(PY3VERS) ; do \ dh_auto_build --builddirectory=build-openmpi-$$p -- CFLAGS='$(CFLAGS) -I$(INCDIR)/openmpi -fPIC' VERBOSE=1 ;\ done 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))) for p in $(PY3VERS) ; do \ install -D -t debian/tmp/usr/lib build-mpich-$$p/src/*.a ; \ ( set -e ; cd build-mpich-$$p/numpy && \ $(MAKE) python3 PYTHON3=$$p INCDIR=$(INCDIR) MPIV=mpich CYTHON3=y MPI=y && \ $$p ./setup3_mpi.py build_ext -I $(INCDIR)/mpich --mpicc=mpicc.mpich --mpicxx=mpicxx.mpich ) ; \ done endif # OpenMPI ifneq (,$(findstring $(ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) for p in $(PY3VERS) ; do \ install -D -t debian/tmp/usr/lib build-openmpi-$$p/src/*.a ; \ @echo DEBUG build for $$p ; \ ( set -e ; cd build-openmpi-$$p/numpy && \ $(MAKE) python3 PYTHON3=$$p CYTHON3=y MPI=y INCDIR=$(INCDIR) MPIV=openmpi && \ $$p ./setup3_mpi.py build_ext -I $(INCDIR)/openmpi --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))) for p in $(PY3VERD) ; do \ dh_auto_install --builddirectory=build-mpich-$$p --destdir=$(TOP)/debian/tmp/mpich -- VERBOSE=1 ; \ install -D -m 644 build-mpich-$$p/adios-mpi.pc $(TOP)/debian/tmp/$(LIBDIR)/pkgconfig/adios-mpich.pc ; \ done for p in $(PY3VERS) ; do \ ( set -e ; cd build-mpich-$$p/numpy && \ $$p ./setup_mpi.py install --prefix=$(DESTDIR)/mpich ) ; \ mv debian/tmp/mpich/local/lib/$$p/dist-packages/adios_mpi \ debian/tmp/mpich/local/lib/$$p/dist-packages/adios_mpich ; \ done for p in $(PY3VERS) ; do \ cp -a debian/tmp/mpich/local/lib/$$p/dist-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))) for p in $(PY3VERD) ; do \ dh_auto_install --builddirectory=build-openmpi-$$p --destdir=$(TOP)/debian/tmp/openmpi -- VERBOSE=1 ; \ install -D -m 644 build-openmpi-$$p/adios-mpi.pc debian/tmp/$(LIBDIR)/pkgconfig/adios-openmpi.pc ; \ done # Sort python stuff for p in $(PY3VERS) ; do \ ( set -e ; cd build-openmpi-$$p/numpy && \ $$p ./setup_mpi.py install --prefix=$(DESTDIR)/openmpi ) ; \ mv debian/tmp/openmpi/local/lib/$$p/dist-packages/adios_mpi \ debian/tmp/openmpi/local/lib/$$p/dist-packages/adios_openmpi ; \ done for p in $(PY3VERS) ; do \ cp -a debian/tmp/openmpi/local/lib/$$p/dist-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 install -D -m 644 $(BUILD_MPI)/adios.pc debian/tmp/$(LIBDIR)/pkgconfig/adios.pc (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-$(PY3VERD) dh_auto_test --builddirectory=build-openmpi-$(PY3VERD) # 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 chrpath -d debian/libadios-bin/usr/bin/bp2bp.* chrpath -d debian/python3-adios/usr/lib/python3/dist-packages/adios_*/adios*.cpython-*.so chrpath -d debian/python3-adios/usr/lib/python3/dist-packages/adios*.so 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