#!/usr/bin/make -f

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

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON

override_dh_installman: debian/emf2svg-conv.1
	dh_installman

debian/emf2svg-conv.1:
	help2man 'perl -e '\''my $$f; while (<>) { $$f = 1 if /^Usage: /; exit if $$f && /^#/; print if $$f }'\'' README.md' \
		--version-string $(DEB_VERSION_UPSTREAM) --name 'Enhanced Metafile to SVG converter' \
		--no-info > $@
	sed -i 's/.TH ;/.TH emf2svg-conv/' $@
	sed -i 's/; print if \$$f }'\'' README.md/emf2svg-conv/' $@
