#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CXXFLAGS_MAINT_APPEND= -fPIC
export QT_SELECT=5

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

# --with bash-completion

override_dh_auto_configure:
	dh_auto_configure -- \
            --disable-bench \
            --disable-ccache \
            --disable-hardening \
            --disable-shared \
            --disable-silent-rules \
            --disable-static \
            --disable-util-tx \
            --with-incompatible-bdb \
            --with-gui=qt5 \
        ;
## "--disable-hardening" disables upstream's hardening that overrides build
## flags -- in particular it drops "-fPIC" which leads to FTBFS with GCC-5
## (see #777983)

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

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