1# Aap recipe for Catelan (Spain) 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    = ca_ES.aff ca_ES.dic
11
12all: $SPELLDIR/ca.latin1.spl $SPELLDIR/ca.utf-8.spl ../README_ca.txt
13
14$SPELLDIR/ca.latin1.spl : $FILES
15        :sys env LANG=ca_ES.ISO8859-1
16		$VIM -u NONE -e -c "mkspell! $SPELLDIR/ca ca_ES" -c q
17
18$SPELLDIR/ca.utf-8.spl : $FILES
19        :sys env LANG=ca_ES.UTF-8
20		$VIM -u NONE -e -c "mkspell! $SPELLDIR/ca ca_ES" -c q
21
22../README_ca.txt : README_ca_ES.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%} ca_ES.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# Make sure the files are in Unix fileformat
34ca_ES.aff ca_ES.dic: {buildcheck=}
35        :assertpkg unzip patch
36        :fetch ca_ES.zip
37        :sys $UNZIP ca_ES.zip
38        :delete ca_ES.zip
39        :sys $VIM ca_ES.aff -u NONE -c "set ff=unix" -c "update" -c q
40        :sys $VIM ca_ES.dic -u NONE -c "set ff=unix" -c "update" -c q
41        @if not os.path.exists('ca_ES.orig.aff'):
42            :copy ca_ES.aff ca_ES.orig.aff
43        @if not os.path.exists('ca_ES.orig.dic'):
44            :copy ca_ES.dic ca_ES.orig.dic
45        @if os.path.exists('ca_ES.diff'):
46            :sys patch <ca_ES.diff
47
48
49# Generate diff files, so that others can get the OpenOffice files and apply
50# the diffs to get the Vim versions.
51
52diff:
53        :assertpkg diff
54        :sys {force} diff -a -C 1 ca_ES.orig.aff ca_ES.aff >ca_ES.diff
55        :sys {force} diff -a -C 1 ca_ES.orig.dic ca_ES.dic >>ca_ES.diff
56
57
58# Check for updated OpenOffice spell files.  When there are changes the
59# ".new.aff" and ".new.dic" files are left behind for manual inspection.
60
61check:
62        :assertpkg unzip diff
63        :fetch ca_ES.zip
64        :mkdir tmp
65        :cd tmp
66        @try:
67            @import stat
68            :sys $UNZIP ../ca_ES.zip
69            :sys {force} diff ../ca_ES.orig.aff ca_ES.aff >d
70            @if os.stat('d')[stat.ST_SIZE] > 0:
71                :copy ca_ES.aff ../ca_ES.new.aff
72            :sys {force} diff ../ca_ES.orig.dic ca_ES.dic >d
73            @if os.stat('d')[stat.ST_SIZE] > 0:
74                :copy ca_ES.dic ../ca_ES.new.dic
75        @finally:
76            :cd ..
77            :delete {r}{f}{q} tmp
78            :delete ca_ES.zip
79
80
81# vim: set sts=4 sw=4 :
82