#!/usr/bin/make -f

export YARNCOMMAND=pkgjs

# pkgjs creates node_modules/.bin containing some broken links when iterating
# over js components, and if we're building for multiple versions of python
# the second build chokes on this
export PYBUILD_AFTER_BUILD=find . -xtype l -delete

export LC_ALL=C.UTF-8

%:
	dh $@ --with=python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_configure:
	dh_auto_configure --buildsystem nodejs
	dh_auto_configure

override_dh_auto_build:
	dh_auto_build --buildsystem nodejs
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	PYTHONPATH=. http_proxy='127.0.0.9' https_proxy='127.0.0.9' python3 -m sphinx -N -bhtml docs/source/ build/html
endif

execute_after_dh_auto_install:
	mv debian/tmp/usr/etc debian/tmp/etc

override_dh_installchangelogs:
	dh_installchangelogs -k CHANGELOG.md

override_dh_installsystemduser:
	dh_installsystemduser --no-enable
