#!/usr/bin/make -f

%:
	dh $@ --with kf5

override_dh_auto_configure:
	dh_auto_configure '--buildsystem=kf5' -- \
		-DR_EXECUTABLE=/usr/bin/R/ \
		-DNO_QT_WEBENGINE=1 \
		-DCMAKE_SKIP_RPATH=YES

override_dh_auto_test:
	xvfb-run -a --server-args="-screen 0 1024x768x24+32" dh_auto_test

override_dh_gencontrol-arch:
	# We need to know the R version
	dh_gencontrol -a -- \
	  -V'rvers=r-base-core (>= $(shell dpkg-query -W --showformat='$${Version}' r-base-core))' \
	  -V'rapivers=$(shell dpkg-query -W --showformat='$${Provides}' r-base-core | grep -o 'r-api[^, ]*')' \
	  -V'rgraphicsenginevers=$(shell dpkg-query -W --showformat='$${Provides}' r-base-core | grep -o 'r-graphics-engine[^, ]*')'
