xref: /vim-8.2.3635/runtime/spell/en/main.aap (revision a61018d7)
1# Aap recipe for English Vim spell files.
2
3# Use a freshly compiled Vim if it exists.
4@if os.path.exists('../../../src/vim'):
5    VIM = ../../../src/vim
6@else:
7    :progsearch VIM vim
8
9SPELLDIR = ..
10FILES    = en_US.aff en_US.dic
11	   en_AU.aff en_AU.dic
12           en_CA.aff en_CA.dic
13           en_GB.aff en_GB.dic
14           en_NZ.aff en_NZ.dic
15
16all: $SPELLDIR/en.latin1.spl $SPELLDIR/en.utf-8.spl \
17        $SPELLDIR/en.ascii.spl ../README_en.txt
18
19$SPELLDIR/en.latin1.spl : $FILES
20        :sys env LANG=en_US.ISO8859-1
21		$VIM -u NONE -e -c "mkspell! $SPELLDIR/en
22                        en_US en_AU en_CA en_GB en_NZ" -c q
23
24$SPELLDIR/en.utf-8.spl : $FILES
25        :sys env LANG=en_US.UTF-8
26		$VIM -u NONE -e -c "mkspell! $SPELLDIR/en
27                        en_US en_AU en_CA en_GB en_NZ" -c q
28
29$SPELLDIR/en.ascii.spl : $FILES
30        :sys $VIM -u NONE -e -c "mkspell! -ascii $SPELLDIR/en
31                        en_US en_AU en_CA en_GB en_NZ" -c q
32
33../README_en.txt: README_en_US.txt README_en_AU.txt README_en_CA.txt README_en_GB.txt README_en_NZ.txt
34        :print en_US >!$target
35        :cat README_en_US.txt | :eval re.sub('\r', '', stdin) >>$target
36        :print =================================================== >>$target
37        :print en_AU: >>$target
38        :cat README_en_AU.txt | :eval re.sub('\r', '', stdin) >>$target
39        :print =================================================== >>$target
40        :print en_CA: >>$target
41        :cat README_en_CA.txt | :eval re.sub('\r', '', stdin) >>$target
42        :print =================================================== >>$target
43        :print en_GB: >>$target
44        :cat README_en_GB.txt | :eval re.sub('\r', '', stdin) >>$target
45        :print =================================================== >>$target
46        :print en_NZ: >>$target
47        :cat README_en_NZ.txt | :eval re.sub('\r', '', stdin) >>$target
48
49#
50# Fetching the files from OpenOffice.org.
51# THIS URL NO LONGER WORKS.
52#
53# Files for en_US, en_CA and en_GB can be obtained from:
54# github.com/marcoagpinto/aoo-mozilla-en-dict
55# Unfortunately, giving suggestions becomes terribly slow with these.
56# TODO: find out why suggestions are slow and fix that.
57#
58# For now we use the older libraries.
59#
60OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
61:attr {fetch = $OODIR/%file%} en_US.zip en_CA.zip en_NZ.zip
62                                en_GB.zip en_AU.zip
63
64# The files don't depend on the .zip file so that we can delete it.
65# Only download the zip file if the targets don't exist.
66en_US.aff en_US.dic: {buildcheck=}
67        :assertpkg unzip patch
68        :fetch en_US.zip
69        :sys $UNZIP en_US.zip
70        :delete en_US.zip
71        @if not os.path.exists('en_US.orig.aff'):
72            :copy en_US.aff en_US.orig.aff
73        @if not os.path.exists('en_US.orig.dic'):
74            :copy en_US.dic en_US.orig.dic
75        @if os.path.exists('en_US.diff'):
76            :sys patch <en_US.diff
77
78en_AU.aff en_AU.dic: {buildcheck=}
79        :assertpkg unzip patch
80        :fetch en_AU.zip
81        :sys $UNZIP en_AU.zip
82        :delete en_AU.zip
83        @if not os.path.exists('en_AU.orig.aff'):
84            :copy en_AU.aff en_AU.orig.aff
85        @if not os.path.exists('en_AU.orig.dic'):
86            :copy en_AU.dic en_AU.orig.dic
87        @if os.path.exists('en_AU.diff'):
88            :sys patch <en_AU.diff
89
90en_CA.aff en_CA.dic: {buildcheck=}
91        :assertpkg unzip patch
92        :fetch en_CA.zip
93        :sys $UNZIP en_CA.zip
94        :delete en_CA.zip
95        @if not os.path.exists('en_CA.orig.aff'):
96            :copy en_CA.aff en_CA.orig.aff
97        @if not os.path.exists('en_CA.orig.dic'):
98            :copy en_CA.dic en_CA.orig.dic
99        @if os.path.exists('en_CA.diff'):
100            :sys patch <en_CA.diff
101
102en_GB.aff en_GB.dic: {buildcheck=}
103        :assertpkg unzip patch
104        :fetch en_GB.zip
105        :sys $UNZIP en_GB.zip
106        :delete en_GB.zip
107        :delete dictionary.lst.example
108        @if not os.path.exists('en_GB.orig.aff'):
109            :copy en_GB.aff en_GB.orig.aff
110        @if not os.path.exists('en_GB.orig.dic'):
111            :copy en_GB.dic en_GB.orig.dic
112        @if os.path.exists('en_GB.diff'):
113            :sys patch <en_GB.diff
114
115en_NZ.aff en_NZ.dic: {buildcheck=}
116        :assertpkg unzip patch
117        :fetch en_NZ.zip
118        :sys $UNZIP en_NZ.zip
119        :delete en_NZ.zip
120        @if not os.path.exists('en_NZ.orig.aff'):
121            :copy en_NZ.aff en_NZ.orig.aff
122        @if not os.path.exists('en_NZ.orig.dic'):
123            :copy en_NZ.dic en_NZ.orig.dic
124        @if os.path.exists('en_NZ.diff'):
125            :sys patch <en_NZ.diff
126
127
128# Generate diff files, so that others can get the original files and apply
129# the diffs to get the Vim versions.
130
131diff:
132        :assertpkg diff
133        :sys {force} diff -a -C 1 en_US.orig.aff en_US.aff >en_US.diff
134        :sys {force} diff -a -C 1 en_US.orig.dic en_US.dic >>en_US.diff
135        :sys {force} diff -a -C 1 en_AU.orig.aff en_AU.aff >en_AU.diff
136	:sys {force} diff -a -C 1 en_AU.orig.dic en_AU.dic >>en_AU.diff
137	:sys {force} diff -a -C 1 en_CA.orig.aff en_CA.aff >en_CA.diff
138	:sys {force} diff -a -C 1 en_CA.orig.dic en_CA.dic >>en_CA.diff
139	:sys {force} diff -a -C 1 en_GB.orig.aff en_GB.aff >en_GB.diff
140	:sys {force} diff -a -C 1 en_GB.orig.dic en_GB.dic >>en_GB.diff
141	:sys {force} diff -a -C 1 en_NZ.orig.aff en_NZ.aff >en_NZ.diff
142	:sys {force} diff -a -C 1 en_NZ.orig.dic en_NZ.dic >>en_NZ.diff
143
144
145# Check for updated OpenOffice spell files.  When there are changes the
146# ".new.aff" and ".new.dic" files are left behind for manual inspection.
147
148check: check-us check-au check-ca check-gb check-nz
149
150check-us:
151        :assertpkg unzip diff
152        :fetch en_US.zip
153        :mkdir tmp
154        :cd tmp
155        @try:
156            @import stat
157            :sys $UNZIP ../en_US.zip
158            :sys {force} diff ../en_US.orig.aff en_US.aff >d
159            @if os.stat('d')[stat.ST_SIZE] > 0:
160                :copy en_US.aff ../en_US.new.aff
161            :sys {force} diff ../en_US.orig.dic en_US.dic >d
162            @if os.stat('d')[stat.ST_SIZE] > 0:
163                :copy en_US.dic ../en_US.new.dic
164        @finally:
165            :cd ..
166            :delete {r}{f}{q} tmp
167            :delete en_US.zip
168
169check-au:
170        :assertpkg unzip diff
171        :fetch en_AU.zip
172        :mkdir tmp
173        :cd tmp
174        @try:
175            @import stat
176            :sys $UNZIP ../en_AU.zip
177            :sys {force} diff ../en_AU.orig.aff en_AU.aff >d
178            @if os.stat('d')[stat.ST_SIZE] > 0:
179                :copy en_AU.aff ../en_AU.new.aff
180            :sys {force} diff ../en_AU.orig.dic en_AU.dic >d
181            @if os.stat('d')[stat.ST_SIZE] > 0:
182                :copy en_AU.dic ../en_AU.new.dic
183        @finally:
184            :cd ..
185            :delete {r}{f}{q} tmp
186            :delete en_AU.zip
187
188check-ca:
189        :assertpkg unzip diff
190        :fetch en_CA.zip
191        :mkdir tmp
192        :cd tmp
193        @try:
194            @import stat
195            :sys $UNZIP ../en_CA.zip
196            :sys {force} diff ../en_CA.orig.aff en_CA.aff >d
197            @if os.stat('d')[stat.ST_SIZE] > 0:
198                :copy en_CA.aff ../en_CA.new.aff
199            :sys {force} diff ../en_CA.orig.dic en_CA.dic >d
200            @if os.stat('d')[stat.ST_SIZE] > 0:
201                :copy en_CA.dic ../en_CA.new.dic
202        @finally:
203            :cd ..
204            :delete {r}{f}{q} tmp
205            :delete en_CA.zip
206
207check-gb:
208        :assertpkg unzip diff
209        :fetch en_GB.zip
210        :mkdir tmp
211        :cd tmp
212        @try:
213            @import stat
214            :sys $UNZIP ../en_GB.zip
215            :sys {force} diff ../en_GB.orig.aff en_GB.aff >d
216            @if os.stat('d')[stat.ST_SIZE] > 0:
217                :copy en_GB.aff ../en_GB.new.aff
218            :sys {force} diff ../en_GB.orig.dic en_GB.dic >d
219            @if os.stat('d')[stat.ST_SIZE] > 0:
220                :copy en_GB.dic ../en_GB.new.dic
221        @finally:
222            :cd ..
223            :delete {r}{f}{q} tmp
224            :delete en_GB.zip
225
226check-nz:
227        :assertpkg unzip diff
228        :fetch en_NZ.zip
229        :mkdir tmp
230        :cd tmp
231        @try:
232            @import stat
233            :sys $UNZIP ../en_NZ.zip
234            :sys {force} diff ../en_NZ.orig.aff en_NZ.aff >d
235            @if os.stat('d')[stat.ST_SIZE] > 0:
236                :copy en_NZ.aff ../en_NZ.new.aff
237            :sys {force} diff ../en_NZ.orig.dic en_NZ.dic >d
238            @if os.stat('d')[stat.ST_SIZE] > 0:
239                :copy en_NZ.dic ../en_NZ.new.dic
240        @finally:
241            :cd ..
242            :delete {r}{f}{q} tmp
243            :delete en_NZ.zip
244
245# vim: set sts=4 sw=4 :
246