#!/usr/bin/make -f

export http_proxy = http://127.0.0.1:9
, := ,

%:
	dh $@ --with php

override_dh_auto_configure:
	protoc-c --c_out=. pinba.proto
	mv pinba.pb-c.c pinba-pb-c.c
	phpize
	dh_auto_configure

override_dh_auto_clean:
	dh_auto_clean
	phpize --clean
	rm -f pinba-pb-c.c
	rm -f pinba-pb-c.h
	rm -f protobuf-c*

override_dh_auto_install:
	dh_auto_install -- INSTALL_ROOT=$(CURDIR)/debian/php-pinba

PHP_VERSIONS := $(shell /usr/sbin/phpquery -V)
override_dh_gencontrol:
	dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -pinba$(,) ,$(PHP_VERSIONS)))"
