blob: 2770f9315eb9e0994d2b4495f9e2eb50405329a0 [file] [log] [blame]
Bram Moolenaare344bea2005-09-01 20:46:49 +00001# Aap recipe for Portuguese Vim spell files.
Bram Moolenaare37d50a2008-08-06 17:06:04 +00002# See ftp://ftp.vim.org/pub/vim/runtime/spell/README.txt
Bram Moolenaare344bea2005-09-01 20:46:49 +00003
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
9
10SPELLDIR = ..
11FILES = pt_PT.aff pt_PT.dic
12 pt_BR.aff pt_BR.dic
13
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000014#
15# Fetching the pt_PT files from the Natura project.
16#
Bram Moolenaar0ee8df92010-08-10 22:53:02 +020017PT_FNAME = oo3x-pt-PT.oxt
18PT_DIR = http://extensions.services.openoffice.org/e-files/1196/5/$(PT_FNAME)
19:attr {fetch = $PT_DIR} $PT_FNAME
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000020
21#
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000022# Fetching the pt_BR files from BrOffice.org (Brazilian OOo).
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000023#
Bram Moolenaar0ee8df92010-08-10 22:53:02 +020024BR_FNAME = Vero_pt_BR_V207AOC.oxt
25BR_DIR = http://www.broffice.org/files/$(BR_FNAME)
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000026:attr {fetch = $BR_DIR} $BR_FNAME
27
Bram Moolenaare344bea2005-09-01 20:46:49 +000028all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \
29 ../README_pt.txt
30
31$SPELLDIR/pt.latin1.spl : $FILES
Bram Moolenaar9c754c42010-07-10 15:52:35 +020032 :sys env LANG=pt_PT.ISO-8859-1 LC_ALL=pt_PT.ISO-8859-1
Bram Moolenaare344bea2005-09-01 20:46:49 +000033 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
34
35$SPELLDIR/pt.utf-8.spl : $FILES
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000036 :sys env LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8
Bram Moolenaare344bea2005-09-01 20:46:49 +000037 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
38
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
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000044 :cat README_pt_BR.txt | :eval re.sub('\r', '', stdin) >>$target
Bram Moolenaare344bea2005-09-01 20:46:49 +000045
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.
48pt_PT.aff pt_PT.dic: {buildcheck=}
49 :assertpkg unzip patch
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000050 :fetch $PT_FNAME
51 :sys $UNZIP $PT_FNAME
52 :delete $PT_FNAME
Bram Moolenaar0ee8df92010-08-10 22:53:02 +020053 :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
Bram Moolenaare344bea2005-09-01 20:46:49 +000064 @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
70
71pt_BR.aff pt_BR.dic: {buildcheck=}
72 :assertpkg unzip patch
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000073 :fetch $BR_FNAME
74 :sys $UNZIP $BR_FNAME
75 :delete $BR_FNAME
Bram Moolenaarfae6c1a2010-08-11 23:11:47 +020076 :delete {f} description.xml
77 :delete {f} dictionaries.xcu
78 :delete {f} hyph_pt_BR.dic
79 :delete {r}{f} META-INF
80 :delete {f} README_en.TXT
81 :delete {f} README_hyph_pt_BR.TXT
Bram Moolenaar0ee8df92010-08-10 22:53:02 +020082 :sys $VIM README_pt_BR.TXT -u NONE -N -e -c "set ff=unix" -c update -c q
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000083 :move README_pt_BR.TXT README_pt_BR.txt
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000084
Bram Moolenaar0ee8df92010-08-10 22:53:02 +020085 :sys $VIM pt_BR.dic -u NONE -N -e -c "set ff=unix" -c update -c q
86 :sys $VIM pt_BR.aff -u NONE -N -e -c "set ff=unix" -c update -c q
Bram Moolenaare344bea2005-09-01 20:46:49 +000087 @if not os.path.exists('pt_BR.orig.aff'):
88 :copy pt_BR.aff pt_BR.orig.aff
89 @if not os.path.exists('pt_BR.orig.dic'):
90 :copy pt_BR.dic pt_BR.orig.dic
91 @if os.path.exists('pt_BR.diff'):
92 :sys patch <pt_BR.diff
93
94
95# Generate diff files, so that others can get the OpenOffice files and apply
96# the diffs to get the Vim versions.
97
98diff:
99 :assertpkg diff
100 :sys {force} diff -a -C 1 pt_PT.orig.aff pt_PT.aff >pt_PT.diff
101 :sys {force} diff -a -C 1 pt_PT.orig.dic pt_PT.dic >>pt_PT.diff
102 :sys {force} diff -a -C 1 pt_BR.orig.aff pt_BR.aff >pt_BR.diff
103 :sys {force} diff -a -C 1 pt_BR.orig.dic pt_BR.dic >>pt_BR.diff
104
Bram Moolenaar0ee8df92010-08-10 22:53:02 +0200105# Delete all downloaded and generated files.
106clean: clean_pt_BR clean_pt_PT
107
108clean_pt_BR:
109 :delete {f} pt_BR.aff
110 :delete {f} pt_BR.dic
111 :delete {f} pt_BR.orig.aff
112 :delete {f} pt_BR.orig.dic
113 :delete {f} README_pt_BR.txt
114
115clean_pt_PT:
116 :delete {f} pt_PT.aff
117 :delete {f} pt_PT.dic
118 :delete {f} pt_PT.orig.aff
119 :delete {f} pt_PT.orig.dic
120 :delete {f} README_pt_PT.txt
121 :delete {f} COPYING_pt_PT.txt
Bram Moolenaare344bea2005-09-01 20:46:49 +0000122
123# Check for updated OpenOffice spell files. When there are changes the
124# ".new.aff" and ".new.dic" files are left behind for manual inspection.
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000125# TO BE IMPLEMENTED
Bram Moolenaare344bea2005-09-01 20:46:49 +0000126
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000127check: check-pt check-br
Bram Moolenaare344bea2005-09-01 20:46:49 +0000128
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000129check-pt:
Bram Moolenaare344bea2005-09-01 20:46:49 +0000130 :assertpkg unzip diff
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000131 :fetch $PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000132 :mkdir tmp
133 :cd tmp
134 @try:
135 @import stat
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000136 :sys $UNZIP ../$PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000137 :sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d
138 @if os.stat('d')[stat.ST_SIZE] > 0:
139 :copy pt_PT.aff ../pt_PT.new.aff
140 :sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d
141 @if os.stat('d')[stat.ST_SIZE] > 0:
142 :copy pt_PT.dic ../pt_PT.new.dic
143 @finally:
144 :cd ..
145 :delete {r}{f}{q} tmp
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000146 :delete $PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000147
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000148check-br:
Bram Moolenaare344bea2005-09-01 20:46:49 +0000149 :assertpkg unzip diff
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000150 :fetch $BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000151 :mkdir tmp
152 :cd tmp
153 @try:
154 @import stat
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000155 :sys $UNZIP ../$BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000156 :sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d
157 @if os.stat('d')[stat.ST_SIZE] > 0:
158 :copy pt_BR.aff ../pt_BR.new.aff
159 :sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d
160 @if os.stat('d')[stat.ST_SIZE] > 0:
161 :copy pt_BR.dic ../pt_BR.new.dic
162 @finally:
163 :cd ..
164 :delete {r}{f}{q} tmp
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000165 :delete $BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000166
167# vim: set sts=4 sw=4 :