#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# The fixfilepath feature causes a build failure, disable it.
export DEB_BUILD_MAINT_OPTIONS = reproducible=-fixfilepath
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-undefined -Wl,--as-needed
# do not use kdeinit for kio
export KDE_FORK_SLAVES=1

%:
	dh $@ --with kf5,python3

override_dh_auto_configure:
	dh_auto_configure -Skf5 -- \
		-DENABLE_WEBCAM=false

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-* && $(MAKE) install DESTDIR=$(CURDIR)/test_root
	$(eval TESTS_HOME := $(shell mktemp -d --tmpdir tellico-home.XXXXXX))
	mkdir -p "$(TESTS_HOME)/tmp"
	mkdir -p -m 700 "$(TESTS_HOME)/runtime"
	xvfb-run -a --server-args="-screen 0 1024x768x24+32" dh_auto_test --no-parallel -- XDG_DATA_DIRS=$(CURDIR)/test_root/usr/share:/usr/local/share:/usr/share HOME="$(TESTS_HOME)" TMPDIR="$(TESTS_HOME)/tmp" XDG_RUNTIME_DIR="$(TESTS_HOME)/runtime"
	rm -rf "$(TESTS_HOME)"
endif

override_dh_auto_install:
	dh_auto_install
	# extra copyright notices
	rm -fv debian/tmp/usr/share/tellico/pics/README.*

override_dh_python3:
	dh_python3 -p tellico-scripts --shebang=/usr/bin/python3 /usr/share/tellico/data-sources
