#!/usr/bin/make -f

include /usr/share/quilt/quilt.make
D=$(CURDIR)/debian/irssi-scripts

build: $(QUILT_STAMPFN)

clean: unpatch
	dh_testdir
	dh_clean update-scripts.log .missinglist .scriptlist .packagedlist INDEX.scripts.irssi.org .to_dch .knownlist .scripts.irssi.org .orig-description-list .descriptions .tmp

install: build
	dh_testdir
	dh_clean -k
	install -d $D/usr/share/irssi/scripts/
	for s in scripts/*.pl ; do \
	  install -m 644 "$$s" $D/usr/share/irssi/scripts/`basename $$s` || exit 1 ; \
	done
	# log2ansi.pl will run outside irssi, so it needs the executable bit
	chmod +x $D/usr/share/irssi/scripts/log2ansi.pl
	# xmmsinfo
	install -d $D/usr/share/perl5/Irssi
	install -m 644 scripts/XMMSInfo.pm $D/usr/share/perl5/Irssi
	install -D -m 644 $(CURDIR)/debian/overrides $D/usr/share/lintian/overrides/irssi-scripts

binary binary-indep: install
	dh_testdir
	dh_testroot
	dh_link
	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:

update-date:
	dch --newversion $(shell date +%Y%m%d) ""

.PHONY: build clean binary-indep binary-arch binary install update-date
