#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

PACKAGE = perroquet
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl
XP     = xsltproc --nonet --param man.charmap.use.subset "0"

%:
	dh $@ --with python2

override_dh_clean:
	rm -rf build
	find . -name "*.pyc" -exec rm {} \;
	rm -f debian/perroquet.1
	dh_clean

override_dh_auto_build: debian/perroquet.1
	python setup.py build

debian/perroquet.1: debian/manpage.xml
	cd debian; $(XP) $(DB2MAN) manpage.xml



override_dh_auto_install:
	dh_auto_install
	# remove cache files for MIME if they are built
	for f in XMLnamespaces aliases generic-icons globs globs2 icons \
	  magic mime.cache subclasses treemagic types; do \
	  rm -f $(CURDIR)/debian/$(PACKAGE)/usr/share/mime/$$f; \
	done
	# remove cache files for the icons
	rm -f $(CURDIR)/debian/$(PACKAGE)/usr/share/icons/hicolor/icon-theme.cache