#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

BUILD_TESTING = $(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),OFF,ON)

export CMAKE_BUILD_EXTENSION_DEBIAN = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export SETUPTOOLS_SCM_PRETEND_VERSION = $(DEB_VERSION_UPSTREAM)
export PYBUILD_AFTER_INSTALL = rm -r {destdir}{install_dir}/manifpy/include {destdir}{install_dir}/manifpy/share

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure --buildsystem=pybuild
	dh_auto_configure --buildsystem=cmake -- \
		-DBUILD_PYTHON_BINDINGS=OFF \
		-DBUILD_TESTING=$(BUILD_TESTING)

override_dh_auto_clean \
override_dh_auto_build \
override_dh_auto_install \
override_dh_auto_test: override_%:
	$* --buildsystem=pybuild
	$* --buildsystem=cmake

