#!/usr/bin/make -f
# [debian/rules] for myspell-lv
#
# COPYRIGHT © 2007-2011 Martin-Éric Racine <martin-eric.racine@iki.fi>
#
# LICENSE
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License or (at
# your option) any later version.
#
%:
	dh $@

DEB_INSTALL_CHANGELOGS_ALL := Changelog.txt
ILANGUAGE=latvian
LANG_COUNTRY=lv_LV
DICT_LANG=lv

override_dh_auto_build:
	## Keep upstream myspell dictionary as-is.
	## Generate aspell dictionary.
	# build-depends on aspell because of prezip.
	cp $(LANG_COUNTRY).aff $(DICT_LANG)_affix.dat
	cat $(LANG_COUNTRY).dic | sed 1d | prezip > $(DICT_LANG).cwl
	gzip -n $(DICT_LANG).cwl
	echo "add $(DICT_LANG).rws" > $(DICT_LANG).multi
	echo "add $(DICT_LANG).multi" > $(ILANGUAGE).alias

override_dh_auto_clean:
	# Clean myspell files (nothing to clean).
	# Clean aspell files.
	rm -f *.alias *_affix.dat *.compat *.multi *.rws *.*wl*

override_dh_auto_install:
	installdeb-hunspell --package=myspell-$(DICT_LANG)
	installdeb-myspell --package=myspell-$(DICT_LANG)
	installdeb-aspell --package=aspell-$(DICT_LANG)
#EOF
