#!/usr/bin/make -f

UPSTREAM := $(shell head -1 debian/changelog | sed 's/.*(//;s/-[^-]*).*//')

%:
	dh $@ --buildsystem=phppear --with phppear

override_dh_auto_configure:
	dh_auto_configure -O--buildsystem=phppear
	sed -i '/ role="doc" /d' */package.xml

override_dh_installchangelogs:
	dh_installchangelogs */CHANGELOG.md

override_dh_installman:
	mkdir -p $(CURDIR)/debian/tmp
	ln -s phing-* phing
	help2man --no-discard-stderr --no-info \
		--help-option=-h \
		--version-string=$(UPSTREAM) \
		--include=$(CURDIR)/debian/phing.1.in \
		"echo -n 'Usage: ' && php phing/bin/phing.php" \
		> $(CURDIR)/debian/tmp/phing.1
	dh_installman
