xref: /vim-8.2.3635/runtime/spell/lv/main.aap (revision 00a927d6)
1# Aap recipe for Latvian 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    = lv_LV.aff lv_LV.dic
11
12# I don't have a Latvian locale, use Lithuanian instead.
13all: $SPELLDIR/lv.iso-8859-13.spl $SPELLDIR/lv.utf-8.spl \
14         ../README_lv.txt
15
16$SPELLDIR/lv.iso-8859-13.spl : $FILES
17        :sys env LANG=lt_LT.ISO8859-13 $VIM -u NONE -e -c "mkspell! $SPELLDIR/lv lv_LV" -c q
18
19$SPELLDIR/lv.utf-8.spl : $FILES
20        :sys env LANG=lt_LT.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/lv lv_LV" -c q
21
22../README_lv.txt: README_lv_LV.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%} lv_LV.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.
33# This is a bit tricky, since the file name includes the date.
34lv_LV.aff lv_LV.dic: {buildcheck=}
35        :assertpkg unzip patch
36        :fetch lv_LV.zip
37        :sys $UNZIP lv_LV.zip
38        :delete lv_LV.zip
39        :delete changelog.txt gpl.txt lin-lv_LV_add.sh win-lv_LV_add.bat
40        :sys $VIM lv_LV.aff -u NONE -e -N -c "%s/\r//" -c update -c q
41        :sys $VIM lv_LV.dic -u NONE -e -N -c "%s/\r//" -c update -c q
42        :sys $VIM README_lv_LV.txt -u NONE -e -c "set ff=unix" -c update -c q
43        @if not os.path.exists('lv_LV.orig.aff'):
44            :copy lv_LV.aff lv_LV.orig.aff
45        @if not os.path.exists('lv_LV.orig.dic'):
46            :copy lv_LV.dic lv_LV.orig.dic
47        @if os.path.exists('lv_LV.diff'):
48            :sys patch <lv_LV.diff
49
50
51# Generate diff files, so that others can get the OpenOffice files and apply
52# the diffs to get the Vim versions.
53
54diff:
55        :assertpkg diff
56        :sys {force} diff -a -C 1 lv_LV.orig.aff lv_LV.aff >lv_LV.diff
57        :sys {force} diff -a -C 1 lv_LV.orig.dic lv_LV.dic >>lv_LV.diff
58
59
60# Check for updated spell files.  When there are changes the
61# ".new.aff" and ".new.dic" files are left behind for manual inspection.
62
63check:
64        :assertpkg unzip diff
65        :fetch lv_LV.zip
66        :mkdir tmp
67        :cd tmp
68        @try:
69            @import stat
70            :sys $UNZIP ../lv_LV.zip
71            :sys {force} diff ../lv_LV.orig.aff lv_LV.aff >d
72            @if os.stat('d')[stat.ST_SIZE] > 0:
73                :copy lv_LV.aff ../lv_LV.new.aff
74            :sys {force} diff ../lv_LV.orig.dic lv_LV.dic >d
75            @if os.stat('d')[stat.ST_SIZE] > 0:
76                :copy lv_LV.dic ../lv_LV.new.dic
77        @finally:
78            :cd ..
79            :delete {r}{f}{q} tmp
80            :delete lv_LV.zip
81
82
83# vim: set sts=4 sw=4 :
84