Bram Moolenaar | 5ef1c6a | 2019-11-10 22:09:11 +0100 | [diff] [blame] | 1 | # Aap recipe for Turkish 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 = tr_TR.aff tr_TR.dic |
| 11 | |
| 12 | all: $SPELLDIR/tr.utf-8.spl |
| 13 | |
| 14 | $SPELLDIR/tr.utf-8.spl : $FILES |
| 15 | :sys env LANG=tr_TR.UTF-8 |
| 16 | $VIM -u NONE -e -c "mkspell! $SPELLDIR/tr tr_TR" -c q |
| 17 | |
| 18 | # Fetching LibreOffice spell files |
| 19 | FILE = https://github.com/bitigchi/bitigchi.github.io/raw/master/vim-tr-spell/tr_TR.zip |
| 20 | :attr {fetch = $FILE} tr_TR.zip |
| 21 | |
| 22 | # The files don't depend on the .zip file so that we can delete it. |
| 23 | # Only download the zip file if the targets don't exist. |
| 24 | tr_TR.aff tr_TR.dic: {buildcheck=} |
| 25 | :assertpkg unzip patch |
| 26 | :fetch tr_TR.zip |
| 27 | :sys $UNZIP tr_TR.zip |
| 28 | :delete tr_TR.zip |
| 29 | @if not os.path.exists('tr_TR.orig.aff'): |
| 30 | :copy tr_TR.aff tr_TR.orig.aff |
| 31 | @if not os.path.exists('tr_TR.orig.dic'): |
| 32 | :copy tr_TR.dic tr_TR.orig.dic |
| 33 | @if os.path.exists('tr_TR.diff'): |
| 34 | :sys patch <tr_TR.diff |
| 35 | |
| 36 | # Generate diff files |
| 37 | diff: |
| 38 | :assertpkg diff |
| 39 | :sys {force} diff -a -C 1 tr_TR.orig.aff tr_TR.aff >tr_TR.diff |
| 40 | :sys {force} diff -a -C 1 tr_TR.orig.dic tr_TR.dic >>tr_TR.diff |
| 41 | |
| 42 | # Check for updated LibreOffice spell files. When there are changes the |
| 43 | # ".new.aff" and ".new.dic" files are left behind for manual inspection. |
| 44 | check: |
| 45 | :assertpkg unzip diff |
| 46 | :fetch tr_TR.zip |
| 47 | :mkdir tmp |
| 48 | :cd tmp |
| 49 | @try: |
| 50 | @import stat |
| 51 | :sys $UNZIP ../tr_TR.zip |
| 52 | :sys {force} diff ../tr_TR.orig.aff tr_TR.aff >d |
| 53 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 54 | :copy tr_TR.aff ../tr_TR.new.aff |
| 55 | :sys {force} diff ../tr_TR.orig.dic tr_TR.dic >d |
| 56 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 57 | :copy tr_TR.dic ../tr_TR.new.dic |
| 58 | @finally: |
| 59 | :cd .. |
| 60 | :delete {r}{f}{q} tmp |
| 61 | :delete tr_TR.zip |
| 62 | |
| 63 | # Remove all the downloaded and generated files. |
| 64 | clean: |
| 65 | :delete tr_TR.aff |
| 66 | :delete tr_TR.dic |
| 67 | :delete tr_TR.orig.aff |
| 68 | :delete tr_TR.orig.dic |