#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/utils.mk

DEB_BUILD_PARALLEL = 1

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

# use the NEWS file as upstream ChangeLog...
DEB_DH_INSTALLCHANGELOGS_ARGS = NEWS
DEB_INSTALL_DOCS_ALL = README AUTHORS

DEB_DH_INSTALL_ARGS +=

DEB_CONFIGURE_SCRIPT := ./autogen.sh

DEB_CONFIGURE_EXTRA_FLAGS += \
                --disable-silent-rules \
                --libexecdir=/usr/lib/mate-applets \
                --localstatedir=/var \
                --disable-static

common-install-indep:: remove-cruft
common-install-arch:: remove-cruft
common-binary-post-install-arch:: list-missing

remove-cruft::
	rm -rfv debian/*/usr/lib/python*/dist-packages/mate_invest/*.pyc
	rm -rfv debian/*/usr/lib/python*/dist-packages/mate_invest/*.pyo

	# applets have been moved to <PREFIX>/lib/mate-applets/ (and renamed) since 1.24.0
	rm -fv  debian/*/usr/share/man/man1/mate-charpick-applet.1*
	rm -fv  debian/*/usr/share/man/man1/mate-drivemount-applet.1*
	rm -fv  debian/*/usr/share/man/man1/mate-geyes-applet.1*
	rm -fv  debian/*/usr/share/man/man1/mate-multiload-applet.1*
	rm -fv  debian/*/usr/share/man/man1/mateweather.1*

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
