#! /usr/bin/make -f

include /usr/share/dune/dune-debian.mk
include /usr/share/dune/dune-debian-python.mk

ifneq ("$(DEB_HOST_ARCH_BITS)", "64")
	# exclude test of reading binary gmsh files on non-64 bit machines
	# # Those files are written withe integer size 64bit but implementation
	# # throws because it only allows for reading 32bit integers
	export DUNE_CTEST_OPTIONS=-E "(gmsh4readertest|gmshtest-uggrid)"
endif

ifeq ($(DEB_HOST_ARCH),i386)
	# exclude vtktest-mpi-2 on i386: VTK (9.6.2+ds-5) cannot read parallel
	# VTK XML files (.pvtu, .pvtp) there.  libvtksys is built without large
	# file support, the rest of VTK with it, so vtkXMLReader::CanReadFile()
	# gets a wrong st_size from vtksys::SystemTools::Stat() and rejects every
	# piece ("Expat must be configured with XML_LARGE_SIZE to read files >
	# 2Gb").  Drop this once vtk9 is fixed:
	# https://bugs.debian.org/1156528
	export DUNE_CTEST_OPTIONS=-E "(gmsh4readertest|gmshtest-uggrid|vtktest-mpi-2)"
endif

override_dh_install:
	# Manual delete runpath set by openmpi 5.0.5
	# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085509
	find debian/tmp/ -name \*.so -o  -name \*.so.\* -exec chrpath -d '{}' \; || true
	dh_install

override_dh_auto_test-arch:
	$(DUNE_DEBIAN_AUTO_TEST)

# The indep build only ships the documentation; the tests are run by the
# arch build.
override_dh_auto_test-indep:

%:
	dh $@ --builddirectory=build --buildsystem=cmake
