1# Aap recipe for Yiddish 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       = yi.dic yi.aff
11WORDFILE    = wordlist.utf8.txt
12FILES_TR    = yi_tr.dic yi_tr.aff
13WORDFILE_TR = wordlist.txt
14
15all: $SPELLDIR/yi.utf-8.spl $SPELLDIR/yi-tr.utf-8.spl \
16        $SPELLDIR/yi.latin1.spl ../README_yi.txt
17
18$SPELLDIR/yi.utf-8.spl : $FILES
19    :sys $VIM -u NONE -e -c "set enc=utf-8"
20            -c "mkspell! $SPELLDIR/yi yi" -c q
21
22$SPELLDIR/yi-tr.utf-8.spl : $FILES_TR
23    :sys $VIM -u NONE -e -c "set enc=utf-8"
24            -c "mkspell! $SPELLDIR/yi-tr yi_tr" -c q
25
26$SPELLDIR/yi.latin1.spl : $FILES_TR
27    :sys $VIM -u NONE -e -c "set enc=latin1"
28            -c "mkspell! $SPELLDIR/yi yi_tr" -c q
29
30../README_yi.txt : README.txt
31    :copy $source $target
32
33#
34# Fetch the word list when needed.
35#
36URLDIR = http://www.cs.uky.edu/~raphael/yiddish
37:attr {fetch = $URLDIR/%file%} $WORDFILE $WORDFILE_TR
38
39# We use the word list as a .dic file, so that we can use an affix file to
40# define a few extra things.
41$FILES: {buildcheck=}
42        :assertpkg patch
43        :fetch $WORDFILE
44        :copy $WORDFILE yi.dic
45        :touch {force} yi.aff
46        @if os.path.exists('yi.diff'):
47            :sys patch < yi.diff
48
49$FILES_TR: {buildcheck=}
50        :assertpkg patch
51        :fetch $WORDFILE_TR
52        :copy $WORDFILE_TR yi_tr.dic
53        :touch {force} yi_tr.aff
54        @if os.path.exists('yi_tr.diff'):
55            :sys patch < yi_tr.diff
56
57diff {virtual}:
58    :assertpkg diff
59    # Using a context of two lines to work around a bug in FreeBSD patch.
60    :sys {force} diff -a -C 2 $WORDFILE yi.dic > yi.diff
61    :sys {force} diff -a -N -C 1 /dev/null yi.aff >> yi.diff
62    :sys {force} diff -a -C 2 $WORDFILE_TR yi_tr.dic > yi_tr.diff
63    :sys {force} diff -a -N -C 1 /dev/null yi_tr.aff >> yi_tr.diff
64
65# vim: set sts=4 sw=4 :
66