blob: 3d08faf6d6caa32724e962c661413722bc5302ba [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#
17PT_DIR = http://natura.di.uminho.pt/download/sources/Dictionaries/myspell
18PT_FNAME = myspell.pt-latest.zip
19:attr {fetch = $PT_DIR/%file%} $PT_FNAME
20
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 Moolenaarc1a11ed2008-06-24 22:09:24 +000024BR_FNAME = pt_BR-V.zip
25BR_DIR = http://www.deso-se.com.br/downloads/broffice.org/$(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 Moolenaarc81e5e72007-05-05 18:24:42 +000032 :sys env LANG=pt_PT.ISO8859-1 LC_ALL=pt_PT.ISO8859-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
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
57 :deldir myspell.pt-*
Bram Moolenaare344bea2005-09-01 20:46:49 +000058 @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
64
65pt_BR.aff pt_BR.dic: {buildcheck=}
66 :assertpkg unzip patch
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000067 :fetch $BR_FNAME
68 :sys $UNZIP $BR_FNAME
69 :delete $BR_FNAME
Bram Moolenaar00a927d2010-05-14 23:24:24 +020070 :sys $VIM README_pt_BR.TXT -u NONE -e -c "set ff=unix" -c update -c q
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000071 :move README_pt_BR.TXT README_pt_BR.txt
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000072
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +000073# Vim seems to ignore the dots from the word list.
74# Removing words with dot to avoid misbehaviour.
Bram Moolenaar00a927d2010-05-14 23:24:24 +020075 :sys $VIM pt_BR.dic -u NONE -e -c "set ff=unix" -c "/\./d" -c update -c q
76 :sys $VIM pt_BR.aff -u NONE -e -c "set ff=unix" -c update -c q
Bram Moolenaare344bea2005-09-01 20:46:49 +000077 @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
83
84
85# Generate diff files, so that others can get the OpenOffice files and apply
86# the diffs to get the Vim versions.
87
88diff:
89 :assertpkg diff
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
94
95
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.
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000098# TO BE IMPLEMENTED
Bram Moolenaare344bea2005-09-01 20:46:49 +000099
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000100check: check-pt check-br
Bram Moolenaare344bea2005-09-01 20:46:49 +0000101
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000102check-pt:
Bram Moolenaare344bea2005-09-01 20:46:49 +0000103 :assertpkg unzip diff
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000104 :fetch $PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000105 :mkdir tmp
106 :cd tmp
107 @try:
108 @import stat
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000109 :sys $UNZIP ../$PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000110 :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
116 @finally:
117 :cd ..
118 :delete {r}{f}{q} tmp
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000119 :delete $PT_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000120
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000121check-br:
Bram Moolenaare344bea2005-09-01 20:46:49 +0000122 :assertpkg unzip diff
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000123 :fetch $BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000124 :mkdir tmp
125 :cd tmp
126 @try:
127 @import stat
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000128 :sys $UNZIP ../$BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000129 :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
135 @finally:
136 :cd ..
137 :delete {r}{f}{q} tmp
Bram Moolenaarc1a11ed2008-06-24 22:09:24 +0000138 :delete $BR_FNAME
Bram Moolenaare344bea2005-09-01 20:46:49 +0000139
140# vim: set sts=4 sw=4 :