Bram Moolenaar | 3ad8772 | 2018-02-27 17:11:01 +0100 | [diff] [blame] | 1 | # Aap recipe for Serbian 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 = sr_RS.aff sr_RS.dic |
| 11 | 'sr_RS@latin.aff' 'sr_RS@latin.dic' |
| 12 | |
| 13 | all: $SPELLDIR/sr.utf-8.spl $SPELLDIR/'sr@latin.utf-8.spl' ../README_sr.txt |
| 14 | |
| 15 | # Original files will be in the subfolder hunspell-sr after unpacking: |
| 16 | # sr.dic original cyrillic dictionary |
| 17 | # sr.aff original cyrillic affix file |
| 18 | # sr-Latn.dic original latin dictionary file |
| 19 | # sr-Latn.aff original latin affix file |
| 20 | # Just before using the dictionary files, the right ones are copied to |
| 21 | # sr_RS.aff |
| 22 | # sr_RS.dic |
| 23 | # and |
| 24 | # sr_RS@latin.aff |
| 25 | # sr_RS@latin.dic |
| 26 | |
| 27 | $SPELLDIR/sr.utf-8.spl : $FILES |
| 28 | :sys env LANG=sr_RS.UTF-8 |
| 29 | $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr sr_RS" -c q |
| 30 | |
| 31 | $SPELLDIR/"sr@latin.utf-8.spl" : $FILES |
| 32 | :sys env LANG=sr_RS@latin.UTF-8 |
| 33 | $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/sr@latin sr_RS@latin" -c q |
| 34 | |
| 35 | ../README_sr.txt : hunspell-sr/README_sr.txt README_sr_RS.txt |
| 36 | :cat README_sr_RS.txt >!$target |
| 37 | :print >>$target |
| 38 | :print ============================================================== >>$target |
| 39 | :print Следи оригинална README датотека: >>$target |
| 40 | :print >>$target |
| 41 | :cat hunspell-sr/README_sr.txt >>$target |
| 42 | |
| 43 | # |
| 44 | # Used to fetch the files. |
| 45 | # |
| 46 | ZIPFILE = http://devbase.net/dict-sr/hunspell-sr-20130715.zip |
| 47 | |
| 48 | :attr {fetch = $ZIPFILE} sr_RS.zip |
| 49 | |
| 50 | # The files don't depend on the .zip file so that we can delete it. |
| 51 | # Only download the zip file if the targets don't exist. |
| 52 | sr_RS.aff sr_RS.dic: {buildcheck=} |
| 53 | :assertpkg unzip patch |
| 54 | :fetch sr_RS.zip |
| 55 | :sys $UNZIP sr_RS.zip |
| 56 | :delete sr_RS.zip |
| 57 | @if not os.path.exists('sr_RS.orig.aff'): |
| 58 | :copy hunspell-sr/sr.aff sr_RS.orig.aff |
| 59 | @if not os.path.exists('sr_RS.orig.dic'): |
| 60 | :copy hunspell-sr/sr.dic sr_RS.orig.dic |
| 61 | @if os.path.exists('sr_RS.diff'): |
| 62 | :sys patch <sr_RS.diff |
| 63 | :copy sr_RS.orig.aff sr_RS.aff |
| 64 | :copy sr_RS.orig.dic sr_RS.dic |
| 65 | |
| 66 | # Remove the 3 misspelled words and update the word count |
| 67 | # :sys $VIM -u NONE -e -c "set enc=utf-8" |
| 68 | # -c "e sr_RS.orig.dic" |
| 69 | # -c "%g/ажуриранје/d" |
| 70 | # -c "%g/вишнја/d" |
| 71 | # -c "%g/вишнјевац/d" |
| 72 | # -c "%s/263909/263906/e" |
| 73 | # -c "w! sr_RS.dic" |
| 74 | # -c q |
| 75 | |
| 76 | sr_RS@latin.aff sr_RS@latin.dic: {buildcheck=} |
| 77 | :assertpkg unzip patch |
| 78 | :fetch sr_RS.zip |
| 79 | :sys $UNZIP sr_RS.zip |
| 80 | :delete sr_RS.zip |
| 81 | @if not os.path.exists('sr_RS@latin.orig.aff'): |
| 82 | :copy hunspell-sr/sr-Latn.aff 'sr_RS@latin.orig.aff' |
| 83 | @if not os.path.exists('sr_RS@latin.orig.dic'): |
| 84 | :copy hunspell-sr/sr-Latn.dic 'sr_RS@latin.orig.dic' |
| 85 | @if os.path.exists('sr_RS@latin.diff'): |
| 86 | :sys patch <'sr_RS@latin.diff' |
| 87 | :copy 'sr_RS@latin.orig.aff' 'sr_RS@latin.aff' |
| 88 | :copy 'sr_RS@latin.orig.dic' 'sr_RS@latin.dic' |
| 89 | |
| 90 | |
| 91 | # Remove the 3 duplicated words and update the word count |
| 92 | # :sys $VIM -u NONE -e -c "set enc=utf-8" |
| 93 | # -c "e sr_RS@latin.orig.dic" |
| 94 | # -c "%g/\v(ažuriranje)(\_.*\1)@=/d" |
| 95 | # -c "%g/\v(višnja)(\_.*\1)@=/d" |
| 96 | # -c "%g/\v(višnjevac)(\_.*\1)@=/d" |
| 97 | # -c "%s/263909/263906/e" |
| 98 | # -c "w! sr_RS@latin.dic" |
| 99 | # -c q |
| 100 | |
| 101 | # Generate diff files, so that others can get the files and apply |
| 102 | # the diffs to get the Vim versions. |
| 103 | diff: |
| 104 | :assertpkg diff |
| 105 | :sys {force} diff -a -C 1 sr_RS.orig.aff sr_RS.aff >sr_RS.diff |
| 106 | :sys {force} diff -a -C 1 sr_RS.orig.dic sr_RS.dic >>sr_RS.diff |
| 107 | :sys {force} diff -a -C 1 'sr_RS@latin.orig.aff' 'sr_RS@latin.aff' >'sr_RS@latin.diff' |
| 108 | :sys {force} diff -a -C 1 'sr_RS@latin.orig.dic' 'sr_RS@latin.dic' >>'sr_RS@latin.diff' |
| 109 | |
| 110 | # Delete all the unpacked and generated files, including the "orig" files. |
| 111 | clean: |
| 112 | :delete {force} sr_RS.zip sr_RS.dic |
| 113 | sr_RS.orig.aff sr_RS.orig.dic |
| 114 | sr_RS.aff |
| 115 | 'sr_RS@latin.dic' 'sr_RS@latin.aff' |
| 116 | 'sr_RS@latin.orig.aff' 'sr_RS@latin.orig.dic' |
| 117 | :sys rm -f -r hunspell-sr/ |
| 118 | |
| 119 | # Check for updated OpenOffice spell files. When there are changes the |
| 120 | # ".new.aff" and ".new.dic" files are left behind for manual inspection. |
| 121 | # |
| 122 | #check: |
| 123 | # :assertpkg unzip diff |
| 124 | # :fetch fr_FR.zip |
| 125 | # :mkdir tmp |
| 126 | # :cd tmp |
| 127 | # @try: |
| 128 | # @import stat |
| 129 | # :sys $UNZIP ../fr_FR.zip |
| 130 | # :sys {force} diff ../fr_FR.orig.aff fr_FR.aff >d |
| 131 | # @if os.stat('d')[stat.ST_SIZE] > 0: |
| 132 | # :copy fr_FR.aff ../fr_FR.new.aff |
| 133 | # :sys {force} diff ../fr_FR.orig.dic fr_FR.dic >d |
| 134 | # @if os.stat('d')[stat.ST_SIZE] > 0: |
| 135 | # :copy fr_FR.dic ../fr_FR.new.dic |
| 136 | # @finally: |
| 137 | # :cd .. |
| 138 | # :delete {r}{f}{q} tmp |
| 139 | # :delete fr_FR.zip |
| 140 | |
| 141 | |
| 142 | vim: set sts=4 sw=4 : |