#!/usr/bin/make -f

DEB_HOST_MULTIARCH?=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export PYBUILD_NAME=notcurses
export PYBUILD_DIR=python
export PYBUILD_DESTDIR=debian/python3-notcurses

CFLAGS += -ffile-prefix-map=$(CURDIR)=/

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- -DDFSG_BUILD=ON -DUSE_PYTHON=OFF

override_dh_auto_build:
	dh_auto_build
	CFLAGS="$(CFLAGS) -I$(CURDIR)/include" LDFLAGS="$(LDFLAGS) \
		-L$(CURDIR)/obj-$(DEB_HOST_MULTIARCH)" pybuild --build

override_dh_auto_install:
	dh_auto_install -B $(BUILDDIR)
	pybuild --install
