#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
export PYBUILD_NAME=pysvn

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie


DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

PYVERS	:= $(shell pyversions -vr debian/control)
APR_INC	= $(strip $(shell apr-config --includes | sed 's/-I//'))

CONFIG_OPTS = --pycxx-src-dir=/usr/share/python${PYVERS}/CXX \
	      --pycxx-dir=/usr/share/python${PYVERS}/CXX \
	      --svn-lib-dir=/usr/lib/$(DEB_HOST_MULTIARCH) \
              --apr-inc-dir=$(APR_INC) \
              --apu-inc-dir=$(APR_INC) \
	      --apr-lib-dir=/usr/lib/$(DEB_HOST_MULTIARCH) \
              --norpath \
              --platform=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

%:
	dh $@ --with=python2 --buildsystem=pybuild

override_dh_auto_configure:
	cd $(CURDIR)/Source; python setup.py configure $(CONFIG_OPTS)

override_dh_auto_build:
	$(MAKE) -C $(CURDIR)/Source

override_dh_strip:
	dh_strip --dbg-package=python-svn-dbg

override_dh_installdocs:
	dh_installdocs --link-doc=python-svn
