#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

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

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-DVERSION="$(DEB_VERSION_UPSTREAM)" \
		-DBUILD_UNIT_TESTS=OFF

# Upstream ships no manual pages for the two command line tools, so generate
# them from --help.  This needs to run the freshly built binaries and is
# therefore skipped when cross building.
override_dh_installman:
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
	LD_LIBRARY_PATH=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
		help2man --no-info --version-string="$(DEB_VERSION_UPSTREAM)" \
			--name="optical disc burning tool for DDE" \
			--output=debian/dfm-burner.1 \
			debian/tmp/usr/bin/dfm-burner
	LD_LIBRARY_PATH=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
		help2man --no-info --version-string="$(DEB_VERSION_UPSTREAM)" \
			--name="file search tool for DDE" \
			--output=debian/dfm-searcher.1 \
			debian/tmp/usr/bin/dfm-searcher
	dh_installman -p deepin-util-dfm-tools debian/dfm-burner.1 debian/dfm-searcher.1
endif
	dh_installman --remaining-packages
