#!/usr/bin/make -f

USRDIR   := $(CURDIR)/debian/php-doctrine-dbal/usr
UPSTREAM := $(shell head -1 debian/changelog | sed 's/.*(//;s/-.?*).*//')


%:
	dh $@ --with phpcomposer -XREADME.markdown

override_dh_installman:
	mkdir $(CURDIR)/debian/tmp
	cd $(USRDIR)/share/php && \
		help2man --help-option=\  --version-string=$(UPSTREAM) --no-info \
		--name='Doctrine DBAL command line interface' \
		"echo -n 'Usage: php-doctrine-dbal' && $(USRDIR)/bin/doctrine-dbal|tail -n18" \
		| sed 's/USAGE:/PHP-DOCTRINE-DBAL/;s/Usage:/php-doctrine-dbal/;s/|tail\( -n18\)\?//gi' \
		> $(CURDIR)/debian/tmp/doctrine-dbal.1
	dh_installman

override_dh_fixperms:
	dh_fixperms -X.php

override_dh_installchangelogs:
	dh_installchangelogs debian/upstream/changelog

get-orig-source:
	uscan --force --verbose --rename
