#!/usr/bin/make -f
export QT_SELECT=6

override_dh_auto_configure:
	dh_auto_configure -- \
		-G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build/
	rm -f translations/*.qm

override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

# Match the Settings import selected by CMake; Bookworm has Qt 6.4 and
# no QtCore QML module. Keep common QML dependencies in debian/control.
override_dh_gencontrol:
	if dpkg --compare-versions "$$(qmake6 -query QT_VERSION)" ge 6.5; then \
		dh_gencontrol -- -Vcustom-toolbox:SettingsDepends=qml6-module-qtcore; \
	else \
		dh_gencontrol -- -Vcustom-toolbox:SettingsDepends=qml6-module-qt-labs-settings; \
	fi

# Do not create package-private .dwz debug data.
override_dh_dwz:
	@:

override_dh_auto_install:
	# Install is handled by debian/install file
	dh_auto_install

%:
	dh $@ --buildsystem=cmake+ninja --no-automatic-dbgsym
