#!/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_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export QT_SELECT := 5

include /usr/share/dpkg/pkg-info.mk

JAVA_HOME=/usr/lib/jvm/default-java
CLASSPATH=.

%:
	dh $@ --with javahelper

# update translation files before build
override_dh_auto_build:
	lrelease NixNote2.pro
	dh_auto_build

# build java jar file from source, discard upstream jar file
override_jh_build:
	jh_build -N --main=cx.fbn.encrypt.Crypto --javacopts="-source 1.6 -target 1.6"

# set prefix during configure
override_dh_auto_configure:
	dh_auto_configure PREFIX=/usr --

# handle changelog.txt manually since dh_installchangelogs won't do
# that automatically
override_dh_installchangelogs:
	dh_installchangelogs changelog.txt

override_dh_clean:
	dh_clean install translations/*.qm

# pdf document really don't need compression
override_dh_compress:
	dh_compress -X.pdf

# upstream qmake instruction is really poor,
# handle install manually using *.install file
override_dh_auto_install:

# never install ts translation file
override_dh_install:
	dh_install -X*.ts

# replace __VERSION__ placeholder with source version name
override_dh_installdocs:
	dh_installdocs
	find debian/$(DEB_SOURCE)/ -type f -exec sed -i 's/__VERSION__/$(DEB_VERSION)/g' {} + || true
