#!/usr/bin/make -f

export PYBUILD_NAME=portprotonqt
export DEB_BUILD_OPTIONS=nocheck
export DH_VERBOSE=1

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_install:
	dh_install
	# Create necessary directories
	mkdir -p debian/python3-portprotonqt/usr/lib/udev/rules.d
	mkdir -p debian/python3-portprotonqt/usr/share/applications
	mkdir -p debian/python3-portprotonqt/usr/share/bash-completion/completions
	mkdir -p debian/python3-portprotonqt/usr/share/icons/hicolor/scalable/apps
	mkdir -p debian/python3-portprotonqt/usr/share/metainfo
	# Copy additional files from build-aux/usr (if they exist)
	if [ -d "$(CURDIR)/build-aux/usr/lib/udev/rules.d" ]; then \
		cp -r $(CURDIR)/build-aux/usr/lib/udev/rules.d/* debian/python3-portprotonqt/usr/lib/udev/rules.d/ || true; \
	fi
	if [ -d "$(CURDIR)/build-aux/usr/share/applications" ]; then \
		cp -r $(CURDIR)/build-aux/usr/share/applications/* debian/python3-portprotonqt/usr/share/applications/ || true; \
	fi
	if [ -d "$(CURDIR)/build-aux/usr/share/bash-completion/completions" ]; then \
		cp -r $(CURDIR)/build-aux/usr/share/bash-completion/completions/* debian/python3-portprotonqt/usr/share/bash-completion/completions/ || true; \
	fi
	if [ -d "$(CURDIR)/build-aux/usr/share/icons/hicolor/scalable/apps" ]; then \
		cp -r $(CURDIR)/build-aux/usr/share/icons/hicolor/scalable/apps/* debian/python3-portprotonqt/usr/share/icons/hicolor/scalable/apps/ || true; \
	fi
	if [ -d "$(CURDIR)/build-aux/usr/share/metainfo" ]; then \
		cp -r $(CURDIR)/build-aux/usr/share/metainfo/* debian/python3-portprotonqt/usr/share/metainfo/ || true; \
	fi
