summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: c710ad64f5e36b93573cc02ed9d7f18ef98a07ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/make -f
#export DH_VERBOSE=1

define rename_hunspell_files
cd $(CURDIR)/debian/hunspell-$(strip $(1))/usr/share/hunspell; \
mv -v $(strip $(2)).aff $(strip $(3)).aff; mv $(strip $(2)).dic $(strip $(3)).dic
endef

define rename_hyphen_files
cd $(CURDIR)/debian/hyphen-$(strip $(1))/usr/share/hyphen; \
mv -v hyph_$(strip $(2)).dic hyph_$(strip $(3)).dic
endef

define rename_mythes_files
cd $(CURDIR)/debian/mythes-$(strip $(1))/usr/share/mythes; \
mv -v $(strip $(2)).dat $(strip $(3)).dat; mv $(strip $(2)).idx $(strip $(3)).idx
endef

define link_hyphen
dh_link -phyphen-$(strip $(1)) usr/share/hyphen/hyph_$(strip $(3)).dic usr/share/hyphen/hyph_$(strip $(2)).dic
endef

include debian/rules.install

%:
	dh $@

execute_before_dh_auto_build:
	# make sure we don't overwrite a past backup
	[ ! -f dictionaries/cs_CZ/thes_cs_CZ.dat.BAK ]
	cd dictionaries/cs_CZ && \
		mv thes_cs_CZ.dat thes_cs_CZ.dat.BAK
	cd dictionaries/cs_CZ/thesaurus && \
		./dictionary-to-thesaurus.py en-cs.txt blacklist.txt > ../thes_cs_CZ.dat
	for dat in `find dictionaries -type f -name "*.dat"`; do \
		/usr/share/mythes/th_gen_idx.pl -o $${dat%dat}idx < $${dat}; \
	done

execute_before_dh_install: install_files

execute_after_dh_install:
	$(call rename_hunspell_files,  gug, gug,           gug_PY )
	$(call rename_hunspell_files,  is,  is,            is_IS )
	$(call rename_hunspell_files,  lt,  lt,            lt_LT )
	$(call rename_hunspell_files,  sr,  sr,            sr_RS )
	$(call rename_hunspell_files,  sr,  sr-Latn,       sr_Latn_RS )

	$(call rename_hyphen_files,    ca,  ca,            ca_ES )
	$(call rename_hyphen_files,    es,  es,            es_ES )
	$(call rename_hyphen_files,    gl,  gl,            gl_ES )
	$(call rename_hyphen_files,    is,  is,            is_IS )
	$(call rename_hyphen_files,    lt,  lt,            lt_LT )
	$(call rename_hyphen_files,    sr,  sr,            sr_RS )
	$(call rename_hyphen_files,    sr,  sr-Latn,       sr-Latn_RS )
	$(call rename_hyphen_files,    sv,  sv,            sv_SE )

	$(call rename_mythes_files,    ar,     th_ar,         th_ar_EG_v2 )
	$(call rename_mythes_files,    cs,     thes_cs_CZ,    th_cs_CZ_v2 )
	$(call rename_mythes_files,    es,     th_es_v2,      th_es_ES_v2 )
	$(call rename_mythes_files,    gl,     thesaurus_gl,  th_gl_ES_v2 )
	$(call rename_mythes_files,    gug,    th_gug_PY,     th_gug_PY_v2 )
	$(call rename_mythes_files,    is,     th_is,         th_is_IS_v2 )
	$(call rename_mythes_files,    pt-pt,  th_pt_PT,   th_pt_PT_v2 )
	$(call rename_mythes_files,    sv,     th_sv_SE,      th_sv_SE_v2 )
	$(call rename_mythes_files,    uk,     th_uk_UA,      th_uk_UA_v2 )
	$(call rename_mythes_files,    ru,     th_ru_RU_M_aot_and_v2,      th_ru_RU_v2 )

	# here are only links doing "xx → xx_XX", more links are done with
	# .links files as well.
	$(call link_hyphen, af,    af,         af_ZA )
	$(call link_hyphen, cs,    cs,         cs_CZ )
	$(call link_hyphen, da,    da,         da_DK )
	$(call link_hyphen, de,    de,         de_DE )
	$(call link_hyphen, el,    el,         el_GR )
	$(call link_hyphen, en-gb, en_Latn_GB, en_GB )
	$(call link_hyphen, hr,    hr,         hr_HR )
	$(call link_hyphen, hu,    hu,         hu_HU )
	$(call link_hyphen, it,    it,         it_IT )
	$(call link_hyphen, lt,    lt,         lt_LT )
	$(call link_hyphen, nl,    nl,         nl_NL )
	$(call link_hyphen, pt-br, pt_Latn_BR, pt_BR )
	$(call link_hyphen, pt-pt, pt,         pt_PT )
	$(call link_hyphen, pt-pt, pt_Latn_PT, pt_PT )
	$(call link_hyphen, ro,    ro,         ro_RO )
	$(call link_hyphen, sk,    sk,         sk_SK )
	$(call link_hyphen, sl,    sl,         sl_SI )
	$(call link_hyphen, uk,    uk,         uk_UA )
	$(call link_hyphen, zu,    zu,         zu_ZA )


execute_before_dh_clean:
	find dictionaries/ -type f -name '*.idx' -delete
	cd dictionaries/cs_CZ && \
		[ ! -f thes_cs_CZ.dat.BAK ] || \
		mv -v thes_cs_CZ.dat.BAK thes_cs_CZ.dat

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog-dictionaries