#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export PYBUILD_NAME=numcodecs
export PYBUILD_BUILD_ARGS=\
--config-setting setup-args=-Davx2=disabled \
--config-setting setup-args=-Dsse2=enabled \
--config-setting setup-args=-Dsystem_blosc=enabled \
--config-setting setup-args=-Dsystem_zstd=enabled \
--config-setting setup-args=-Dsystem_lz4=enabled \
--config-setting setup-args=-Dsystem_zlib=enabled
export PYBUILD_TEST_ARGS=\
-k "not test_crc32c_deprecation_warning" \
-v tests
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/fixture {build_dir}/.coverage {build_dir}/coverage.xml

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	env PYTHONPATH=$(shell pybuild --print {build_dir}) \
	    http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	python3 -m sphinx -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
endif

execute_after_dh_sphinxdoc:
	$(RM) -r debian/python3-numcodecs/usr/share/doc/python3-numcodecs/html/_static/scripts \
		 debian/python3-numcodecs/usr/share/doc/python3-numcodecs/html/_static/styles \
		 debian/python3-numcodecs/usr/share/doc/python3-numcodecs/html/_static/vendor
