#!/usr/bin/make -f
# -*- makefile -*-
# This code is released under the BSD-3 Clause
# Created by Eric Maeker, 2012 - 2014
# Modified by Stefan Ahlers, 2016

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

QT_SELECT=qt5

# Enable multiarch builds & prepare qmake vars
include /usr/share/dpkg/architecture.mk


%:
	dh $@ -buildsystem qmake

override_dh_auto_configure:
	dh_auto_configure -- \
		-DBUILD_WITH_QT4=OFF \
		-DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH) \
		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
	cp NEWS.txt NEWS

override_dh_auto_build:
	dh_auto_build
	# build doc
	doxygen

override_dh_auto_clean:
	dh_auto_clean
	$(RM) -r doc
	$(RM) NEWS

override_dh_installchangelogs:
	dh_installchangelogs -k NEWS

override_dh_installdocs-indep:
	dh_installdocs -i
	find debian -name "*.md5" -delete

override_dh_install:
	dh_install
	cp -a obj-*/libquazip5.a debian/tmp/usr/lib/*/
	d-shlibmove --commit \
		--multiarch \
		--devunversioned \
		--exclude-la \
		--movedev "debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*.pc" "usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/" \
		--movedev "debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/cmake/QuaZip5/QuaZip5Config.cmake" "usr/share/quazip/" \
		debian/tmp/usr/lib/*/*.so

override_dh_missing:
	dh_missing --fail-missing
