update runtime files
[vim_extended.git] / runtime / spell / pt / main.aap
blob43a3be4ff1dc635ff17dc0cb58286f870411ccc0
1 # Aap recipe for Portuguese Vim spell files.
2 # See ftp://ftp.vim.org/pub/vim/runtime/spell/README.txt
4 # Use a freshly compiled Vim if it exists.
5 @if os.path.exists('../../../src/vim'):
6     VIM = ../../../src/vim
7 @else:
8     :progsearch VIM vim
10 SPELLDIR = ..
11 FILES    = pt_PT.aff pt_PT.dic
12            pt_BR.aff pt_BR.dic
15 # Fetching the pt_PT files from the Natura project.
17 PT_FNAME = oo3x-pt-PT.oxt
18 PT_DIR = http://extensions.services.openoffice.org/e-files/1196/5/$(PT_FNAME)
19 :attr {fetch = $PT_DIR} $PT_FNAME
22 # Fetching the pt_BR files from BrOffice.org (Brazilian OOo).
24 BR_FNAME = Vero_pt_BR_V207AOC.oxt
25 BR_DIR = http://www.broffice.org/files/$(BR_FNAME)
26 :attr {fetch = $BR_DIR} $BR_FNAME
28 all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \
29         ../README_pt.txt
31 $SPELLDIR/pt.latin1.spl : $FILES
32         :sys env LANG=pt_PT.ISO-8859-1 LC_ALL=pt_PT.ISO-8859-1
33                 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
35 $SPELLDIR/pt.utf-8.spl : $FILES
36         :sys env LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8
37                 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
39 ../README_pt.txt: README_pt_PT.txt README_pt_BR.txt
40         :print pt_PT >!$target
41         :cat README_pt_PT.txt | :eval re.sub('\r', '', stdin) >>$target
42         :print =================================================== >>$target
43         :print pt_BR: >>$target
44         :cat README_pt_BR.txt | :eval re.sub('\r', '', stdin) >>$target
46 # The files don't depend on the .zip file so that we can delete it.
47 # Only download the zip file if the targets don't exist.
48 pt_PT.aff pt_PT.dic: {buildcheck=}
49         :assertpkg unzip patch
50         :fetch $PT_FNAME
51         :sys $UNZIP $PT_FNAME
52         :delete $PT_FNAME
53         :move dictionaries/pt_PT.dic .
54         :move dictionaries/pt_PT.aff .
55         :move dictionaries/README_pt_PT.txt .
56         :move dictionaries/COPYING COPYING_pt_PT.txt
57         :delete {r}{f} dictionaries
58         :delete {r}{f} META-INF
59         :delete {f} description.xml
60         :delete {f} dictionaries.xcu
61         :delete {f} LICENSES.txt
62         :sys $VIM pt_PT.dic -u NONE -e -c "%s/\t.*//" -c update -c q
63         :sys $VIM pt_PT.aff -u NONE -e -c "%s/\S\+=\S\+$$//" -c update -c q
64         @if not os.path.exists('pt_PT.orig.aff'):
65             :copy pt_PT.aff pt_PT.orig.aff
66         @if not os.path.exists('pt_PT.orig.dic'):
67             :copy pt_PT.dic pt_PT.orig.dic
68         @if os.path.exists('pt_PT.diff'):
69             :sys patch <pt_PT.diff
71 pt_BR.aff pt_BR.dic: {buildcheck=}
72         :assertpkg unzip patch
73         :fetch $BR_FNAME
74         :sys $UNZIP $BR_FNAME
75         :delete $BR_FNAME
76         :sys $VIM README_pt_BR.TXT -u NONE -N -e -c "set ff=unix" -c update -c q
77         :move README_pt_BR.TXT README_pt_BR.txt
79         :sys $VIM pt_BR.dic -u NONE -N -e -c "set ff=unix" -c update -c q
80         :sys $VIM pt_BR.aff -u NONE -N -e -c "set ff=unix" -c update -c q
81         @if not os.path.exists('pt_BR.orig.aff'):
82             :copy pt_BR.aff pt_BR.orig.aff
83         @if not os.path.exists('pt_BR.orig.dic'):
84             :copy pt_BR.dic pt_BR.orig.dic
85         @if os.path.exists('pt_BR.diff'):
86             :sys patch <pt_BR.diff
89 # Generate diff files, so that others can get the OpenOffice files and apply
90 # the diffs to get the Vim versions.
92 diff:
93         :assertpkg diff
94         :sys {force} diff -a -C 1 pt_PT.orig.aff pt_PT.aff >pt_PT.diff
95         :sys {force} diff -a -C 1 pt_PT.orig.dic pt_PT.dic >>pt_PT.diff
96         :sys {force} diff -a -C 1 pt_BR.orig.aff pt_BR.aff >pt_BR.diff
97         :sys {force} diff -a -C 1 pt_BR.orig.dic pt_BR.dic >>pt_BR.diff
99 # Delete all downloaded and generated files.
100 clean: clean_pt_BR clean_pt_PT
102 clean_pt_BR:
103         :delete {f} pt_BR.aff
104         :delete {f} pt_BR.dic
105         :delete {f} pt_BR.orig.aff
106         :delete {f} pt_BR.orig.dic
107         :delete {f} README_pt_BR.txt
109 clean_pt_PT:
110         :delete {f} pt_PT.aff
111         :delete {f} pt_PT.dic
112         :delete {f} pt_PT.orig.aff
113         :delete {f} pt_PT.orig.dic
114         :delete {f} README_pt_PT.txt
115         :delete {f} COPYING_pt_PT.txt
117 # Check for updated OpenOffice spell files.  When there are changes the
118 # ".new.aff" and ".new.dic" files are left behind for manual inspection.
119 # TO BE IMPLEMENTED
121 check: check-pt check-br
123 check-pt:
124         :assertpkg unzip diff
125         :fetch $PT_FNAME
126         :mkdir tmp
127         :cd tmp
128         @try:
129             @import stat
130             :sys $UNZIP ../$PT_FNAME
131             :sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d
132             @if os.stat('d')[stat.ST_SIZE] > 0:
133                 :copy pt_PT.aff ../pt_PT.new.aff
134             :sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d
135             @if os.stat('d')[stat.ST_SIZE] > 0:
136                 :copy pt_PT.dic ../pt_PT.new.dic
137         @finally:
138             :cd ..
139             :delete {r}{f}{q} tmp
140             :delete $PT_FNAME
142 check-br:
143         :assertpkg unzip diff
144         :fetch $BR_FNAME
145         :mkdir tmp
146         :cd tmp
147         @try:
148             @import stat
149             :sys $UNZIP ../$BR_FNAME
150             :sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d
151             @if os.stat('d')[stat.ST_SIZE] > 0:
152                 :copy pt_BR.aff ../pt_BR.new.aff
153             :sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d
154             @if os.stat('d')[stat.ST_SIZE] > 0:
155                 :copy pt_BR.dic ../pt_BR.new.dic
156         @finally:
157             :cd ..
158             :delete {r}{f}{q} tmp
159             :delete $BR_FNAME
161 # vim: set sts=4 sw=4 :