-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
289 lines (216 loc) · 10.3 KB
/
Makefile
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
dictdir=`aspell config dict-dir`
datadir=`aspell config data-dir`
VERSION=$(shell cat ./VERSION)
#ISPELLDIR = /usr/lib/ispell
ISPELLDIR = $(shell ispell -d stupidd 2>&1 | sed "s/^[^/]*(\/.*\/)stupidd.*$/\1/")
#MYSPELLDIR = /usr/share/dict/ooo
#MYSPELLDIR = /usr/share/myspell/dicts
MYSPELLDIR=`bin/find_myspell_dir.sh`
DIST = dist
ASPELL_DIST = $(DIST)/aspell-uk-$(VERSION)
ASPELL_DOC_DIR = /usr/share/doc/aspell-uk-$(VERSION)
ISPELL_DIST = $(DIST)/ispell-uk-$(VERSION)
ISPELL_DOC_DIR = /usr/share/doc/ispell-uk-$(VERSION)
MYSPELL_DIST = $(DIST)/myspell-uk-$(VERSION)
MYSPELL_DICT_LST = $(PREFIX)$(MYSPELLDIR)/dictionary.lst
MYSPELL_DOC_DIR = /usr/share/doc/ispell-uk_UA-$(VERSION)
XPI_DIST = $(DIST)/mozilla-xpi-uk-$(VERSION)
OXT_DIST = $(DIST)/openoffice.org-uk-$(VERSION)
UPDATE_VERSION=sed -r "s/@VERSION@/$(VERSION)/g"
#TODO: created this dirs only for particular target
$(shell mkdir -p $(ASPELL_DIST))
$(shell mkdir -p $(ISPELL_DIST))
$(shell mkdir -p $(MYSPELL_DIST))
$(shell mkdir -p $(XPI_DIST)/dictionaries)
$(shell mkdir -p $(OXT_DIST))
KOI8U_SET = src/aspell/koi8-u-nl.cset
KOI8U_MAP = src/aspell/koi8-u-nl.cmap
wordlist_src = src/Dictionary/uk_words.out
affixfile_src = src/Affix/uk_affix.dat
CLEANFILES = uk.rws uk.cwl uk.cwl.gz uk_words.out uk_affix.dat *.bak uk.dat
CLEANFILES += uk.aff uk.dic tmp.header
CLEANFILES += ukrainian.aff ukrainian.hash uk_words.enc uk_words.enc.cnt uk_words.enc.stat ukrainian
CLEANFILES += aspell-uk-*.tgz myspell_uk_UA-*.zip ispell-uk-*.tgz
CLEANFILES += spell*.tgz dist/*.oxt
CLEANDIRS = aspell-uk-* ispell-uk-* dist/*spell* dist/*mozilla* dist/*office*
iconv = iconv
include encodings.inc
default: myspell
all: aspell myspell mozilla-xpi ooo
packages: aspell-rpm myspell-rpm myspell-zip mozilla-xpi ooo
install: install-aspell
install-all: install-aspell install-myspell
#
# aspell rules
#
#aspell: $(ASPELL_DIST)/uk.rws $(ASPELL_DIST)/uk_affix.dat $(ASPELL_DIST)/uk.dat uk.multi ukrainian.alias $(ASPELL_DIST)/ukrainian.kbd
aspell: $(ASPELL_DIST)/uk.rws $(ASPELL_DIST)/uk.dat src/aspell/uk.multi src/aspell/ukrainian.alias $(ASPELL_DIST)/ukrainian.kbd
echo "aspell is not actively maintained any more, please switch to hunspell"
cp -u src/aspell/uk.multi src/aspell/ukrainian.alias $(ASPELL_DIST)
$(ASPELL_DIST)/uk_repl.dat:
cp -u src/aspell/uk_repl.dat $(ASPELL_DIST)
affix-dir:
$(MAKE) -C src/Affix
dictionary-dir:
$(MAKE) -C src/Dictionary
aspell-tar: $(DIST)/aspell-uk-$(VERSION).tgz
$(DIST)/aspell-uk-$(VERSION).tgz: aspell
mkdir -p $(ASPELL_DIST)/doc $(ASPELL_DIST)/misc
cp -u README Copyright $(ASPELL_DIST)
cp -u README.uk COPYING.* TODO $(ASPELL_DIST)/doc
cp -u src/aspell/aspell.net/misc/*.txt $(ASPELL_DIST)/misc
tar cCvfz $(DIST) --owner=root --group=root $@ aspell-uk-$(VERSION)
aspell-rpm: srctar
bin/make_rpm.sh aspell-uk $(VERSION)
install-aspell-dict: aspell
install -m 0755 -d $(PREFIX)$(datadir) $(PREFIX)$(dictdir)
install -m 0644 $(KOI8U_SET) $(KOI8U_MAP) $(PREFIX)$(dictdir)
install -m 0644 $(ASPELL_DIST)/uk.dat $(PREFIX)$(datadir)
install -m 0644 $(ASPELL_DIST)/uk.rws $(ASPELL_DIST)/uk.multi $(ASPELL_DIST)/uk_affix.dat $(ASPELL_DIST)/ukrainian.alias $(ASPELL_DIST)/ukrainian.kbd $(PREFIX)$(dictdir)
install-aspell: install-aspell-dict
install -m 0755 -d $(PREFIX)$(ASPELL_DOC_DIR)
install -m 0644 README README.uk Copyright COPYING.* TODO $(PREFIX)$(ASPELL_DOC_DIR)
# dependecies for aspell
uk.cwl: $(wordlist_src)
$(iconv) -f $(SOURCE_ENC) -t $(ASPELL_ENC) < $(wordlist_src) | LC_COLLATE=C sort | LC_COLLATE=C word-list-compress c > uk.cwl
uk.cwl.gz: uk.cwl
gzip -9 < uk.cwl > uk.cwl.gz
$(ASPELL_DIST)/uk.rws: $(affixfile_src) $(wordlist_src) $(ASPELL_DIST)/uk_affix.dat $(ASPELL_DIST)/uk.dat $(KOI8U_SET) $(KOI8U_MAP)
cp -u $(KOI8U_SET) $(KOI8U_MAP) $(ASPELL_DIST)
cat $(wordlist_src) | $(iconv) -f $(SOURCE_ENC) -t $(ASPELL_ENC) | \
aspell --local-data-dir=$(ASPELL_DIST) --lang=uk create master ./$@
$(ASPELL_DIST)/uk_affix.dat: $(affixfile_src) encodings.inc
$(iconv) -f $(SOURCE_ENC) -t $(ASPELL_ENC) < $(affixfile_src) > $@
#$(ASPELL_DIST)/uk_words.out: $(wordlist_src) encodings.inc
# $(iconv) -f $(SOURCE_ENC) -t $(ASPELL_ENC) < $(wordlist_src) > $@
$(ASPELL_DIST)/uk.dat: src/aspell/uk.dat.templ encodings.inc
sed "s/^data-encoding.*$$/data-encoding $(ASPELL_ENC_NAME)/" < src/aspell/uk.dat.templ > $@
# *.kbd file should be always in UTF-8
$(ASPELL_DIST)/ukrainian.kbd: src/aspell/ukrainian.kbd
cp -u $< $@
# official aspell.net package
aspell.net:
wget ftp://ftp.gnu.org/gnu/aspell/aspell-lang-20040810.tar.bz2
aspell-lang-20040810/aspell-lang
#
# myspell rules
#
hunspell: myspell
myspell: $(MYSPELL_DIST)/uk_UA.aff $(MYSPELL_DIST)/uk_UA.dic
install-myspell-dict: myspell
install -m 0755 -d $(PREFIX)$(MYSPELLDIR)
install -m 0644 $(MYSPELL_DIST)/uk_UA.aff $(MYSPELL_DIST)/uk_UA.dic $(PREFIX)$(MYSPELLDIR)
install-myspell: install-myspell-dict
install -m 0755 -d $(PREFIX)$(MYSPELL_DOC_DIR)
install -m 0644 src/myspell/README* $(PREFIX)$(MYSPELL_DOC_DIR)
if [[ ! -f "$(MYSPELL_DICT_LST)" ]] || \
! grep -q "^DICT[ \t]*uk[ \t]*UA[ \t]*uk_UA\$$" $(MYSPELL_DICT_LST); \
then \
echo "DICT uk UA uk_UA" >> $(MYSPELL_DICT_LST); \
fi
myspell-zip: $(DIST)/myspell-uk_UA-$(VERSION).zip
myspell-rpm: srctar
bin/make_rpm.sh myspell-uk $(VERSION)
$(DIST)/myspell-uk_UA-$(VERSION).zip: myspell
rm -f $@
zip -j $@ $(MYSPELL_DIST)/uk_UA.aff $(MYSPELL_DIST)/uk_UA.dic src/myspell/README*
# myspell dependencies
$(MYSPELL_DIST)/uk_UA.aff: affix-dir src/myspell/myspell.header encodings.inc
mkdir -p $(MYSPELL_DIST)
sed s/xxENCODINGxx/UTF-8/ < src/myspell/myspell.header > tmp.header
cat tmp.header $(affixfile_src) | $(iconv) -f $(SOURCE_ENC) -t $(MYSPELL_ENC) > $@
-rm tmp.header
$(MYSPELL_DIST)/uk_UA.dic: dictionary-dir encodings.inc
wc -l < $(wordlist_src) > $@
cat $(wordlist_src) | $(iconv) -f $(SOURCE_ENC) -t $(MYSPELL_ENC) >> $@
mozilla-xpi: myspell
mkdir -p $(XPI_DIST)/dictionaries
cp $(MYSPELL_DIST)/uk_UA.aff $(XPI_DIST)/dictionaries/uk-UA.aff
cp $(MYSPELL_DIST)/uk_UA.dic $(XPI_DIST)/dictionaries/uk-UA.dic
cat src/mozilla/README_uk_UA.txt.header src/myspell/README_uk_UA.txt > $(XPI_DIST)/README_uk_UA.txt
cp COPYING.LGPL $(XPI_DIST)/
cp src/mozilla/*.png $(XPI_DIST)/
$(UPDATE_VERSION) < src/mozilla/install.js > $(XPI_DIST)/install.js
$(UPDATE_VERSION) < src/mozilla/install.rdf > $(XPI_DIST)/install.rdf
cd $(XPI_DIST) && zip -r ../ukrainian_dictionary-$(VERSION)-mozilla.xpi * && cd ..
# cp src/mozilla/install* $(XPI_DIST)
ooo: myspell
mkdir -p $(OXT_DIST)
cp -r src/openoffice.org/* $(OXT_DIST)
$(UPDATE_VERSION) < src/openoffice.org/description.xml > $(OXT_DIST)/description.xml
cp $(MYSPELL_DIST)/uk_UA.aff $(OXT_DIST)/uk_UA/
cp $(MYSPELL_DIST)/uk_UA.dic $(OXT_DIST)/uk_UA/
cp src/myspell/README_uk_UA.txt $(OXT_DIST)/uk_UA/
cp src/thesaurus/th_uk_UA.dat $(OXT_DIST)/uk_UA/
bin/th_gen_idx.pl < src/thesaurus/th_uk_UA.dat > $(OXT_DIST)/uk_UA/th_uk_UA.idx
-rm *.oxt
cd $(OXT_DIST) && zip -r ../dict-uk_UA-$(VERSION).oxt * && cd ..
# for myspell engine (Firefox <=2, Thunderbird <=2...)
mozilla-xpi-old: myspell
grep -v "IGNORE" $(MYSPELL_DIST)/uk_UA.aff | sed "s/$(MYSPELL_ENC_NAME)/KOI8-U/" | iconv -f $(MYSPELL_ENC) -t koi8-u > $(XPI_DIST)/dictionaries/uk-UA.aff
cat $(MYSPELL_DIST)/uk_UA.dic | iconv -f $(MYSPELL_ENC) -t koi8-u > $(XPI_DIST)/dictionaries/uk-UA.dic
cat src/mozilla/old/README_uk_UA.txt.header src/myspell/README_uk_UA.txt > $(XPI_DIST)/dictionaries/README_uk_UA.txt
cp COPYING.LGPL $(XPI_DIST)/dictionaries/
cp src/mozilla/old/install* $(XPI_DIST)
cd $(XPI_DIST) && zip -r ukrainian_dictionary-$(VERSION)-mozilla-old.xpi dictionaries install.* && cd ..
#
# ispell rules
#
#ispell: $(ISPELL_DIST)/ukrainian.aff $(ISPELL_DIST)/ukrainian.hash
ispell:
@echo "FATAL: ispell is not supported any more, please use hunspell" >&2
@/bin/false
install-ispell-dict: ispell
install -m 0755 -d $(PREFIX)$(ISPELLDIR)
install -m 0644 $(ISPELL_DIST)/ukrainian.aff $(ISPELL_DIST)/ukrainian.hash $(PREFIX)$(ISPELLDIR)
install-ispell: install-ispell-dict
install -m 0755 -d $(PREFIX)$(ISPELL_DOC_DIR)
install -m 0644 src/ispell/README Copyright COPYING.* $(PREFIX)$(ISPELL_DOC_DIR)
ispell-tar: $(DIST)/ispell-uk-$(VERSION).tgz
$(DIST)/ispell-uk-$(VERSION).tgz: ispell
mkdir -p $(ISPELL_DIST)/doc
cp -u src/ispell/README Copyright COPYING.* $(ISPELL_DIST)/doc
tar cCvfz $(DIST) --owner=root --group=root $@ --exclude='*.enc*' ispell-uk-$(VERSION)
ispell-rpm: srctar
bin/make_rpm.sh ispell-uk $(VERSION)
# dependencies for ispell
$(ISPELL_DIST)/ukrainian.aff: $(affixfile_src) bin/affconv.pl src/ispell/ispell.header encodings.inc
(cat src/ispell/ispell.header && grep -v "REP" $(affixfile_src) | perl bin/affconv.pl ) | $(iconv) -f $(SOURCE_ENC) -t $(ISPELL_ENC) > $@
$(ISPELL_DIST)/uk_words.enc: $(wordlist_src) encodings.inc
$(iconv) -f $(SOURCE_ENC) -t $(ISPELL_ENC) < $(wordlist_src) > $@
$(ISPELL_DIST)/ukrainian.hash: $(ISPELL_DIST)/uk_words.enc $(ISPELL_DIST)/ukrainian.aff
buildhash $(ISPELL_DIST)/uk_words.enc $(ISPELL_DIST)/ukrainian.aff $(ISPELL_DIST)/ukrainian.hash
# wordlist rules
#
ukrainian: $(wordlist_src) aspell
# XXX need to sorth this somehow (and do nont use one more locale)
iconv -f $(SOURCE_ENC) -t $(ASPELL_ENC) < $(wordlist_src) |\
aspell expand --encoding=$(ASPELL_ENC_NAME) \
--local-data-dir=$(ASPELL_DIST) --lang=uk | \
tr -s ' ' '\n' | sed '/^$$/d' > $@
install-wordlist: ukrainian
install -m 0755 -d $(PREFIX)/usr/share/dict
install -m 0644 ukrainian $(PREFIX)/usr/share/dict
# regression test
#
regtest:
$(MAKE) -C test regtest
regtestroll:
$(MAKE) -C test regtestroll
srctar: clean
tar cfz $(DIST)/spell-uk-$(VERSION).tgz --exclude=test --exclude=dist/*spell* --exclude=dist/*openoffice* --exclude=dist/*.oxt --exclude=*.old --exclude=src_text --exclude=CVS --exclude=--exclude=.* --exclude=tools *
mkdir -p $(DIST)/spell-uk-$(VERSION)
tar xCfz $(DIST)/spell-uk-$(VERSION) $(DIST)/spell-uk-$(VERSION).tgz
tar cCfz $(DIST) $(DIST)/spell-uk-$(VERSION).tgz --owner=root --group=root spell-uk-$(VERSION)
rm -rf $(DIST)/spell-uk-$(VERSION)
# cleaning
#
clean:
rm -f $(CLEANFILES)
rm -rf $(CLEANDIRS)
$(MAKE) -C src/Affix clean
$(MAKE) -C src/Dictionary clean
$(MAKE) -C test clean
.PHONY: all regtest regtestroll clean aspell myspell ispell
.PHONY: install install-all install-aspell install-myspell install-myspell-dict install-ispell install-wordlist
.PHONY: aspell-tar myspell-zip ispell-tar srctar affix-dir dictionary-dir