Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 1 | # Aap recipe for Portuguese Vim spell files. |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 2 | # See ftp://ftp.vim.org/pub/vim/runtime/spell/README.txt |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 3 | |
| 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 | |
| 10 | SPELLDIR = .. |
| 11 | FILES = pt_PT.aff pt_PT.dic |
| 12 | pt_BR.aff pt_BR.dic |
| 13 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 14 | # |
| 15 | # Fetching the pt_PT files from the Natura project. |
| 16 | # |
| 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 |
| 20 | |
| 21 | # |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 22 | # Fetching the pt_BR files from BrOffice.org (Brazilian OOo). |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 23 | # |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 24 | BR_FNAME = pt_BR-V.zip |
| 25 | BR_DIR = http://www.deso-se.com.br/downloads/broffice.org/$(BR_FNAME) |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 26 | :attr {fetch = $BR_DIR} $BR_FNAME |
| 27 | |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 28 | all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \ |
| 29 | ../README_pt.txt |
| 30 | |
| 31 | $SPELLDIR/pt.latin1.spl : $FILES |
Bram Moolenaar | 9c754c4 | 2010-07-10 15:52:35 +0200 | [diff] [blame] | 32 | :sys env LANG=pt_PT.ISO-8859-1 LC_ALL=pt_PT.ISO-8859-1 |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 33 | $VIM -u NONE -e -c "mkspell! $SPELLDIR/pt pt_PT pt_BR" -c q |
| 34 | |
| 35 | $SPELLDIR/pt.utf-8.spl : $FILES |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 36 | :sys env LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8 |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 37 | $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 Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 44 | :cat README_pt_BR.txt | :eval re.sub('\r', '', stdin) >>$target |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 45 | |
| 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 |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 50 | :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 Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 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 |
| 64 | |
| 65 | pt_BR.aff pt_BR.dic: {buildcheck=} |
| 66 | :assertpkg unzip patch |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 67 | :fetch $BR_FNAME |
| 68 | :sys $UNZIP $BR_FNAME |
| 69 | :delete $BR_FNAME |
Bram Moolenaar | 00a927d | 2010-05-14 23:24:24 +0200 | [diff] [blame] | 70 | :sys $VIM README_pt_BR.TXT -u NONE -e -c "set ff=unix" -c update -c q |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 71 | :move README_pt_BR.TXT README_pt_BR.txt |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 72 | |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 73 | # Vim seems to ignore the dots from the word list. |
| 74 | # Removing words with dot to avoid misbehaviour. |
Bram Moolenaar | 00a927d | 2010-05-14 23:24:24 +0200 | [diff] [blame] | 75 | :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 Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 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 |
| 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 | |
| 88 | diff: |
| 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 Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 98 | # TO BE IMPLEMENTED |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 99 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 100 | check: check-pt check-br |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 101 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 102 | check-pt: |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 103 | :assertpkg unzip diff |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 104 | :fetch $PT_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 105 | :mkdir tmp |
| 106 | :cd tmp |
| 107 | @try: |
| 108 | @import stat |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 109 | :sys $UNZIP ../$PT_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 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 |
| 116 | @finally: |
| 117 | :cd .. |
| 118 | :delete {r}{f}{q} tmp |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 119 | :delete $PT_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 120 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 121 | check-br: |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 122 | :assertpkg unzip diff |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 123 | :fetch $BR_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 124 | :mkdir tmp |
| 125 | :cd tmp |
| 126 | @try: |
| 127 | @import stat |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 128 | :sys $UNZIP ../$BR_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 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 |
| 135 | @finally: |
| 136 | :cd .. |
| 137 | :delete {r}{f}{q} tmp |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 138 | :delete $BR_FNAME |
Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 139 | |
| 140 | # vim: set sts=4 sw=4 : |