#!/usr/bin/make -f

VERSION := $(shell dpkg-parsechangelog|grep ^Version:|sed 's/^Version: //' | sed 's/-.*$$//g')
%:
	dh $@ --buildsystem ruby --with ruby

override_dh_auto_install:
	dh_auto_install
	rm -f $(CURDIR)/debian/rabbit/usr/bin/rabbit-slide
	rm -f $(CURDIR)/debian/rabbit/usr/bin/rabbit-theme

override_dh_installdocs:
	dh_installdocs
	( cd debian/rabbit/usr/share/doc/rabbit/doc/javascripts/ && \
	  rm -f jquery.js && \
	  ln -s ../../../../../share/javascript/jquery/jquery.js . )

override_dh_fixperms:
	dh_fixperms
	chmod 644 debian/rabbit/usr/share/rabbit/image/nari-images/property.rb

create_man::
	help2man \
		--name="presentation tool using RD, simple text format" \
		--section=1 --manual="rabbit" --no-info \
		"/usr/bin/ruby -Ilib bin/rabbit"  --version-string=${VERSION} \
		> debian/rabbit.1
	help2man \
		--name="commandline utility for Rabbit" \
		--section=1 --manual="rabbit-command" --no-info \
		"/usr/bin/ruby -Ilib bin/rabbit-command"  --version-string=${VERSION} \
		> debian/rabbit-command.1
	help2man \
		--name="IRC interface for Rabbit" \
		--section=1 --manual="rabbirc" --no-info \
		"/usr/bin/ruby -Ilib bin/rabbirc" --version-string=${VERSION} \
		> debian/rabbirc.1
# # 	LC_ALL=C ruby1.8 -Ilib bin/rabbit --roff --locale-dir data/locale > debian/rabbit.1
# # 	LC_ALL=C ruby1.8 -Ilib bin/rabbit-theme --roff --locale-dir data/locale > debian/rabbit-theme-manager.1
# # 	LC_ALL=C ruby1.8 -Ilib bin/rabbit-command --roff --locale-dir data/locale > debian/rabbit-command.1

