Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 1 | # Aap recipe for Dutch 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 | VIM = vim |
| 8 | |
| 9 | SPELLDIR = .. |
| 10 | FILES = pl_PL.aff pl_PL.dic |
| 11 | |
Bram Moolenaar | 63b8098 | 2005-07-08 22:21:38 +0000 | [diff] [blame^] | 12 | all: $(SPELLDIR)/pl.iso-8859-2.spl $(SPELLDIR)/pl.utf-8.spl \ |
| 13 | $(SPELLDIR)/pl.cp1250.spl ../README_pl.txt |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 14 | |
| 15 | $(SPELLDIR)/pl.iso-8859-2.spl : $(VIM) $(FILES) |
| 16 | :sys env LANG=pl_PL.ISO8859-2 $(VIM) -e -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q |
| 17 | |
| 18 | $(SPELLDIR)/pl.utf-8.spl : $(VIM) $(FILES) |
| 19 | :sys env LANG=pl_PL.UTF-8 $(VIM) -e -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q |
| 20 | |
Bram Moolenaar | 63b8098 | 2005-07-08 22:21:38 +0000 | [diff] [blame^] | 21 | # On Unix 'encoding' can't be "cp1250", use "8bit-cp1250" instead. |
| 22 | $(SPELLDIR)/pl.cp1250.spl : $(VIM) $(FILES) |
| 23 | :sys $(VIM) -e -c "set enc=8bit-cp1250" -c "mkspell! $(SPELLDIR)/pl pl_PL" -c q |
| 24 | :move {f} $(SPELLDIR)/pl.8bit-cp1250.spl $(SPELLDIR)/pl.cp1250.spl |
| 25 | |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 26 | ../README_pl.txt: README_pl_PL.txt |
| 27 | :copy $source $target |
| 28 | |
| 29 | # |
| 30 | # Fetching the files from OpenOffice.org. |
| 31 | # |
Bram Moolenaar | 63b8098 | 2005-07-08 22:21:38 +0000 | [diff] [blame^] | 32 | #OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries |
| 33 | #:attr {fetch = $(OODIR)/%file%} pl_PL.zip |
| 34 | |
| 35 | # |
| 36 | # Fetching the files from |
| 37 | # |
| 38 | HTTPDIR = http://www.kurnik.pl/slownik/ort/ |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 39 | |
| 40 | # The files don't depend on the .zip file so that we can delete it. |
| 41 | # Only download the zip file if the targets don't exist. |
Bram Moolenaar | 63b8098 | 2005-07-08 22:21:38 +0000 | [diff] [blame^] | 42 | # This is a bit tricky, since the file name includes the date. |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 43 | pl_PL.aff pl_PL.dic: {buildcheck=} |
Bram Moolenaar | 63b8098 | 2005-07-08 22:21:38 +0000 | [diff] [blame^] | 44 | :assertpkg tar bunzip2 |
| 45 | @from time import strftime, gmtime, time |
| 46 | @for day in range(20): |
| 47 | date = `strftime('%Y%m%d', gmtime(time() - day * 24 * 60 * 60))` |
| 48 | base = alt-myspell-pl-$(date) |
| 49 | fname = $(base).tar.bz2 |
| 50 | :attr {fetch = $(HTTPDIR)/%file%} $(fname) |
| 51 | @try: |
| 52 | :fetch $(fname) |
| 53 | ok = 1 |
| 54 | @except: |
| 55 | ok = 0 |
| 56 | @if ok: |
| 57 | @break |
| 58 | :sys bunzip2 -c $(fname) | tar xf - |
| 59 | :move $(base)/* . |
| 60 | :deldir $(base) |
| 61 | :delete $(fname) |
Bram Moolenaar | 7d1f5db | 2005-07-03 21:39:27 +0000 | [diff] [blame] | 62 | @if not os.path.exists('pl_PL.orig.aff'): |
| 63 | :copy pl_PL.aff pl_PL.orig.aff |
| 64 | @if not os.path.exists('pl_PL.orig.dic'): |
| 65 | :copy pl_PL.aff pl_PL.orig.dic |
| 66 | :sys patch <pl_PL.diff |
| 67 | |
| 68 | |
| 69 | # Generate diff files, so that others can get the OpenOffice files and apply |
| 70 | # the diffs to get the Vim versions. |
| 71 | |
| 72 | diff: |
| 73 | :assertpkg diff |
| 74 | :sys {force} diff -a -C 1 pl_PL.orig.aff pl_PL.aff >pl_PL.diff |
| 75 | :sys {force} diff -a -C 1 pl_PL.orig.dic pl_PL.dic >>pl_PL.diff |
| 76 | |
| 77 | |
| 78 | # Check for updated OpenOffice spell files. When there are changes the |
| 79 | # ".new.aff" and ".new.dic" files are left behind for manual inspection. |
| 80 | |
| 81 | check: |
| 82 | :assertpkg unzip diff |
| 83 | :fetch pl_PL.zip |
| 84 | :mkdir tmp |
| 85 | :cd tmp |
| 86 | @try: |
| 87 | @import stat |
| 88 | :sys $(UNZIP) ../pl_PL.zip |
| 89 | :sys {force} diff ../pl_PL.orig.aff pl_PL.aff >d |
| 90 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 91 | :copy pl_PL.aff ../pl_PL.new.aff |
| 92 | :sys {force} diff ../pl_PL.orig.dic pl_PL.dic >d |
| 93 | @if os.stat('d')[stat.ST_SIZE] > 0: |
| 94 | :copy pl_PL.dic ../pl_PL.new.dic |
| 95 | @finally: |
| 96 | :cd .. |
| 97 | :delete {r}{f}{q} tmp |
| 98 | :delete pl_PL.zip |
| 99 | |
| 100 | |
| 101 | # vim: set sts=4 sw=4 : |