#! /usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

PY2VERS=$(shell pyversions -vr)
PY3VERS=$(shell py3versions -vr)

override_dh_auto_configure:
	dh_auto_configure -- --with-perl-installdirs=vendor --enable-gtk-doc --enable-easy-bindings --with-swig

override_dh_auto_build: build-core $(PY2VERS:%=build-python%) $(PY3VERS:%=build-python%)

build-core:
	dh_auto_build

build-python%:
	cd bindings/python && python$* setup.py build

override_dh_auto_install:
	dh_auto_install
	find . -name "*.la" -exec sed -i -e 's/^dependency_libs=.*$$/dependency_libs=/g' {} +

override_dh_python2:
	dh_python2 -ppython-prelude

override_dh_python3:
	dh_python3 -ppython3-prelude

%:
	dh $@ --with=python2,python3,autoreconf,ruby
