# Aap recipe for Portuguese Vim spell files. # # Based on a shell script by Leonardo Fontenelle. # His remarks: # # Makes a Vim pt dictionary from OpenOffice.org's pt_BR and pt_PT. # # AFAIK, will have to update the script every time a new dictionary is # released for pt_BR. I asked the maintainer to update OOo's FTP site, # but it didn't happen yet. As for the pt_PT dictionary, they won't be # in OOo's FTP site for some time, because the Portuguese OOo project # decided to adapt the pt_BR dictionary, which is much more extensive. # I picked the Natura project unofficial dictionary, because it has been # developed by a team with linguists, and for a longer time. At least the # pt_PT dictionary has a "latest" file to make our lives easier. # 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) 2.1. Should be # updated really soon. # BR_BASENAME = pt_BR-2007-04-11 BR_DIR = http://www.deso-se.com.br/downloads/download.php?arquivo=$BR_BASENAME BR_FNAME = $(BR_BASENAME).zip :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 :print Information is in Leia-me.pdf, see $BR_DIR >>$target :cat README_pt_BR.txt >>$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 :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_PT.zip :mkdir tmp :cd tmp @try: @import stat :sys $UNZIP ../pt_PT.zip :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_PT.zip check-br: :assertpkg unzip diff :fetch pt_BR.zip :mkdir tmp :cd tmp @try: @import stat :sys $UNZIP ../pt_BR.zip :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 pt_BR.zip # vim: set sts=4 sw=4 :