#!/usr/bin/make -f
#export DH_VERBOSE=1
#
# Uncomment to ignore all test failures (but the tests will run anyway)
#export DH_RUBY_IGNORE_TESTS=all
#
# Uncomment to ignore some test failures (but the tests will run anyway).
# Valid values:
#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
#
# If you need to specify the .gemspec (eg there is more than one)
#export DH_RUBY_GEMSPEC=gem.gemspec

DISABLED_PLUGINS = shortenurls dictclient


%:
	dh $@ --buildsystem=ruby --with ruby

override_dh_auto_build:
	dh_auto_build
	rake makemo
	rake manpages
	rdoc -a -t 'rbot - The Ruby IRC bot' -f darkfish -m README.rdoc -o build-doc/rdoc README.rdoc lib
	rm -f build-doc/rdoc/js/jquery.js
	ln -s /usr/share/javascript/jquery/jquery.js build-doc/rdoc/js/jquery.js

override_dh_install:
	dh_install
	# disabled plugins
	for PL in $(DISABLED_PLUGINS); do \
		mv debian/rbot/usr/share/rbot/plugins/$${PL}.rb \
			debian/rbot/usr/share/rbot/plugins/$${PL}.rb.disabled; \
	done
	# a few plugins have wrong permissions
	chmod a-x debian/rbot/usr/share/rbot/plugins/*.rb

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build-doc
	# dirty buildsys
	rm -rf data/locale
	rm -f man/*.1
	rm -f lib/rbot/pkgconfig.rb

