#!/usr/bin/make -f

XVFB_OPTS = --auto-servernum --server-num=20 -s "-screen 0 1024x768x24 -ac +extension GLX -noreset"

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME = moderngl
export PYBUILD_TEST_ARGS= --collect-only >/dev/null 2>&1; xvfb-run $(XVFB_OPTS) {interpreter} -m pytest -k "not (test_local or test_documentation or test_module_integrity)"
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
export PYBUILD_AFTER_INSTALL = \
    $(CURDIR)/debian/rules make-docs PYTHONPATH=$(CURDIR)/debian/python3-$(PYBUILD_NAME){install_dir}; \
    rm -r $(CURDIR)/debian/python3-$(PYBUILD_NAME){install_dir}/moderngl/src
endif

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
	-dh_auto_test --buildsystem=pybuild

make-docs:
	sphinx-build -M html $(CURDIR)/docs $(CURDIR)/docs/_build
