#!/usr/bin/make -f

# In order to regenerate 'debian/control' :
#   DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean
# Then check manually if everything's ok

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/ruby-pkg-tools/1/class/ruby-setup-rb.mk

DEB_RUBY_CONFIG_ARGS += --shebang=never
MANPAGES := debian/rbot.1 debian/rbot-remote.1


build/rbot:: $(MANPAGES)

%.1: %.xml
	xsltproc -nonet -o $@ /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl $<

install/rbot::
	# figlet is non-free, that's why this package would not recommend such a nasty program in any way
	rm debian/rbot/usr/share/rbot/plugins/figlet.rb
	# disabled plugins
	for PL in shortenurls dictclient; do \
		mv debian/rbot/usr/share/rbot/plugins/$${PL}.rb debian/rbot/usr/share/rbot/plugins/$${PL}.rb.disabled; \
	done

	# Ubuntu: remove empty .po and .pot files as pkgstriptranslations doesn't like them
	find po -empty -delete

binary-install/rbot::
	dh_installman -prbot $(MANPAGES)

clean:: 
	rm -f $(MANPAGES)
	# buildsys fix
	rm -f lib/rbot/pkgconfig.rb

