xref: /vim-8.2.3635/runtime/spell/bg/main.aap (revision 00a927d6)
1# Aap recipe for Bulgarian 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    = bg_BG.aff bg_BG.dic
11
12all: $SPELLDIR/bg.cp1251.spl $SPELLDIR/bg.utf-8.spl ../README_bg.txt
13
14$SPELLDIR/bg.cp1251.spl : $FILES
15        :sys env LANG=bg_BG.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q
16
17$SPELLDIR/bg.utf-8.spl : $FILES
18        :sys env LANG=bg_BG.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q
19
20../README_bg.txt: README_bg_BG.txt
21        :copy $source $target
22
23#
24# Fetching the files from OpenOffice.org.
25#
26OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
27:attr {fetch = $OODIR/%file%} bg_BG.zip
28
29# The files don't depend on the .zip file so that we can delete it.
30# Only download the zip file if the targets don't exist.
31# This is a bit tricky, since the file name includes the date.
32bg_BG.aff bg_BG.dic: {buildcheck=}
33        :assertpkg unzip patch
34        :fetch bg_BG.zip
35        :sys $UNZIP bg_BG.zip
36        :delete bg_BG.zip
37        :sys $VIM bg_BG.aff -u NONE -e -c "set ff=unix" -c update -c q
38        :sys $VIM bg_BG.dic -u NONE -e -c "set ff=unix" -c update -c q
39        :sys $VIM README_bg_BG.txt -u NONE -e -c "set ff=unix" -c update -c q
40        @if not os.path.exists('bg_BG.orig.aff'):
41            :copy bg_BG.aff bg_BG.orig.aff
42        @if not os.path.exists('bg_BG.orig.dic'):
43            :copy bg_BG.dic bg_BG.orig.dic
44        @if os.path.exists('bg_BG.diff'):
45            :sys patch <bg_BG.diff
46
47
48# Generate diff files, so that others can get the OpenOffice files and apply
49# the diffs to get the Vim versions.
50
51diff:
52        :assertpkg diff
53        :sys {force} diff -a -C 1 bg_BG.orig.aff bg_BG.aff >bg_BG.diff
54        :sys {force} diff -a -C 1 bg_BG.orig.dic bg_BG.dic >>bg_BG.diff
55
56
57# Check for updated OpenOffice spell files.  When there are changes the
58# ".new.aff" and ".new.dic" files are left behind for manual inspection.
59
60check:
61        :assertpkg unzip diff
62        :fetch bg_BG.zip
63        :mkdir tmp
64        :cd tmp
65        @try:
66            @import stat
67            :sys $UNZIP ../bg_BG.zip
68            :sys {force} diff ../bg_BG.orig.aff bg_BG.aff >d
69            @if os.stat('d')[stat.ST_SIZE] > 0:
70                :copy bg_BG.aff ../bg_BG.new.aff
71            :sys {force} diff ../bg_BG.orig.dic bg_BG.dic >d
72            @if os.stat('d')[stat.ST_SIZE] > 0:
73                :copy bg_BG.dic ../bg_BG.new.dic
74        @finally:
75            :cd ..
76            :delete {r}{f}{q} tmp
77            :delete bg_BG.zip
78
79
80# vim: set sts=4 sw=4 :
81