xref: /vim-8.2.3635/runtime/spell/sv/main.aap (revision 607cc1e0)
1# Aap recipe for Swedish Vim spell files.
2#
3# Maintainer: Mattias Winther <[email protected]>
4
5# Use a freshly compiled Vim if it exists.
6@if os.path.exists('../../../src/vim'):
7    VIM = ../../../src/vim
8@else:
9    :progsearch VIM vim
10
11SPELLDIR = ..
12FILES    = sv_SE.aff sv_SE.dic
13
14all: $SPELLDIR/sv.latin1.spl $SPELLDIR/sv.utf-8.spl ../README_sv.txt
15
16$SPELLDIR/sv.latin1.spl : $FILES
17        :sys env LANG=sv_SE.ISO-8859-1
18		$VIM -u NONE -e -c "mkspell! $SPELLDIR/sv sv_SE" -c q
19
20$SPELLDIR/sv.utf-8.spl : $FILES
21        :sys env LANG=sv_SE.UTF-8
22		$VIM -u NONE -e -c "mkspell! $SPELLDIR/sv sv_SE" -c q
23
24../README_sv.txt : README_sv.txt
25        :copy $source $target
26
27#
28# Fetching the files from OpenOffice.org.
29#
30OODIR = http://extensions.services.openoffice.org/e-files/1080/7
31:attr {fetch = $OODIR/%file%} ooo_swedish_dict_1.43.oxt
32
33# The files don't depend on the .zip file so that we can delete it.
34# Only download the zip file if the targets don't exist.
35sv_SE.aff sv_SE.dic: {buildcheck=}
36        :assertpkg unzip patch
37        :fetch ooo_swedish_dict_1.43.oxt
38        :sys $UNZIP ooo_swedish_dict_1.43.oxt
39        :delete ooo_swedish_dict_1.43.oxt
40        :delete {r} META-INF
41        :copy dictionaries/sv_SE.aff sv_SE.aff
42        :copy dictionaries/sv_SE.dic sv_SE.dic
43        :delete {r} dictionaries dictionaries.xcu description.xml
44        :delete {f} README_sv.txt
45        :sys $VIM README_sv.txt -u NONE -N -e -c "0read LICENSE_en_US.txt" -c "read LICENSE_sv_SE.txt" -c "set ff=unix" -c write -c q
46        :delete LICENSE_en_US.txt LICENSE_sv_SE.txt
47        @if not os.path.exists('sv_SE.orig.aff'):
48            :copy sv_SE.aff sv_SE.orig.aff
49        @if not os.path.exists('sv_SE.orig.dic'):
50            :copy sv_SE.dic sv_SE.orig.dic
51        @if os.path.exists('sv_SE.diff'):
52            :sys patch <sv_SE.diff
53
54# Delete all the generated files, start from scratch
55clean:
56        :delete {f} sv_SE.aff sv_SE.dic
57        :delete {f} sv_SE.aff.orig sv_SE.dic.orig
58        :delete {f} sv_SE.orig.aff sv_SE.orig.dic
59        :delete {f} README_sv.txt
60
61# Generate diff files, so that others can get the OpenOffice files and apply
62# the diffs to get the Vim versions.
63
64diff:
65        :assertpkg diff
66        :sys {force} diff -a -C 1 sv_SE.orig.aff sv_SE.aff >sv_SE.diff
67        :sys {force} diff -a -C 1 sv_SE.orig.dic sv_SE.dic >>sv_SE.diff
68
69
70# Check for updated OpenOffice spell files.  When there are changes the
71# ".new.aff" and ".new.dic" files are left behind for manual inspection.
72
73check:
74        :assertpkg unzip diff
75        :fetch ooo_swedish_dict_1.43.oxt
76        :mkdir tmp
77        :cd tmp
78        @try:
79            @import stat
80            :sys $UNZIP ../ooo_swedish_dict_1.43.oxt
81            :sys {force} diff ../sv_SE.orig.aff sv_SE.aff >d
82            @if os.stat('d')[stat.ST_SIZE] > 0:
83                :copy sv_SE.aff ../sv_SE.new.aff
84            :sys {force} diff ../sv_SE.orig.dic sv_SE.dic >d
85            @if os.stat('d')[stat.ST_SIZE] > 0:
86                :copy sv_SE.dic ../sv_SE.new.dic
87        @finally:
88            :cd ..
89            :delete {r}{f}{q} tmp
90            :delete ooo_swedish_dict_1.43.oxt
91
92
93# vim: set sts=4 sw=4 :
94