#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all # If noopt was not passed, building with -O3 instead of -O2 to enhance # numerical performance. ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) export DEB_CXXFLAGS_MAINT_APPEND=-O3 export DEB_CXXFLAGS_MAINT_STRIP=-O2 endif include /usr/share/dpkg/buildflags.mk CFLAGS+=$(CPPFLAGS) CXXFLAGS+=$(CPPFLAGS) DPKG_EXPORT_BUILDFLAGS = 1 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) include /usr/share/dpkg/pkg-info.mk PY3VER=$(shell py3versions -d) SOVERSION_STOPT=5 VERSION_STOPT=$(shell echo $(DEB_VERSION_UPSTREAM) | sed -E 's/~rc[0-9]*// ; s/\+dfsg[0-9]*//') # Using --oversubscribe if Open MPI is used, and no flag for MPICH. ifeq (, $(shell dpkg --list | grep "libmpich-dev")) OVERSUBSCRIBE_FLAG=--oversubscribe else OVERSUBSCRIBE_FLAG= endif %: dh $@ --with python3 override_dh_auto_clean: dh_auto_clean # Removing the build directory of the LaTeX documentation. -rm -rf texdocBuild/ override_dh_auto_configure-arch: dh_auto_configure -- \ -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \ -DCMAKE_INSTALL_PREFIX="/usr" \ -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \ -DSOVERSION_STOPT="$(SOVERSION_STOPT)" \ -DVERSION_STOPT="$(VERSION_STOPT)" \ -DPython3_INCLUDE_DIRS=$(shell python3-config --includes | sed 's/.*-I//') \ -DPython3_LIBRARIES=$(shell ls /usr/lib/$(DEB_HOST_MULTIARCH)/libpython*.so | grep "$(PY3VER)") \ -DPython3_NumPy_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \ -DMPIEXEC_PREFLAGS=$(OVERSUBSCRIBE_FLAG) override_dh_auto_configure-indep: override_dh_auto_build-indep: ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) # Building the LaTeX documentation. # Two sets of paths have to be changed because we used a MUT package. cp -a texdoc/ texdocBuild/ cd texdocBuild && \ sed -i 's|../StOpt/StOpt/|../StOpt/|g' documentation.tex && \ sed -i 's|../StOpt/test/|../test/|g' documentation.tex && \ pdflatex documentation.tex && \ bibtex documentation.aux && \ pdflatex documentation.tex && \ pdflatex documentation.tex endif # Tests cannot be run safely in parallel. override_dh_auto_test-arch: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) dh_auto_test -a --no-parallel endif # No test to perform for the architecture-independent packages override_dh_auto_test-indep: override_dh_installdocs-indep: dh_installdocs -i ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) mkdir -p debian/stopt-doc/usr/share/doc/stopt-doc/ cp texdocBuild/documentation.pdf debian/stopt-doc/usr/share/doc/stopt-doc/ endif override_dh_installexamples-indep: dh_installexamples -i cp -a test/python/ debian/stopt-examples/usr/share/doc/stopt-examples/examples/ # Some Python tests cannot be run because we don't package all built .so... # some of them being designed for the tests only. rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/functional/ rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/geners/testSomeBinaryArchiveStorage.py rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/global rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/sddp rm -rf debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/unit/tree override_dh_fixperms-indep: dh_fixperms -i #Setting all Python scripts (that are shipped as examples) as being executable for F in $$(find debian/stopt-examples/usr/share/doc/stopt-examples/examples/python/ -name "test*.py"); do \ chmod a+x $$F; \ done