#!/usr/bin/make -f

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

# This has to be exported to make some magic below work.
export DH_OPTIONS=

# Avoid some error messages when running "make install"
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1

# Hack for Gnucash build system
export BUILDING_FROM_SVN=false

%:
	dh $@ --with python2

override_dh_auto_clean:
	find . -type l -exec rm -v \{\} \;
	rm -fv debian/gnucash-icon-32x32.xpm
	dh_auto_clean

override_dh_auto_configure:
	dh_auto_configure -- \
		--libdir=/usr/lib/gnucash \
		--libexecdir=/usr/lib \
		--infodir=/noinst \
		--mandir=/noinst \
		--docdir=/noinst \
		--with-gconf-schema-file-dir=/usr/share/gconf/schemas \
		--with-html-engine=webkit \
		--disable-static \
		--enable-debug \
		--enable-dbi \
		--enable-ofx \
		--enable-aqbanking \
		--enable-locale-specific-tax \
		--enable-python-bindings

override_dh_install:
	convert src/pixmaps/gnucash-icon-32x32.png debian/gnucash-icon-32x32.xpm
	find debian/tmp/usr/lib -name \*.la -exec rm -v \{\} \;
	dh_install

override_dh_auto_test:

override_dh_strip:
	dh_strip --dbg-package=gnucash-dbg

override_dh_python2:
	dh_python2 --no-guessing-versions -V $(shell pyversions -dv)

BINARY_VERSION := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')

override_dh_makeshlibs:
	dh_makeshlibs --version-info="gnucash (= ${BINARY_VERSION})"
