#!/usr/bin/make -f
#
# https://github.com/John0n1/CamSniff
#
# Copyright (c) 2026 John Hauger Mitander
# License: MIT License https://opensource.org/license/MIT

export DH_VERBOSE ?= 1

%:
	dh $@

override_dh_auto_configure:
	# Nothing to configure

override_dh_auto_build:
	# Nothing to build

override_dh_auto_test:
	PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -v

override_dh_installchangelogs:
	# Keep the project release notes beside the native Debian changelog.
	dh_installchangelogs -XCHANGELOG.md

override_dh_builddeb:
	set -e; \
	for pkg in $$(dh_listpackages); do \
		build_dir="debian/$$pkg"; \
		tmp_dir=$$(mktemp -d); \
		cp -a "$$build_dir/." "$$tmp_dir/"; \
		if [ -d "$$tmp_dir/DEBIAN" ]; then \
			chmod 0755 "$$tmp_dir/DEBIAN"; \
			find "$$tmp_dir/DEBIAN" -type f -exec chmod 0644 {} +; \
		fi; \
		dpkg-deb --root-owner-group --build "$$tmp_dir" ..; \
		rm -rf "$$tmp_dir"; \
	done
