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