xref: /vim-8.2.3635/runtime/spell/sr/main.aap (revision 3ad8772e)
1# Aap recipe for Serbian 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    = sr_RS.aff sr_RS.dic
11           '[email protected]' '[email protected]'
12
13all: $SPELLDIR/sr.utf-8.spl $SPELLDIR/'[email protected]' ../README_sr.txt
14
15# Original files will be in the subfolder hunspell-sr after unpacking:
16#    sr.dic    original cyrillic dictionary
17#    sr.aff     original cyrillic affix file
18#    sr-Latn.dic     original latin dictionary file
19#    sr-Latn.aff    original latin affix file
20# Just before using the dictionary files, the right ones are copied to
21#    sr_RS.aff
22#    sr_RS.dic
23#    and
24#    [email protected]
25#    [email protected]
26
27$SPELLDIR/sr.utf-8.spl : $FILES
28        :sys env LANG=sr_RS.UTF-8
29		$VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr sr_RS" -c q
30
31$SPELLDIR/"[email protected]" : $FILES
32        :sys env [email protected]
33		$VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr@latin sr_RS@latin" -c q
34
35../README_sr.txt : hunspell-sr/README_sr.txt README_sr_RS.txt
36        :cat README_sr_RS.txt >!$target
37        :print >>$target
38        :print ============================================================== >>$target
39        :print Следи оригинална README датотека: >>$target
40        :print >>$target
41        :cat hunspell-sr/README_sr.txt >>$target
42
43#
44# Used to fetch the files.
45#
46ZIPFILE = http://devbase.net/dict-sr/hunspell-sr-20130715.zip
47
48:attr {fetch = $ZIPFILE} sr_RS.zip
49
50# The files don't depend on the .zip file so that we can delete it.
51# Only download the zip file if the targets don't exist.
52sr_RS.aff sr_RS.dic: {buildcheck=}
53        :assertpkg unzip patch
54        :fetch sr_RS.zip
55        :sys $UNZIP sr_RS.zip
56        :delete sr_RS.zip
57        @if not os.path.exists('sr_RS.orig.aff'):
58            :copy hunspell-sr/sr.aff sr_RS.orig.aff
59        @if not os.path.exists('sr_RS.orig.dic'):
60            :copy hunspell-sr/sr.dic sr_RS.orig.dic
61        @if os.path.exists('sr_RS.diff'):
62            :sys patch <sr_RS.diff
63        :copy sr_RS.orig.aff sr_RS.aff
64        :copy sr_RS.orig.dic sr_RS.dic
65
66        # Remove the 3 misspelled words and update the word count
67#        :sys $VIM -u NONE -e -c "set enc=utf-8"
68#                    -c "e sr_RS.orig.dic"
69#                    -c "%g/ажуриранје/d"
70#                    -c "%g/вишнја/d"
71#                    -c "%g/вишнјевац/d"
72#                    -c "%s/263909/263906/e"
73#                    -c "w! sr_RS.dic"
74#                    -c q
75
76[email protected] [email protected]: {buildcheck=}
77        :assertpkg unzip patch
78        :fetch sr_RS.zip
79        :sys $UNZIP sr_RS.zip
80        :delete sr_RS.zip
81        @if not os.path.exists('[email protected]'):
82            :copy hunspell-sr/sr-Latn.aff '[email protected]'
83        @if not os.path.exists('[email protected]'):
84            :copy hunspell-sr/sr-Latn.dic '[email protected]'
85        @if os.path.exists('[email protected]'):
86            :sys patch <'[email protected]'
87        :copy '[email protected]' '[email protected]'
88        :copy '[email protected]' '[email protected]'
89
90
91        # Remove the 3 duplicated words and update the word count
92#        :sys $VIM -u NONE -e -c "set enc=utf-8"
93#                    -c "e [email protected]"
94#                    -c "%g/\v(ažuriranje)(\_.*\1)@=/d"
95#                    -c "%g/\v(višnja)(\_.*\1)@=/d"
96#                    -c "%g/\v(višnjevac)(\_.*\1)@=/d"
97#                    -c "%s/263909/263906/e"
98#                    -c "w! [email protected]"
99#                    -c q
100
101# Generate diff files, so that others can get the files and apply
102# the diffs to get the Vim versions.
103diff:
104        :assertpkg diff
105        :sys {force} diff -a -C 1 sr_RS.orig.aff sr_RS.aff >sr_RS.diff
106        :sys {force} diff -a -C 1 sr_RS.orig.dic sr_RS.dic >>sr_RS.diff
107        :sys {force} diff -a -C 1 '[email protected]' '[email protected]' >'[email protected]'
108        :sys {force} diff -a -C 1 '[email protected]' '[email protected]' >>'[email protected]'
109
110# Delete all the unpacked and generated files, including the "orig" files.
111clean:
112        :delete {force} sr_RS.zip sr_RS.dic
113                        sr_RS.orig.aff sr_RS.orig.dic
114                        sr_RS.aff
115                        '[email protected]' '[email protected]'
116                        '[email protected]' '[email protected]'
117        :sys rm -f -r hunspell-sr/
118
119# Check for updated OpenOffice spell files.  When there are changes the
120# ".new.aff" and ".new.dic" files are left behind for manual inspection.
121#
122#check:
123#        :assertpkg unzip diff
124#        :fetch fr_FR.zip
125#        :mkdir tmp
126#        :cd tmp
127#        @try:
128#            @import stat
129#            :sys $UNZIP ../fr_FR.zip
130#            :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d
131#            @if os.stat('d')[stat.ST_SIZE] > 0:
132#                :copy fr_FR.aff ../fr_FR.new.aff
133#            :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d
134#            @if os.stat('d')[stat.ST_SIZE] > 0:
135#                :copy fr_FR.dic ../fr_FR.new.dic
136#        @finally:
137#            :cd ..
138#            :delete {r}{f}{q} tmp
139#            :delete fr_FR.zip
140
141
142vim: set sts=4 sw=4 :
143