#!/usr/bin/make -f export DH_VERBOSE=1 DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk DESTDIR:=$(CURDIR)/debian/tmp/ BUILDDIR_FLANG=debian/build-flang BUILDDIR_GFORTRAN=debian/build-gfortran DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) AUTOGENERATED:= libopenmpi-dev.postinst libopenmpi-dev.prerm ### Arch-specific stuff # No ibverbs support available on kFreeBSD, Hurd NO_VERBS_ARCH:= hurd-amd64 kfreebsd-amd64 s390x NO_FABRIC_ARCH:=hurd-amd64 kfreebsd-amd64 s390x PSM_ARCH:= amd64 PSM2_ARCH:= amd64 UCX_ARCH:= amd64 ppc64el arm64 ATOMICS_ARCH:= s390x riscv64 NO_CMA_ARCH:= s390x alpha sparc64 NO_JAVA_ARCH:= hurd-amd64 kfreebsd-amd64 ppc64 alpha sparc64 NO_TEST_ARCH:= hurd-amd64 UCX:= $(if $(filter $(DEB_TARGET_ARCH), $(UCX_ARCH)), --with-ucx, ) VERBS:= $(if $(filter $(DEB_TARGET_ARCH), $(NO_VERBS_ARCH)), , --with-verbs ) FABRIC:= $(if $(filter $(DEB_TARGET_ARCH), $(NO_FABRIC_ARCH)), , --with-libfabric ) PSM:= $(if $(filter $(DEB_TARGET_ARCH), $(PSM_ARCH)), --with-psm, ) PSM2:= $(if $(filter $(DEB_TARGET_ARCH), $(PSM2_ARCH)), --with-psm2, ) ATOMICS:= $(if $(filter $(DEB_TARGET_ARCH), $(ATOMICS_ARCH)), --enable-builtin-atomics, ) CMA:= $(if $(filter $(DEB_TARGET_ARCH), $(NO_CMA_ARCH)), --without-cma , ) DO_TEST:= $(if $(filter $(DEB_TARGET_ARCH), $(NO_TEST_ARCH)), false, true) BTL_TESTS:= $(if $(DO_TEST), --enable-opal-btl-usnic-unit-tests, ) DO_FLANG:=$(if $(wildcard /usr/bin/flang),true, false) ifeq ($(filter nojava,$(DEB_BUILD_PROFILES)),) JAVA := $(if $(filter $(DEB_TARGET_ARCH), $(NO_JAVA_ARCH)), \ ,--with-jdk-dir=/usr/lib/jvm/default-java --enable-mpi-java ) endif FLANG_FCFLAGS= $(filter '-g', $(shell dpkg-buildflags --get FCFLAGS)) FLANG_LIBDIR= $(LIBDIR)/fortran/flang FLANG_VERSION=$(shell basename $(shell readlink /usr/bin/flang)) # GFORTRAN_VERSION:=$(shell basename $(shell readlink -f /usr/bin/gfortran)) export GFORTRAN_MOD_VERSION=gfortran-mod-15 FMODDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)/fortran/$(GFORTRAN_MOD_VERSION) # arch-neutral version we can put in openmpi-common configs FMODDIR_STRING:="\${libdir}/fortran/$(GFORTRAN_MOD_VERSION)" # FC set to f77 by default in make # Read default compiler name unless FC is actually set ifeq ($(FC),f77) FC:=$(shell basename $(shell readlink /etc/alternatives/f95)) endif # Drop '-g' flag with flang. Known failure with 2018122 version ifneq ($(filter flang,$(FC)),) FCFLAGS=$(shell dpkg-buildflags --get FCLAGS | sed -e 's/-g //') endif ifeq (sparc,$(DEB_HOST_GNU_CPU)) CFLAGS += -mcpu=v9 endif # Use -O3 recommended by upstream CFLAGS += -O3 CXXFLAGS += -O3 FCFLAGS += -O3 # Flags for the static build: see bug #502232 #STATIC_CONFIG_PARAMS = --enable-static STATIC_CONFIG_PARAMS = # Do not embed build username or build system hostname, see README export HOSTNAME=hostname export USER=username %: dh $@ extra_flags = \ --disable-silent-rules \ --disable-wrapper-runpath \ --with-package-string="Debian OpenMPI" \ $(VERBS) $(FABRIC) $(PSM) $(PSM2) $(CMA) \ $(UCX) \ --with-pmix=external \ $(ATOMICS) \ $(JAVA) \ $(STATIC_CONFIG_PARAMS) \ $(BTL_TESTS) \ --with-libevent=external \ --with-hwloc=external \ --disable-silent-rules \ --enable-ipv6 \ --with-devel-headers \ --with-slurm \ --with-sge \ --without-tm \ --sysconfdir=/etc/openmpi \ --libdir=\$${prefix}/lib/${DEB_HOST_MULTIARCH}/openmpi/lib \ --includedir=\$${prefix}/lib/${DEB_HOST_MULTIARCH}/openmpi/include override_dh_auto_clean: dh_clean rm -fr debian/build-* rm -f $(patsubst %, debian/%, ${AUTOGENERATED}) find . -name Makefile.in -delete find . -name .libs -exec rm -rf {} \; || true find . -name .dirstamp -delete find . -type l -delete find . -name '*.o' -delete override_dh_update_autotools_config: (cd config && autom4te --language=m4sh opal_get_version.m4sh -o opal_get_version.sh) ./autogen.pl --force override_dh_autoreconf: @echo Skipping extra autoreconf. override_dh_auto_configure: for f in ${AUTOGENERATED} ; do \ sed -e 's%@DEB_HOST_MULTIARCH@%${DEB_HOST_MULTIARCH}%g' < debian/$$f.in | \ sed -e 's/@GFORTRAN_VERSION@/${GFORTRAN_VERSION}/' > debian/$$f ; \ done dh_auto_configure --builddirectory=$(BUILDDIR_GFORTRAN) -- $(extra_flags) $(DO_FLANG) && dh_auto_configure --builddirectory=$(BUILDDIR_FLANG) \ -- $(extra_flags) FC=flang FCFLAGS="$(FLANG_FCFLAGS)" || true override_dh_auto_build: dh_auto_build --builddirectory=$(BUILDDIR_GFORTRAN) $(DO_FLANG) && dh_auto_build --builddirectory=$(BUILDDIR_FLANG) || true override_dh_install: dh_auto_install --builddirectory=$(BUILDDIR_GFORTRAN) $(DO_FLANG) && find $(BUILDDIR_FLANG) -type f -perm -+x -a ! -name '*.la' -a ! -name '*.mod' -exec chrpath -d '{}' \; || true # Rename the compiler and startup wrappers. for f in mpic++ mpicc mpiCC mpicxx mpiexec mpif77 mpif90 mpirun mpifort ; do \ if test -f $(DESTDIR)/usr/bin/$${f}; then \ mv $(DESTDIR)/usr/bin/$${f} $(DESTDIR)/usr/bin/$${f}.openmpi ; \ fi; \ done # Rename some files #mv $(DESTDIR)/usr/bin/aggregate_profile.pl $(DESTDIR)/usr/bin/aggregate_profile #mv $(DESTDIR)/usr/bin/profile2mat.pl $(DESTDIR)/usr/bin/profile2mat mv $(DESTDIR)/usr/bin/pterm $(DESTDIR)/usr/bin/pterm.openmpi mv $(DESTDIR)/usr/share/man/man1/pterm.1 $(DESTDIR)/usr/share/man/man1/pterm.openmpi.1 # Ensure correct mpiexec is used rm $(DESTDIR)/usr/bin/mpiexec.openmpi $(DESTDIR)/usr/bin/oshrun ln -s mpirun.openmpi $(DESTDIR)/usr/bin/mpiexec.openmpi ln -s mpirun.openmpi $(DESTDIR)/usr/bin/oshrun # Strip rpath from pc,wrapper files for f in ompi-c.pc ompi-cxx.pc ompi-f77.pc ompi-f90.pc ompi-fort.pc ompi.pc opal.pc oshmem-c.pc oshmem-cxx.pc oshmem-fort.pc oshmem.pc ; do \ sed -e 's/-Wl,-rpath -Wl,$${libdir}//' < $(DESTDIR)/$(LIBDIR)/openmpi/lib/pkgconfig/$${f} | \ sed -e 's%@FMODDIR@%${FMODDIR_STRING}%g' > debian/tmp.x ; \ mv debian/tmp.x $(DESTDIR)/$(LIBDIR)/openmpi/lib/pkgconfig/$${f} ; \ done find . -name '*wrapper-data.txt' | while read f; do \ sed -e 's%$${prefix}/lib/${DEB_HOST_MULTIARCH}%$${libdir}%g' < $$f | \ sed -e 's%@FMODDIR@%${FMODDIR_STRING}%g' > debian/tmp.x ; \ mv debian/tmp.x $$f ; done # Rename the compiler wrapper man pages. for f in mpic++ mpicc mpicxx mpiexec mpif77 mpif90 mpirun mpifort ; do \ if test -f $(DESTDIR)/usr/share/man/man1/$${f}.1; then \ echo DEBUG7 $${f} ;\ mv $(DESTDIR)/usr/share/man/man1/$${f}.1 $(DESTDIR)/usr/share/man/man1/$${f}.openmpi.1 ; \ fi; \ if test -f $(DESTDIR)/usr/share/man/man1/$${f}.3; then \ echo DEBUG8 $${f} ;\ mv $(DESTDIR)/usr/share/man/man3/$${f}.3 $(DESTDIR)/usr/share/man/man1/$${f}.openmpi.3 ; \ fi; \ done cd $(DESTDIR)/usr/share/man/man3; \ for f in *.3; do \ mv $$f $$(echo $$f|sed -e "s|\.3|.openmpi.3|g"); \ done; \ mkdir -p $(DESTDIR)/$(LIBDIR)/openmpi/lib/ cp $(BUILDDIR_GFORTRAN)/ompi/mpi/fortran/*/.libs/libmpi_mpifh.so.40.40.0 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_mpifh.so.40.40.0 cp $(BUILDDIR_GFORTRAN)/ompi/mpi/fortran/*/.libs/libmpi_usempi_ignore_tkr.so.40.40.0 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr.so.40.40.0 cp $(BUILDDIR_GFORTRAN)/ompi/mpi/fortran/*/.libs/libmpi_usempif08.so.40.40.2 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempif08.so.40.40.2 gcc -shared -fPIC -Wl,-soname,libmpi_mpifh-gfortran.so.40 -o $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_mpifh-gfortran.so.40.40.0 \ $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_mpifh.so.40.40.0 gcc -shared -fPIC -Wl,-soname,libmpi_usempi_ignore_tkr-gfortran.so.40 \ -o $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr-gfortran.so.40.40.0 \ $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr.so.40.40.0 gcc -shared -fPIC -Wl,-soname,libmpi_usempif08-gfortran.so.40 -o $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempif08-gfortran.so.40.40.2 \ $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempif08.so.40.40.2 dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_GFORTRAN)/ompi/mpi/fortran/mpiext/*.mod openmpi # Flang, if present $(DO_FLANG) && ( \ mkdir -p $(DESTDIR)/$(FLANG_MODDIR) ; \ dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_FLANG)/ompi/mpi/fortran/mpiext/*.mod openmpi ; \ dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_FLANG)/ompi/mpi/fortran/use-mpi-ignore-tkr/*.mod openmpi ; \ dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_FLANG)/ompi/mpi/fortran/use-mpi-f08/*.mod openmpi ; \ dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_FLANG)/ompi/mpi/fortran/use-mpi-f08/mod/*.mod openmpi ; \ dh_fortran_mod -p libopenmpi-dev $(BUILDDIR_FLANG)/ompi/mpi/fortran/mpiext-use-mpi/*.mod openmpi ; \ cp $(BUILDDIR_FLANG)/ompi/mpi/fortran/*/.libs/libmpi_mpifh.so.40.40.0 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_mpifh-flang.so.40.40.0 ; \ cp $(BUILDDIR_FLANG)/ompi/mpi/fortran/*/.libs/libmpi_usempi_ignore_tkr.so.40.40.0 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr-flang.so.40.40.2 ; \ cp $(BUILDDIR_FLANG)/ompi/mpi/fortran/*/.libs/libmpi_usempif08.so.40.40.2 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempif08-flang.so.40.40.2 ; \ dh_link -p libopenmpi3 $(LIBDIR)/libmpi_mpifh-flang.so.40.40.0 $(LIBDIR)/openmpi/lib/libmpi_mpifh-flang.so.40 ; \ dh_link -p libopenmpi-dev $(LIBDIR)/libmpi_mpifh-flang.so.40.40.0 $(FLANG_LIBDIR)/openmpi/lib/libmpi_mpifh-flang.so ; \ dh_link -p libopenmpi3 $(LIBDIR)/libmpi_usempif08-flang.so.40.40.2 $(LIBDIR)/openmpi/lib/libmpi_usempif08-flang.so.40 ; \ dh_link -p libopenmpi-dev $(LIBDIR)/libmpi_usempif08-flang.so.40.40.2 $(FLANG_LIBDIR)/openmpi/lib/libmpi_usempif08.so ; \ dh_link -p libopenmpi3 $(LIBDIR)/libmpi_usempi_ignore_tkr-flang.so.40.40.0 $(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr-flang.so.40 ; \ dh_link -p libopenmpi-dev $(LIBDIR)/libmpi_usempi_ignore_tkr-flang.so.40.40.0 $(FLANG_LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr.so ; \ ) || true # patchelf --set-soname libmpi_mpifh-flang.so.40 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_mpifh-flang.so.40.40.0 ; \ # patchelf --set-soname libmpi_usempi_ignore_tkr-flang.so.40 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempi_ignore_tkr-flang.so.40.40.0 ; \ # patchelf --set-soname libmpi_usempif08-flang.so.40 $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_usempif08-flang.so.40.40.0 ; \ # Strip rpath info from all executables and libraries. find $(DESTDIR) -type f -perm -+x -a ! -name '*.la' -a ! -name '*.mod' -exec chrpath -d '{}' \; || true # Rename orte-bootproxy.sh to orte-bootproxy if test -f $(DESTDIR)/usr/bin/orte-bootproxy.sh; then \ mv $(DESTDIR)/usr/bin/orte-bootproxy.sh $(DESTDIR)/usr/bin/orte-bootproxy; \ fi # Remove dangling symlink(s) rm -f $(DESTDIR)/usr/share/man/man1/mpiCC.1 rm -f $(DESTDIR)/usr/share/man/man1/orteCC.1 # Remove COPYRIGHT file of ptmalloc2. It's reproduced in debian/copyright. rm -fr $(DESTDIR)/usr/share/openmpi/doc/ # Remove pmi2, pmix now in separate package rm -rf $(DESTDIR)/usr/lib/*/openmpi/include/pmi* # Remove buggy ${pkgincludedir} refs from pkg-config files. #837062 find . -name '*.pc' -type f | while read f ; do \ cat $${f} | sed -e 's%-I$${pkgincludedir}[a-zA-Z0-9/]* %%g' > x ; \ mv x $${f}; done # sanitize build paths for bit-reproducibility if test $(DESTDIR)/${LIBDIR}/openmpi/include/openmpi/opal_config.h ; then \ sed -e 's%${CURDIR}%/build/openmpi%g' < $(DESTDIR)/${LIBDIR}/openmpi/include/openmpi/opal_config.h \ > $(DESTDIR)/x ; \ mv $(DESTDIR)/x /$(DESTDIR)/${LIBDIR}/openmpi/include/openmpi/opal_config.h ; \ fi # Continue as usual dh_install # oshmem, shmem only built on Linux so do by hand or it may fail ... # mkdir -p debian/libopenmpi3/$(LIBDIR)/openmpi/lib if test -f $(DESTDIR)/usr/bin/oshmem_info ; then \ dh_link -p openmpi-bin /usr/bin/mpirun.openmpi /usr/bin/oshrun ;\ dh_install -p openmpi-bin /usr/bin/oshmem_info ; \ dh_install -p openmpi-bin /usr/bin/oshcxx ;\ dh_install -p openmpi-bin /usr/bin/oshcc ;\ dh_install -p openmpi-bin /usr/bin/oshc++ ;\ dh_install -p openmpi-bin /usr/bin/oshfort ; \ dh_install -p openmpi-bin /usr/bin/oshCC ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshfort.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshrun.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshmem_info.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshcc.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshCC.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshc++.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/oshcxx.1 ; \ dh_install -p libopenmpi3 $(LIBDIR)/openmpi/lib/liboshmem.so.40.40.3 $(LIBDIR) ; \ dh_link -p libopenmpi3 $(LIBDIR)/liboshmem.so.40.40.3 $(LIBDIR)/liboshmem.so.40 ; \ dh_link -p libopenmpi-dev $(LIBDIR)/liboshmem.so.40 $(LIBDIR)/openmpi/lib/liboshmem.so ; \ dh_link -p libopenmpi-dev $(LIBDIR)/liboshmem.so.40 $(LIBDIR)/liboshmem.so ; \ fi if test -f $(DESTDIR)/$(LIBDIR)/openmpi/lib/libmpi_java.so.40.40.0 ; then \ dh_install -p openmpi-bin /usr/bin/mpijavac ; \ dh_install -p openmpi-bin usr/bin/mpijavac.pl ; \ dh_installman openmpi-bin $(DESTDIR)/usr/share/man/man1/mpijavac.1 ; \ dh_install -p libopenmpi3 $(LIBDIR)/openmpi/lib/libmpi_java.so.40.40.0 $(LIBDIR); \ dh_link -p libopenmpi3 $(LIBDIR)/libmpi_java.so.40.40.0 $(LIBDIR)/libmpi_java.so.40 ; \ dh_link -p libopenmpi-dev $(LIBDIR)/libmpi_java.so.40 $(LIBDIR)/openmpi/lib/libmpi_java.so ; \ dh_link -p libopenmpi-dev $(LIBDIR)/libmpi_java.so.40 $(LIBDIR)/libmpi_java.so ; \ fi # If shmemrun exists, its a broken link so use -h to test if test -h $(DESTDIR)/usr/bin/shmemrun ; then \ dh_link -p openmpi-bin /usr/bin/mpirun.openmpi /usr/bin/shmemrun ;\ dh_install -p openmpi-bin usr/bin/shmemcc ; \ dh_install -p openmpi-bin usr/bin/shmemcxx ; \ dh_install -p openmpi-bin usr/bin/shmemc++ ; \ dh_install -p openmpi-bin /usr/bin/shmemCC ; \ dh_install -p openmpi-bin /usr/bin/shmemfort ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemcc.1 ;\ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemc++.1 ;\ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemfort.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemrun.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemCC.1 ; \ dh_installman -p openmpi-bin $(DESTDIR)/usr/share/man/man1/shmemcxx.1 ; \ fi override_dh_fixperms-arch: chmod 0644 debian/libopenmpi-dev/$(FMODDIR)/openmpi/*.mod rm -f debian/libopenmpi-dev/usr/lib/*/openmpi/lib/ompi_monitoring_prof.so dh_fixperms override_dh_auto_test: $(DO_TEST) && dh_auto_test || echo "Tests disabled on ${NO_TEST_ARCH} systems for the moment" override_dh_shlibdeps: dh_shlibdeps -l$(DESTDIR)/$(LIBDIR)/openmpi/lib -- --ignore-missing-info override_dh_installdocs: dh_installdocs --all README.md ifeq ($(filter nojava,$(DEB_BUILD_PROFILES)),) dh_installdocs -p openmpi-doc debian/tmp/usr/share/doc/openmpi/javadoc-openmpi dh_link -p libopenmpi-dev /usr/share/javascript/jquery/jquery.js /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/external/jquery/jquery.js dh_link -p libopenmpi-dev /usr/share/javascript/jquery/jquery.js /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/jquery-3.5.1.js dh_link -p libopenmpi-dev /usr/share/javascript/jquery-ui/themes/base/jquery-ui.css /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/jquery-ui.css dh_link -p libopenmpi-dev /usr/share/javascript/jquery-ui/jquery-ui.js /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/jquery-ui.js dh_link -p libopenmpi-dev /usr/share/javascript/jquery-ui/themes/base/jquery-ui.min.css /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/jquery-ui.min.css dh_link -p libopenmpi-dev /usr/share/javascript/jquery-ui/jquery-ui.min.js /usr/share/doc/libopenmpi-dev/javadoc-openmpi/jquery/jquery-ui.min.js endif