summaryrefslogtreecommitdiffstats
path: root/runtime/spell/tr/main.aap
blob: 073cf2a16941afb0cdd44b186139121db941aac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Aap recipe for Turkish Vim spell files.

# Use a freshly compiled Vim if it exists.
@if os.path.exists('../../../src/vim'):
    VIM = ../../../src/vim
@else:
    :progsearch VIM vim

SPELLDIR = ..
FILES    = tr_TR.aff tr_TR.dic

all: $SPELLDIR/tr.utf-8.spl 

$SPELLDIR/tr.utf-8.spl : $FILES
        :sys env LANG=tr_TR.UTF-8
		$VIM -u NONE -e -c "mkspell! $SPELLDIR/tr tr_TR" -c q

# Fetching LibreOffice spell files
FILE = https://github.com/bitigchi/bitigchi.github.io/raw/master/vim-tr-spell/tr_TR.zip
:attr {fetch = $FILE} tr_TR.zip

# The files don't depend on the .zip file so that we can delete it.
# Only download the zip file if the targets don't exist.
tr_TR.aff tr_TR.dic: {buildcheck=}
        :assertpkg unzip patch
        :fetch tr_TR.zip
        :sys $UNZIP tr_TR.zip
        :delete tr_TR.zip
        @if not os.path.exists('tr_TR.orig.aff'):
            :copy tr_TR.aff tr_TR.orig.aff
        @if not os.path.exists('tr_TR.orig.dic'):
            :copy tr_TR.dic tr_TR.orig.dic
        @if os.path.exists('tr_TR.diff'):
            :sys patch <tr_TR.diff

# Generate diff files
diff:
        :assertpkg diff
        :sys {force} diff -a -C 1 tr_TR.orig.aff tr_TR.aff >tr_TR.diff
        :sys {force} diff -a -C 1 tr_TR.orig.dic tr_TR.dic >>tr_TR.diff

# Check for updated LibreOffice spell files.  When there are changes the
# ".new.aff" and ".new.dic" files are left behind for manual inspection.
check:
        :assertpkg unzip diff
        :fetch tr_TR.zip
        :mkdir tmp
        :cd tmp
        @try:
            @import stat
            :sys $UNZIP ../tr_TR.zip
            :sys {force} diff ../tr_TR.orig.aff tr_TR.aff >d
            @if os.stat('d')[stat.ST_SIZE] > 0:
                :copy tr_TR.aff ../tr_TR.new.aff
            :sys {force} diff ../tr_TR.orig.dic tr_TR.dic >d
            @if os.stat('d')[stat.ST_SIZE] > 0:
                :copy tr_TR.dic ../tr_TR.new.dic
        @finally:
            :cd ..
            :delete {r}{f}{q} tmp
            :delete tr_TR.zip

# Remove all the downloaded and generated files.
clean:
        :delete tr_TR.aff
        :delete tr_TR.dic
        :delete tr_TR.orig.aff
        :delete tr_TR.orig.dic