#!/usr/bin/make -f

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

export QT_SELECT := qt5

# one ring to rule them all ...
%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_VERBOSE_MAKEFILE=1

override_dh_auto_build:
ifeq (,$(findstring $(DEB_HOST_ARCH),"arm64 powerpc"))
	# Don't regenerate icons on arm64, inkscape fails
	$(RM) $(CURDIR)/src/icons/16x16/*
	$(RM) $(CURDIR)/src/icons/32x32/*
	$(RM) $(CURDIR)/src/icons/48x48/*
	$(RM) $(CURDIR)/src/icons/cache/32x32/*
	$(RM) $(CURDIR)/src/icons/waypoints/32x32/*
	$(RM) $(CURDIR)/src/pics/compass.png

	cd $(CURDIR)/src/icons/ && bash makeicons
	cd $(CURDIR)/src/icons/cache/ && bash makeicons
	cd $(CURDIR)/src/icons/waypoints/ && bash makeicons
	inkscape -D -w 180 -h 180 $(CURDIR)/src/pics/compass.svg --export-png=$(CURDIR)/src/pics/compass.png
endif

	dh_auto_build

override_dh_install:
	dh_install --list-missing

override_dh_installchangelogs:
	dh_installchangelogs changelog.txt

