#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
export QT_SELECT := qt5

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

# To enable test-suite build-depend on libgtest-dev and uncomment these lines
###override_dh_auto_configure:
###	cp -a /usr/src/gtest local-gtest && \
###		mkdir local-gtest/debian local-gtest/include && \
###		cp -a debian/compat debian/control local-gtest/debian && \
###		cd local-gtest && \
###		dh_auto_configure --verbose && \
###		dh_auto_build --verbose && \
###		ln -s /usr/include/gtest include/ && \
###		ln -s obj-* lib
###
###	dh_auto_configure --verbose -- -DGTEST_ROOT=$(CURDIR)/local-gtest

override_dh_auto_build:
	# Normal auto_build:
	dh_auto_build --verbose
	# Build the minimal manpage:
	pod2man --center='Minimal luminance-hdr manpage' \
		--release=$(DEB_VERSION_UPSTREAM) \
		debian/luminance-hdr.pod > debian/luminance-hdr.1

override_dh_auto_install:
	dh_auto_install --verbose
	# Remove unneeded files
	cd debian/luminance-hdr/usr/share/doc/luminance-hdr/ && \
		rm -v AUTHORS LICENSE README.md Changelog

built-using-cmdline = dpkg-query \
	-f='$${source:Package} (= $${source:Version})' -W libeigen3-dev

override_dh_gencontrol:
	dh_gencontrol -- \
		-Vlibeigen3-dev:Built-Using='$(shell $(built-using-cmdline))'


%:
	dh $@
