#!/usr/bin/make -f

DEB_HOST_MULTIARCH?=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_BUILD_MAINT_OPTIONS=reproducible=+fixfilepath

export DEB_BUILD_MAINT_OPTIONS=hardening=+all reproducible=+fixfilepath
export PYBUILD_NAME=notcurses
export PYBUILD_DIR=cffi
export PYBUILD_DESTDIR=debian/python3-notcurses

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

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- \
		-DBUILD_FFI_LIBRARY=off \
		-DDFSG_BUILD=on \
		-DUSE_GPM=on \
		-DUSE_POC=off \
		-DUSE_QRCODEGEN=on

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

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