#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
BASEDIR=`pwd`/debian/aspell-kn
DICT_LANG=kn

override_dh_auto_configure:
	./configure

override_dh_md5sums:
		dh_md5sums -Xvar/lib/aspell

override_dh_install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	for f in *.cwl; do \
		gzip -n -9 -c "$$f" > "$(BASEDIR)/usr/share/aspell/"$$f".gz"; \
		WL=`echo "$$f" | sed 's/\.cwl$$//'`; \
		touch "$(BASEDIR)/var/lib/aspell/$$WL.rws"; \
		dh_link "var/lib/aspell/$$WL.rws" "usr/lib/aspell/$$WL.rws"; \
		echo "$$WL" >> "$(BASEDIR)/usr/share/aspell/$(DICT_LANG).contents"; \
	done
	touch $(BASEDIR)/var/lib/aspell/$(DICT_LANG).compat
	installdeb-aspell
%:
	dh $@