vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

main.aap (4558B)


      1 # Aap recipe for French Vim spell files.
      2 
      3 # Use a freshly compiled Vim if it exists.
      4 @if os.path.exists('../../../src/vim'):
      5     VIM = ../../../src/vim
      6 @else:
      7     :progsearch VIM vim
      8 
      9 SPELLDIR = ..
     10 FILES    = fr_FR.aff fr_FR.dic
     11 
     12 all: $SPELLDIR/fr.latin1.spl $SPELLDIR/fr.utf-8.spl ../README_fr.txt
     13 
     14 # The spell file is iso-8859-15, but Vim normally uses "latin1" for this.
     15 # This is OK for the utf-8 files, but for latin1 we need to avoid the "oe"
     16 # character.  When unpacking we create four files:
     17 #    fr_FR_latin1.aff    modified file
     18 #    fr_FR_latin1.dic    modified file
     19 #    fr_FR_iso15.aff     original file (after applying diff)
     20 #    fr_FR_iso15.dic     original file (after applying diff)
     21 # Just before using the dictionary files, the right ones are copied to
     22 #    fr_FR.aff
     23 #    fr_FR.dic
     24 
     25 $SPELLDIR/fr.latin1.spl : $FILES
     26         :copy {force} fr_FR_latin1.aff fr_FR.aff
     27         :copy {force} fr_FR_latin1.dic fr_FR.dic
     28         :sys env LANG=fr_FR.ISO-8859-15@euro
     29 		$VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q
     30 
     31 $SPELLDIR/fr.utf-8.spl : $FILES
     32         :copy {force} fr_FR_iso15.aff fr_FR.aff
     33         :copy {force} fr_FR_iso15.dic fr_FR.dic
     34         :sys env LANG=fr_FR.UTF-8
     35 		$VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q
     36 
     37 ../README_fr.txt : README_fr_FR.txt
     38         :cat $source >!$target
     39 
     40 #
     41 # Used to fetch the files from OpenOffice.org.  Those are old.
     42 # Later versions are elsewhere.
     43 #
     44 #OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
     45 ZIPFILE = http://dico.savant.free.fr/_download/fr_FR_1-1-6.zip
     46 
     47 :attr {fetch = $ZIPFILE} fr_FR.zip
     48 
     49 # The files don't depend on the .zip file so that we can delete it.
     50 # Only download the zip file if the targets don't exist.
     51 fr_FR.aff fr_FR.dic: {buildcheck=}
     52         :assertpkg unzip patch
     53         :fetch fr_FR.zip
     54         :sys $UNZIP fr_FR.zip
     55         :delete fr_FR.zip
     56         @if not os.path.exists('fr_FR.orig.aff'):
     57             :copy fr_FR.aff fr_FR.orig.aff
     58         @if not os.path.exists('fr_FR.orig.dic'):
     59             :copy fr_FR.dic fr_FR.orig.dic
     60         @if os.path.exists('fr_FR.diff'):
     61             :sys patch <fr_FR.diff
     62 
     63         # Keep the unmodified files (after diff) for ISO-8859-15.
     64         :copy fr_FR.aff fr_FR_iso15.aff
     65         :copy fr_FR.dic fr_FR_iso15.dic
     66         # For the latin1 .dic file change all the "oe" characters to the two
     67         # characters "oe".
     68         :sys $VIM -u NONE -e -c "set enc=latin1"
     69                     -c "e fr_FR.dic"
     70                     -c "%s/½/oe/g"
     71                     -c "w! fr_FR_latin1.dic"
     72                     -c q
     73         # For the latin1 .aff file delete all the "oe" and "OE" characters and
     74         # delete the REP lines with those characters.
     75         :sys $VIM -u NONE -e -c "set enc=latin1"
     76                     -c "e fr_FR.aff"
     77                     -c "%s/½//g"
     78                     -c "%s/¼//g"
     79                     -c "%g/REP.*oe/d"
     80                     -c "w! fr_FR_latin1.aff"
     81                     -c q
     82 
     83 
     84 # Generate diff files, so that others can get the OpenOffice files and apply
     85 # the diffs to get the Vim versions.
     86 # This uses the iso-8859-15 files.
     87 diff:
     88         :assertpkg diff
     89         :copy {force} fr_FR_iso15.aff fr_FR.aff
     90         :copy {force} fr_FR_iso15.dic fr_FR.dic
     91         :sys {force} diff -a -C 1 fr_FR.orig.aff fr_FR.aff >fr_FR.diff
     92         :sys {force} diff -a -C 1 fr_FR.orig.dic fr_FR.dic >>fr_FR.diff
     93 
     94 # Delete all the unpacked and generated files, including the "orig" files.
     95 clean:
     96         :delete {force} fr_FR.zip fr_FR.aff fr_FR.dic
     97                         fr_FR.aff.orig fr_FR.dic.orig
     98                         fr_FR.orig.aff fr_FR.orig.dic
     99                         fr_FR_latin1.aff fr_FR_latin1.dic
    100                         fr_FR_iso15.aff fr_FR_iso15.dic
    101                         README_fr_FR.txt
    102 
    103 # Check for updated OpenOffice spell files.  When there are changes the
    104 # ".new.aff" and ".new.dic" files are left behind for manual inspection.
    105 
    106 check:
    107         :assertpkg unzip diff
    108         :fetch fr_FR.zip
    109         :mkdir tmp
    110         :cd tmp
    111         @try:
    112             @import stat
    113             :sys $UNZIP ../fr_FR.zip
    114             :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d
    115             @if os.stat('d')[stat.ST_SIZE] > 0:
    116                 :copy fr_FR.aff ../fr_FR.new.aff
    117             :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d
    118             @if os.stat('d')[stat.ST_SIZE] > 0:
    119                 :copy fr_FR.dic ../fr_FR.new.dic
    120         @finally:
    121             :cd ..
    122             :delete {r}{f}{q} tmp
    123             :delete fr_FR.zip
    124 
    125 
    126 # vim: set sts=4 sw=4 :