#!/usr/bin/make -f
PECL_NAME_OVERRIDE := xcache
PHP_DEFAULT_VERSION_OVERRIDE := 5.6
DH_PHP_VERSIONS_OVERRIDE := $(shell /usr/sbin/phpquery -V | grep -E "^5")
include /usr/share/dh-php/pkg-pecl.mk

DIR_TARGETS = $(addprefix build-,$(DH_PHP_VERSIONS))

$(warning CONFIGURE_TARGETS: $(CONFIGURE_TARGETS))
$(warning BUILD_TARGETS: $(BUILD_TARGETS))
$(warning INSTALL_TARGETS: $(INSTALL_TARGETS))

PECL_SOURCE=$(filter-out debian $(DIR_TARGETS),$(wildcard *))
$(foreach ver,$(DH_PHP_VERSIONS),$(eval PECL_SOURCE_$(ver) := $(PECL_SOURCE)))
$(foreach ver,$(DH_PHP_VERSIONS),$(mkdir build-$(ver)))

override_dh_testdir: $(DIR_TARGETS)
	dh_testdir

build-%:
	mkdir -p build-$(*)

PECL_CONFIGURE_MAINT_APPEND := \
	--enable-xcache=shared \
	--disable-xcache-constant  \
	--enable-xcache-optimizer \
	--enable-xcache-coverager \
	--enable-xcache-assembler \
	--enable-xcache-encoder   \
	--enable-xcache-decoder
