#!/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  debian/rabbit/usr/bin/rabrick
	(cd debian/rabbit/usr/lib/ruby/vendor_ruby/rabbit/div && \
		rm -f prototype.js &&  \
		ln -s ../../../../../share/javascript/prototype/prototype.js .)
	rm -f debian/rabbit/usr/bin/rabbirack
	rm -f debian/rabbit/usr/bin/rabbiter
	rm -f debian/rabbit/usr/bin/rabwii

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="Theme browser for Rabbit" \
		--section=1 --manual="rabbit-theme-manager" --no-info \
		"/usr/bin/ruby -Ilib bin/rabbit-theme-manager"  --version-string=${VERSION} \
		> debian/rabbit-theme-manager.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

# ## backup for futrue...
# # create_man::
# # 	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-manager --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

