#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DH_OPTIONS
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CMAKE_COMMON_ARGS = \
	-DCMAKE_BUILD_TYPE=None \
	-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
	-DPYTHON=ON \
	-DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)

ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
  BUILDDOC = OFF
else
  BUILDDOC = ON
endif

%:
	dh $@ --with python3,sphinxdoc

override_dh_auto_configure-arch:
	dh_auto_configure -a -- \
		$(CMAKE_COMMON_ARGS)

override_dh_auto_configure-indep:
	dh_auto_configure -- \
		$(CMAKE_COMMON_ARGS) \
		-DBUILD_WEBSITE=$(BUILDDOC)

override_dh_auto_test:
	-dh_auto_test

override_dh_install-arch:
	dh_numpy3 --package=python3-imath
	dh_install

override_dh_installexamples:
	dh_installexamples -plibimath-doc --doc-main-package=libimath-dev

override_dh_missing:
	dh_missing --fail-missing
