#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/gnome.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

libdevhelp-2-N := $(shell sed -rn 's/^Package:[[:space:]]*(libdevhelp-2-[0-9]+)[[:space:]]*$$/\1/p' debian/control)

DEB_DH_MAKESHLIBS_ARGS_ALL += -V '$(libdevhelp-2-N) (>= 2.30)'

X_TOOLS += misc/devhelp.vim \
	misc/html2funcs.py \
	misc/html2xml.py \
	misc/man2xml.py

clean::
	rm -f debian/devhelp.emacsen-startup
	rm -f src/dh-marshal.h

binary-install/devhelp-common::
	dh_pysupport -p$(cdbs_curpkg) /usr/lib/gedit-2/plugins/devhelp

binary-post-install/devhelp::
	install -d `pwd`/debian/devhelp/usr/share/pixmaps/
	install -m 644 debian/devhelp-debian.xpm \
		`pwd`/debian/devhelp/usr/share/pixmaps/
	install -d `pwd`/debian/devhelp/usr/share/doc/devhelp/tools/
	install -m 644 $(X_TOOLS) \
		`pwd`/debian/devhelp/usr/share/doc/devhelp/tools/

pre-build::
	cp misc/devhelp.el debian/devhelp.emacsen-startup
