1# Aap recipe for Russian 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
9REGIONS = RU YO
10SPELLDIR = ..
11FILES    = ru_$*(REGIONS).aff ru_$*(REGIONS).dic
12
13all: $SPELLDIR/ru.koi8-r.spl $SPELLDIR/ru.utf-8.spl \
14        $SPELLDIR/ru.cp1251.spl ../README_ru.txt
15
16$SPELLDIR/ru.koi8-r.spl : $FILES
17        :sys env LANG=ru_RU.KOI8-R $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q
18
19$SPELLDIR/ru.utf-8.spl : $FILES
20        :sys env LANG=ru_RU.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q
21
22$SPELLDIR/ru.cp1251.spl : $FILES
23        :sys env LANG=ru_RU.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_YO" -c q
24
25../README_ru.txt: README_ru_$*(REGIONS).txt
26        :print ru_RU >! $target
27        :cat README_ru_RU.txt >> $target
28        :print =================================================== >>$target
29        :print ru_YO >> $target
30        :cat README_ru_YO.txt >> $target
31
32#
33# Fetching the files from OpenOffice.org.
34#
35OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
36:attr {fetch = $OODIR/%file%} ru_RU.zip ru_RU_yo.zip
37
38# The files don't depend on the .zip file so that we can delete it.
39# Only download the zip file if the targets don't exist.
40# This is a bit tricky, since the file name includes the date.
41ru_RU.aff ru_RU.dic: {buildcheck=}
42        :assertpkg unzip
43        :fetch ru_RU.zip
44        :sys unzip ru_RU.zip
45        :delete ru_RU.zip
46        @if not os.path.exists('ru_RU.orig.aff'):
47            :copy ru_RU.aff ru_RU.orig.aff
48        @if not os.path.exists('ru_RU.orig.dic'):
49            :copy ru_RU.dic ru_RU.orig.dic
50        @if os.path.exists('ru_RU.diff'):
51            :sys patch <ru_RU.diff
52
53ru_YO.aff ru_YO.dic: {buildcheck=}
54        :assertpkg unzip
55        :fetch ru_RU_yo.zip
56        :sys unzip ru_RU_yo.zip
57        :delete ru_RU_yo.zip
58        :move ru_RU_yo.aff ru_YO.aff
59        :move ru_RU_yo.dic ru_YO.dic
60        :move README_ru_RU_yo.txt README_ru_YO.txt
61        @if not os.path.exists('ru_YO.orig.aff'):
62            :copy ru_YO.aff ru_YO.orig.aff
63        @if not os.path.exists('ru_YO.orig.dic'):
64            :copy ru_YO.dic ru_YO.orig.dic
65        @if os.path.exists('ru_YO.diff'):
66            :sys patch <ru_YO.diff
67
68
69# Generate diff files, so that others can get the OpenOffice files and apply
70# the diffs to get the Vim versions.
71
72diff:
73        :assertpkg diff
74        :sys {force} diff -a -C 1 ru_RU.orig.aff ru_RU.aff >ru_RU.diff
75        :sys {force} diff -a -C 1 ru_RU.orig.dic ru_RU.dic >>ru_RU.diff
76        :sys {force} diff -a -C 1 ru_YO.orig.aff ru_YO.aff >ru_YO.diff
77        :sys {force} diff -a -C 1 ru_YO.orig.dic ru_YO.dic >>ru_YO.diff
78
79
80# Check for updated spell files.  When there are changes the
81# ".new.aff" and ".new.dic" files are left behind for manual inspection.
82
83check:
84        :print Doesn't work yet.
85