#!/usr/bin/make -f
export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export PYBUILD_NAME = freecontact

export PY3SO = $(shell py3versions --default --version | sed 's/\.//')

# Workaround linker error, failing to locate -lboost_python.
export LIBRARY_PATH = $(CURDIR)
execute_before_dh_auto_build:
	ln -sv /usr/lib/$(DEB_HOST_MULTIARCH)/libboost_python$(PY3SO).so \
		$(CURDIR)/libboost_python.so

%:
	dh $@ --with python3 --buildsystem=pybuild --builddirectory=$(CURDIR)/builddir

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="{interpreter} $(CURDIR)/test/test01.py" \
	    dh_auto_test
endif
