#!/usr/bin/make -f

PHPAPI := $(shell php-config --phpapi)
PYTHON_SITEARCH := $(shell python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib(1)')

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_LDFLAGS_MAINT_APPEND="-Wl,--as-needed"

%:
	dh $@ --parallel --with python2

override_dh_gencontrol:
	echo "php:Depends=phpapi-${PHPAPI}" >> debian/php-kolabformat.substvars
	dh_gencontrol

override_dh_auto_configure:
	dh_auto_configure -- \
		-DPHP_BINDINGS=ON \
		-DPYTHON_BINDINGS=ON \
		-DPYTHON_INSTALL_DIR=$(PYTHON_SITEARCH)

override_dh_install:
	dh_install --fail-missing
