#!/usr/bin/make -f
# SPDX-License-Identifier: LGPL-2.0-or-later
# SPDX-FileCopyrightText: 2023 Jonathan Riddell <jr@jriddell.org>

export DH_VERBOSE=1
export DH_VIRTUALENV_INSTALL_ROOT=/opt/

PACKAGE=$(shell dh_listpackages)
DH_VENV_DIR=debian/$(PACKAGE)$(DH_VIRTUALENV_INSTALL_ROOT)/$(PACKAGE)

%:
	dh $@ --buildsystem=pybuild --with python-virtualenv --with kf6 --buildsystem kf6

override_dh_virtualenv:
	dh_virtualenv --python=python3 --no-package pycairo --use-system-packages
	$(DH_VENV_DIR)/bin/python $(DH_VENV_DIR)/bin/pip install -U --upgrade-strategy eager -r requirements.txt
	. $(DH_VENV_DIR)/bin/activate \
	&& ls -ls && dh_auto_configure -- -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON \
	&& dh_auto_build \
	&& dh_auto_install

override_dh_auto_test:
	:

.PHONY: override_dh_strip override_dh_shlibdeps

override_dh_strip:
		dh_strip --exclude=/site-packages/

override_dh_shlibdeps:
		dh_shlibdeps --exclude=/site-packages/


override_dh_fixperms:
	dh_fixperms
	chmod 755 debian/selenium-webdriver-at-spi/usr/share/selenium-webdriver-at-spi/examples/*
