blob: 17ba24d33a6704c79b01f5f49ec190ad6175eba6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# Aap recipe for Portuguese Vim spell files.
#
# Use a freshly compiled Vim if it exists.
@if os.path.exists('../../../src/vim'):
VIM = ../../../src/vim
@else:
:progsearch VIM vim
SPELLDIR = ..
FILES = pt_PT.aff pt_PT.dic
pt_BR.aff pt_BR.dic
#
# Fetching the pt_PT files from the Natura project.
#
PT_DIR = http://natura.di.uminho.pt/download/sources/Dictionaries/myspell
PT_FNAME = myspell.pt-latest.zip
:attr {fetch = $PT_DIR/%file%} $PT_FNAME
#
# Fetching the pt_BR files from BrOffice.org (Brazilian OOo).
#
BR_FNAME = pt_BR-V.zip
BR_DIR = http://www.deso-se.com.br/downloads/broffice.org/$(BR_FNAME)
:attr {fetch = $BR_DIR} $BR_FNAME
all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \
../README_pt.txt
$SPELLDIR/pt.latin1.spl : $FILES
:sys env LANG=pt_PT.ISO8859-1 LC_ALL=pt_PT.ISO8859-1
$VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
$SPELLDIR/pt.utf-8.spl : $FILES
:sys env LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8
$VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q
../README_pt.txt: README_pt_PT.txt README_pt_BR.txt
:print pt_PT >!$target
:cat README_pt_PT.txt | :eval re.sub('\r', '', stdin) >>$target
:print =================================================== >>$target
:print pt_BR: >>$target
:cat README_pt_BR.txt | :eval re.sub('\r', '', stdin) >>$target
# The files don't depend on the .zip file so that we can delete it.
# Only download the zip file if the targets don't exist.
pt_PT.aff pt_PT.dic: {buildcheck=}
:assertpkg unzip patch
:fetch $PT_FNAME
:sys $UNZIP $PT_FNAME
:delete $PT_FNAME
:move myspell.pt-*/pt_PT.dic .
:move myspell.pt-*/pt_PT.aff .
:move myspell.pt-*/README_pt_PT.txt .
:move myspell.pt-*/COPYING COPYING_pt_PT.txt
:deldir myspell.pt-*
@if not os.path.exists('pt_PT.orig.aff'):
:copy pt_PT.aff pt_PT.orig.aff
@if not os.path.exists('pt_PT.orig.dic'):
:copy pt_PT.dic pt_PT.orig.dic
@if os.path.exists('pt_PT.diff'):
:sys patch <pt_PT.diff
pt_BR.aff pt_BR.dic: {buildcheck=}
:assertpkg unzip patch
:fetch $BR_FNAME
:sys $UNZIP $BR_FNAME
:delete $BR_FNAME
:sys $VIM README_pt_BR.TXT -e -c "set ff=unix" -c update -c q
:move README_pt_BR.TXT README_pt_BR.txt
# Vim seems to ignore the dots from the word list.
# Removing words with dot to avoid misbehaviour.
:sys $VIM pt_BR.dic -e -c "set ff=unix" -c "/\./d" -c update -c q
:sys $VIM pt_BR.aff -e -c "set ff=unix" -c update -c q
@if not os.path.exists('pt_BR.orig.aff'):
:copy pt_BR.aff pt_BR.orig.aff
@if not os.path.exists('pt_BR.orig.dic'):
:copy pt_BR.dic pt_BR.orig.dic
@if os.path.exists('pt_BR.diff'):
:sys patch <pt_BR.diff
# Generate diff files, so that others can get the OpenOffice files and apply
# the diffs to get the Vim versions.
diff:
:assertpkg diff
:sys {force} diff -a -C 1 pt_PT.orig.aff pt_PT.aff >pt_PT.diff
:sys {force} diff -a -C 1 pt_PT.orig.dic pt_PT.dic >>pt_PT.diff
:sys {force} diff -a -C 1 pt_BR.orig.aff pt_BR.aff >pt_BR.diff
:sys {force} diff -a -C 1 pt_BR.orig.dic pt_BR.dic >>pt_BR.diff
# Check for updated OpenOffice spell files. When there are changes the
# ".new.aff" and ".new.dic" files are left behind for manual inspection.
# TO BE IMPLEMENTED
check: check-pt check-br
check-pt:
:assertpkg unzip diff
:fetch $PT_FNAME
:mkdir tmp
:cd tmp
@try:
@import stat
:sys $UNZIP ../$PT_FNAME
:sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d
@if os.stat('d')[stat.ST_SIZE] > 0:
:copy pt_PT.aff ../pt_PT.new.aff
:sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d
@if os.stat('d')[stat.ST_SIZE] > 0:
:copy pt_PT.dic ../pt_PT.new.dic
@finally:
:cd ..
:delete {r}{f}{q} tmp
:delete $PT_FNAME
check-br:
:assertpkg unzip diff
:fetch $BR_FNAME
:mkdir tmp
:cd tmp
@try:
@import stat
:sys $UNZIP ../$BR_FNAME
:sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d
@if os.stat('d')[stat.ST_SIZE] > 0:
:copy pt_BR.aff ../pt_BR.new.aff
:sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d
@if os.stat('d')[stat.ST_SIZE] > 0:
:copy pt_BR.dic ../pt_BR.new.dic
@finally:
:cd ..
:delete {r}{f}{q} tmp
:delete $BR_FNAME
# vim: set sts=4 sw=4 :
|