summaryrefslogtreecommitdiffstats
path: root/runtime/spell/ru/main.aap
blob: e3d37a1b83c4973af34df966eff9d6636763e646 (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
# Aap recipe for Russian Vim spell files.

# Use a freshly compiled Vim if it exists.
@if os.path.exists('../../../src/vim'):
    VIM = ../../../src/vim
@else:
    :progsearch VIM vim

REGIONS = RU YO
SPELLDIR = ..
FILES    = ru_$*(REGIONS).aff ru_$*(REGIONS).dic

all: $SPELLDIR/ru.koi8-r.spl $SPELLDIR/ru.utf-8.spl \
        $SPELLDIR/ru.cp1251.spl ../README_ru.txt

$SPELLDIR/ru.koi8-r.spl : $FILES
        :sys env LANG=ru_RU.KOI8-R $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q

$SPELLDIR/ru.utf-8.spl : $FILES
        :sys env LANG=ru_RU.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q

$SPELLDIR/ru.cp1251.spl : $FILES
        :sys env LANG=ru_RU.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q

../README_ru.txt: README_ru_$*(REGIONS).txt
        :print ru_RU >! $target
        :cat README_ru_RU.txt >> $target
        :print =================================================== >>$target
        :print ru_YO >> $target
        :cat README_ru_YO.txt >> $target

#
# Fetching the files from OpenOffice.org.
#
OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
:attr {fetch = $OODIR/%file%} ru_RU.zip ru_RU_yo.zip

# The files don't depend on the .zip file so that we can delete it.
# Only download the zip file if the targets don't exist.
# This is a bit tricky, since the file name includes the date.
ru_RU.aff ru_RU.dic: {buildcheck=}
        :assertpkg unzip
        :fetch ru_RU.zip
        :sys unzip ru_RU.zip
        :delete ru_RU.zip
        @if not os.path.exists('ru_RU.orig.aff'):
            :copy ru_RU.aff ru_RU.orig.aff
        @if not os.path.exists('ru_RU.orig.dic'):
            :copy ru_RU.dic ru_RU.orig.dic
        @if os.path.exists('ru_RU.diff'):
            :sys patch <ru_RU.diff

ru_YO.aff ru_YO.dic: {buildcheck=}
        :assertpkg unzip
        :fetch ru_RU_yo.zip
        :sys unzip ru_RU_yo.zip
        :delete ru_RU_yo.zip
        :move ru_RU_yo.aff ru_YO.aff
        :move ru_RU_yo.dic ru_YO.dic
        :move README_ru_RU_yo.txt README_ru_YO.txt
        @if not os.path.exists('ru_YO.orig.aff'):
            :copy ru_YO.aff ru_YO.orig.aff
        @if not os.path.exists('ru_YO.orig.dic'):
            :copy ru_YO.dic ru_YO.orig.dic
        @if os.path.exists('ru_YO.diff'):
            :sys patch <ru_YO.diff


# Generate diff files, so that others can get the OpenOffice files and apply
# the diffs to get the Vim versions.

diff:
        :assertpkg diff
        :sys {force} diff -a -C 1 ru_RU.orig.aff ru_RU.aff >ru_RU.diff
        :sys {force} diff -a -C 1 ru_RU.orig.dic ru_RU.dic >>ru_RU.diff
        :sys {force} diff -a -C 1 ru_YO.orig.aff ru_YO.aff >ru_YO.diff
        :sys {force} diff -a -C 1 ru_YO.orig.dic ru_YO.dic >>ru_YO.diff


# Check for updated spell files.  When there are changes the
# ".new.aff" and ".new.dic" files are left behind for manual inspection.

check:
        :print Doesn't work yet.