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