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