#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

BASEDIR=`pwd`/debian/aspell-hi
DICTLANG='hi'

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 -9 -c -n "$$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/hi.compat"
	installdeb-aspell

	# Remove u-deva.cmap and u-deva.cset as it conflict with libaspell
	rm -f $(BASEDIR)/usr/share/aspell/u-deva.*

%:
	dh $@
