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'):
11 FILES = pt_PT.aff pt_PT.dic
15 # Fetching the pt_PT files from the Natura project.
17 PT_DIR = http://natura.di.uminho.pt/download/sources/Dictionaries/myspell
18 PT_FNAME = myspell.pt-latest.zip
19 :attr {fetch = $PT_DIR/%file%} $PT_FNAME
22 # Fetching the pt_BR files from BrOffice.org (Brazilian OOo).
24 BR_FNAME = pt_BR-V.zip
25 BR_DIR = http://www.deso-se.com.br/downloads/broffice.org/$(BR_FNAME)
26 :attr {fetch = $BR_DIR} $BR_FNAME
28 all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \
31 $SPELLDIR/pt.latin1.spl : $FILES
32 :sys env LANG=pt_PT.ISO8859-1 LC_ALL=pt_PT.ISO8859-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
53 :move myspell.pt-*/pt_PT.dic .
54 :move myspell.pt-*/pt_PT.aff .
55 :move myspell.pt-*/README_pt_PT.txt .
56 :move myspell.pt-*/COPYING COPYING_pt_PT.txt
58 @if not os.path.exists('pt_PT.orig.aff'):
59 :copy pt_PT.aff pt_PT.orig.aff
60 @if not os.path.exists('pt_PT.orig.dic'):
61 :copy pt_PT.dic pt_PT.orig.dic
62 @if os.path.exists('pt_PT.diff'):
63 :sys patch <pt_PT.diff
65 pt_BR.aff pt_BR.dic: {buildcheck=}
66 :assertpkg unzip patch
70 :sys $VIM README_pt_BR.TXT -e -c "set ff=unix" -c update -c q
71 :move README_pt_BR.TXT README_pt_BR.txt
73 # Vim seems to ignore the dots from the word list.
74 # Removing words with dot to avoid misbehaviour.
75 :sys $VIM pt_BR.dic -e -c "set ff=unix" -c "/\./d" -c update -c q
76 :sys $VIM pt_BR.aff -e -c "set ff=unix" -c update -c q
77 @if not os.path.exists('pt_BR.orig.aff'):
78 :copy pt_BR.aff pt_BR.orig.aff
79 @if not os.path.exists('pt_BR.orig.dic'):
80 :copy pt_BR.dic pt_BR.orig.dic
81 @if os.path.exists('pt_BR.diff'):
82 :sys patch <pt_BR.diff
85 # Generate diff files, so that others can get the OpenOffice files and apply
86 # the diffs to get the Vim versions.
90 :sys {force} diff -a -C 1 pt_PT.orig.aff pt_PT.aff >pt_PT.diff
91 :sys {force} diff -a -C 1 pt_PT.orig.dic pt_PT.dic >>pt_PT.diff
92 :sys {force} diff -a -C 1 pt_BR.orig.aff pt_BR.aff >pt_BR.diff
93 :sys {force} diff -a -C 1 pt_BR.orig.dic pt_BR.dic >>pt_BR.diff
96 # Check for updated OpenOffice spell files. When there are changes the
97 # ".new.aff" and ".new.dic" files are left behind for manual inspection.
100 check: check-pt check-br
103 :assertpkg unzip diff
109 :sys $UNZIP ../$PT_FNAME
110 :sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d
111 @if os.stat('d')[stat.ST_SIZE] > 0:
112 :copy pt_PT.aff ../pt_PT.new.aff
113 :sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d
114 @if os.stat('d')[stat.ST_SIZE] > 0:
115 :copy pt_PT.dic ../pt_PT.new.dic
118 :delete {r}{f}{q} tmp
122 :assertpkg unzip diff
128 :sys $UNZIP ../$BR_FNAME
129 :sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d
130 @if os.stat('d')[stat.ST_SIZE] > 0:
131 :copy pt_BR.aff ../pt_BR.new.aff
132 :sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d
133 @if os.stat('d')[stat.ST_SIZE] > 0:
134 :copy pt_BR.dic ../pt_BR.new.dic
137 :delete {r}{f}{q} tmp
140 # vim: set sts=4 sw=4 :