Bram Moolenaar | e344bea | 2005-09-01 20:46:49 +0000 | [diff] [blame] | 1 | # Aap recipe for Zulu 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 = zu_ZA.aff zu_ZA.dic |
| 11 | |
| 12 | # There is no Zulu locale, use the Dutch one instead. |
| 13 | all: $SPELLDIR/zu.latin1.spl $SPELLDIR/zu.utf-8.spl \ |
| 14 | $SPELLDIR/zu.ascii.spl ../README_zu.txt |
| 15 | |
| 16 | $SPELLDIR/zu.latin1.spl : $FILES |
| 17 | :sys env LANG=nl_NL.ISO8859-1 |
| 18 | $VIM -u NONE -e -c "mkspell! $SPELLDIR/zu zu_ZA" -c q |
| 19 | |
| 20 | $SPELLDIR/zu.utf-8.spl : $FILES |
| 21 | :sys env LANG=nl_NL.UTF-8 |
| 22 | $VIM -u NONE -e -c "mkspell! $SPELLDIR/zu zu_ZA" -c q |
| 23 | |
| 24 | $SPELLDIR/zu.ascii.spl : $FILES |
| 25 | :sys $VIM -u NONE -e -c "mkspell! -ascii $SPELLDIR/zu zu_ZA" -c q |
| 26 | |
| 27 | ../README_zu.txt : README_zu_ZA.txt |
| 28 | :copy $source $target |
| 29 | |
| 30 | # |
| 31 | # Fetching the files from OpenOffice.org. |
| 32 | # |
| 33 | OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries |
| 34 | :attr {fetch = $OODIR/%file%} zu_ZA.zip |
| 35 | |
| 36 | # The files don't depend on the .zip file so that we can delete it. |
| 37 | # Only download the zip file if the targets don't exist. |
| 38 | zu_ZA.aff zu_ZA.dic: {buildcheck=} |
| 39 | :assertpkg unzip patch |
| 40 | :fetch zu_ZA.zip |
| 41 | :sys $UNZIP zu_ZA.zip |
| 42 | :delete zu_ZA.zip |
| 43 | @if not os.path.exists('zu_ZA.orig.aff'): |
| 44 | :copy zu_ZA.aff zu_ZA.orig.aff |
| 45 | @if not os.path.exists('zu_ZA.orig.dic'): |
| 46 | :copy zu_ZA.dic zu_ZA.orig.dic |
| 47 | @if os.path.exists('zu_ZA.diff'): |
| 48 | :sys patch <zu_ZA.diff |
| 49 | |
| 50 | |
| 51 | # Generate diff files, so that others can get the OpenOffice files and apply |
| 52 | # the diffs to get the Vim versions. |
| 53 | |
| 54 | diff: |
| 55 | :assertpkg diff |
| 56 | :sys {force} diff -a -C 1 zu_ZA.orig.aff zu_ZA.aff >zu_ZA.diff |
| 57 | :sys {force} diff -a -C 1 zu_ZA.orig.dic zu_ZA.dic >>zu_ZA.diff |
| 58 | |
| 59 | |
| 60 | # Check for updated OpenOffice spell files. When there are changes the |
| 61 | # ".new.aff" and ".new.dic" files are left behind for manual inspection. |
| 62 | |
| 63 | check: |
| 64 | :assertpkg unzip diff |
| 65 | :fetch zu_ZA.zip |
| 66 | :mkdir tmp |
| 67 | :cd tmp |
| 68 | @try: |
| 69 | @import stat |
| 70 | :sys $UNZIP ../zu_ZA.zip |
| 71 | :sys {force} diff ../zu_ZA.orig.aff zu_ZA.aff >d |
| 72 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 73 | :copy zu_ZA.aff ../zu_ZA.new.aff |
| 74 | :sys {force} diff ../zu_ZA.orig.dic zu_ZA.dic >d |
| 75 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 76 | :copy zu_ZA.dic ../zu_ZA.new.dic |
| 77 | @finally: |
| 78 | :cd .. |
| 79 | :delete {r}{f}{q} tmp |
| 80 | :delete zu_ZA.zip |
| 81 | |
| 82 | |
| 83 | # vim: set sts=4 sw=4 : |