#!/usr/bin/make -f
%:
	dh $@ --with phpcomposer

override_dh_auto_build override_dh_auto_clean:

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	phpunit
else
	@echo "** tests disabled"
endif

override_dh_install:
	dh_install
	sed -i s,@data_dir@,/usr/share/php/data, debian/phpmd/usr/share/php/PHPMD/RuleSetFactory.php
	sed -i s,@package_version@,workaround,	 debian/phpmd/usr/bin/phpmd

override_dh_installman:
	mkdir $(CURDIR)/debian/tmp
	cd debian/phpmd/usr/share/php && \
        help2man --no-info --no-discard-stderr \
        --name='PHPMD command line interface' \
        ../../bin/phpmd \
        > $(CURDIR)/debian/tmp/phpmd.1
	dh_installman

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