#!/usr/bin/make -f

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

DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')

override_dh_link:
	dh_link -O--buildsystem=phppear
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	chmod +x ./debian/tests_run
	./debian/tests_run
endif


get-orig-source:
	wget http://download.pear.php.net/package/DB-${DEB_UPSTREAM_VERSION}.tgz -O php-db_${DEB_UPSTREAM_VERSION}.orig.tar.gz
