xref: /vim-8.2.3635/runtime/spell/mi/main.aap (revision 18144c84)
1# Aap recipe for Maori 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    = mi_NZ.aff mi_NZ.dic
11
12all: $SPELLDIR/mi.iso-8859-4.spl $SPELLDIR/mi.utf-8.spl ../README_mi.txt
13
14$SPELLDIR/mi.iso-8859-4.spl : $FILES
15        :sys $VIM -u NONE -e -c "set enc=iso-8859-4"
16                -c "mkspell! $SPELLDIR/mi mi_NZ" -c q
17
18$SPELLDIR/mi.utf-8.spl : $FILES
19        :sys $VIM -u NONE -e -c "set enc=utf-8"
20                -c "mkspell! $SPELLDIR/mi mi_NZ" -c q
21
22../README_mi.txt : README_mi_NZ.txt
23        :copy $source $target
24
25#
26# Fetching the files from OpenOffice.org.
27#
28OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
29:attr {fetch = $OODIR/%file%} mi_NZ.zip
30
31# The files don't depend on the .zip file so that we can delete it.
32# Only download the zip file if the targets don't exist.
33mi_NZ.aff mi_NZ.dic: {buildcheck=}
34        :assertpkg unzip patch
35        :fetch mi_NZ.zip
36        :sys $UNZIP mi_NZ.zip
37        :delete mi_NZ.zip
38        # Fix missing end of line.
39        :print >>mi_NZ.aff
40        @if not os.path.exists('mi_NZ.orig.aff'):
41            :copy mi_NZ.aff mi_NZ.orig.aff
42        @if not os.path.exists('mi_NZ.orig.dic'):
43            :copy mi_NZ.dic mi_NZ.orig.dic
44        @if os.path.exists('mi_NZ.diff'):
45            :sys patch <mi_NZ.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 mi_NZ.orig.aff mi_NZ.aff >mi_NZ.diff
54        :sys {force} diff -a -C 1 mi_NZ.orig.dic mi_NZ.dic >>mi_NZ.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 mi_NZ.zip
63        :mkdir tmp
64        :cd tmp
65        @try:
66            @import stat
67            :sys $UNZIP ../mi_NZ.zip
68            :sys {force} diff ../mi_NZ.orig.aff mi_NZ.aff >d
69            @if os.stat('d')[stat.ST_SIZE] > 0:
70                :copy mi_NZ.aff ../mi_NZ.new.aff
71            :sys {force} diff ../mi_NZ.orig.dic mi_NZ.dic >d
72            @if os.stat('d')[stat.ST_SIZE] > 0:
73                :copy mi_NZ.dic ../mi_NZ.new.dic
74        @finally:
75            :cd ..
76            :delete {r}{f}{q} tmp
77            :delete mi_NZ.zip
78
79
80# vim: set sts=4 sw=4 :
81