#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export QT_SELECT=5

%:
	dh $@ --parallel --with autoreconf
# --with bash-completion

override_dh_auto_configure:
	dh_auto_configure -- \
            --disable-silent-rules \
            --disable-shared \
            --disable-static \
            --disable-ccache \
            --with-incompatible-bdb \
            --with-gui=qt5 \
            

override_dh_auto_build:
	dh_auto_build --parallel
	## build menu and icons
	convert src/qt/res/icons/bitcoin.png -resize 32x32 $(CURDIR)/debian/litecoin.xpm
	convert src/qt/res/icons/bitcoin.png -resize 64x64 +set date:create +set date:modify -define png:exclude-chunk=time $(CURDIR)/debian/litecoin.png
	desktop2menu debian/litecoin-qt.desktop litecoin-qt > debian/litecoin-qt.menu

override_dh_auto_test:
	## Set $HOME to debian/tmp since buildd do not have RW permission to /home/buildd.
	HOME=$(CURDIR)/debian/tmp dh_auto_test

override_dh_installchangelogs:
	dh_installchangelogs doc/release-notes-litecoin.md

DPATH := $(abspath $(dir $(MAKEFILE_LIST)))
VER ?= $(shell dpkg-parsechangelog -l$(DPATH)/changelog | perl -ne 'print $$1 if m{Version:\s*([\d\.]+[a-z]?)}')
.PHONY: get-orig-source
get-orig-source:
	@echo "# Downloading..."
	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(DPATH)
