#!/usr/bin/make -f

# one ring to rule them all ...

upstream_version ?= $(shell dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)(\+repack\d+)?.*$$/\1/p')
dfsg_version = $(upstream_version)+ds1
pkg = $(shell dpkg-parsechangelog | sed -ne 's/^Source: //p')

export QT_SELECT := qt5

%:
	dh $@

override_dh_installchangelogs:
	dh_installchangelogs changelog.txt

override_dh_auto_build:
	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
	dh_auto_build

override_dh_auto_install:
	dh_auto_install
	install -m 644 $(CURDIR)/debian/*.xpm $(CURDIR)/debian/qmapshack/usr/share/pixmaps/


# get-orig-source to drop upstream .hg dir
get-orig-source:
# When this bug will be fixed uscan will be used again
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749225
	wget https://bitbucket.org/maproom/qmapshack/downloads/$(pkg)-$(upstream_version).tar.gz -O $(pkg)_$(upstream_version).orig.tar.gz
