#!/usr/bin/make -f
# -*- makefile -*-
DPKG_EXPORT_BUILDFLAGS = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export QT_SELECT := qt6
export OPENJPEG_INCLUDE = $(shell find /usr/include/ -name openjpeg.h -exec dirname {} \;)
export POPPLER_INCLUDE := /usr/include/poppler/qt6

export LC_ALL=C.UTF-8

%:
	dh $@ --buildsystem=qmake6

override_dh_auto_configure:
	ENGAUGE_RELEASE=1 dh_auto_configure -- engauge.pro CONFIG+=jpeg2000 CONFIG+=pdf

override_dh_auto_build:
	dh_auto_build
	PATH=${PATH}:/usr/lib/qt6/libexec/ bash help/build.bash

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd src && xvfb-run --auto-servernum --server-num=20 ./build_and_run_all_cli_tests
	# This hangs so it seems the process is waiting for some user input
	# cd src && xvfb-run --auto-servernum --server-num=20 ./build_and_run_all_gui_tests
	rm -f bin/Test*
endif

#override_dh_install:
#	mkdir -p debian/engauge-digitizer/usr/share/pixmaps/
#	install -m644 src/img/bannerapp_128.xpm debian/engauge-digitizer/usr/share/pixmaps/engauge-digitizer.xpm
#	dh_install
