1 ################################################################################
3 # aspell-dict.cygclass - functions for building Aspell dictionaries
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport. If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/aspell-dict.cygclass
29 # Aspell is a GNU project providing a spell checking library and command-line
30 # tool. Aspell can support multiple languages by installing dictonaries.
32 # The purpose of this cygclass is to create Aspell dictionary packages for
33 # the Cygwin Aspell package. aspell-dict.cygclass expects the package name
34 # to be "aspell-<language_code>". If the source tarball is named "aspell5-*"
35 # or "aspell6-*", ASPELL_COMPAT must be declared before inheriting.
45 # SUMMARY="Aspell English dictionaries"
46 # DESCRIPTION="GNU Aspell is a Free and Open Source spell checker designed
47 # to eventually replace Ispell. It can either be used as a library or as an
48 # independent spell checker.
49 # This package provides English dictionaries for Aspell."
50 # HOMEPAGE="http://aspell.net/"
51 # LICENSE="MIT and BSD"
59 #****v* aspell-dict.cygclass/ASPELL_COMPAT
61 # Dictionary compatibility level:
62 # * unset -- Source named "aspell-*". Built with old system for 0.50; usually compatible with 0.60.
63 # * 5 -- Source named "aspell5-*". Built for 0.50 but usually compatible with 0.60.
64 # * 6 -- Source named "aspell6-*". Built for 0.60 and incompatible with 0.50.
66 # This variable, if necessary, must be declared before inheriting aspell-dict.cygclass.
68 case "${ASPELL_COMPAT}" in
70 *) error "aspell-dict: invalid value for ASPELL_COMPAT: ${ASPELL_COMPAT}" ;;
75 #****d* aspell-dict.cygclass/ASPELL_DATADIR
77 # Installation path for Aspell platform-independent dictionary files
79 ASPELL_DATADIR=$(aspell dump config data-dir)
81 #****d* aspell-dict.cygclass/ASPELL_DICTDIR
83 # Installation path for Aspell compiled dictionary files
85 ASPELL_DICTDIR=$(aspell dump config dict-dir)
87 #****d* aspell-dict.cygclass/ASPELL_LANG
89 # ISO 639 short code for language name
91 ASPELL_LANG="${PN#aspell-}"
93 #****d* aspell-dict.cygclass/ASPELL_LANG_FULL
95 # The English name for the language specified in ASPELL_LANG.
97 # The iso-codes package must be installed in order to provide this definition.
99 iso_639=/usr/share/xml/iso-codes/iso_639.xml
103 ASPELL_LANG_FULL=$(sed -e ':a;N;$!ba;s|\n\t\t| |g' ${iso_639} | grep \"${ASPELL_LANG}\" | sed -e 's|.* name="\([^"\;]*\).*|\1|')
108 # e.g. tarball version 6.0-0 => PV=6.0.0
109 ORIG_PN="aspell${ASPELL_COMPAT}-${ASPELL_LANG}"
111 *-*) ORIG_PV=${PV} ;;
112 *) ORIG_PV=${PV%.*}-${PV##*.} ;;
115 #****o* aspell-dict.cygclass/CATEGORY (aspell-dict)
119 #****o* aspell-dict.cygclass/SUMMARY (aspell-dict)
121 SUMMARY="Aspell ${ASPELL_LANG_FULL:-${ASPELL_LANG}} dictionary"
123 #****o* aspell-dict.cygclass/DESCRIPTION (aspell-dict)
125 DESCRIPTION="GNU Aspell is a Free and Open Source spell checker designed to
126 eventually replace Ispell. It can either be used as a library or as an
127 independent spell checker.
128 This package provides ${ASPELL_LANG_FULL:-${ASPELL_LANG}} dictionaries for Aspell."
130 #****o* aspell-dict.cygclass/HOMEPAGE (aspell-dict)
132 HOMEPAGE="http://aspell.net/"
135 #****o* aspell-dict.cygclass/SRC_URI (aspell-dict)
137 SRC_URI="mirror://gnu/aspell/dict/${ASPELL_LANG}/${ORIG_PN}-${ORIG_PV}.tar.bz2"
140 SRC_DIR="${ORIG_PN}-${ORIG_PV}"
142 #****C* aspell-dict.cygclass/aspell_dict_compile
144 # aspell_dict_compile
146 # Compiles an Aspell dictionary by running the custom configure script, then
149 aspell_dict_compile() {
150 if [ ! -e configure ]
152 error "aspell-dict: configure not found"
155 ./configure || error "aspell-dict: configure failed"
159 #****I* aspell-dict.cygclass/doaspelldict
163 # Installs the Aspell dictionary files to the correct directories. Aspell
164 # dictionaries usually install with the default src_install, so this is generally
174 error "doaspelldict: ${f}: file not found"
179 insinto ${ASPELL_DATADIR} ;;
181 insinto ${ASPELL_DICTDIR} ;;
183 warning "doaspelldict: skipping ${f##*/}: unknown file type"
191 #****I* aspell-dict.cygclass/doaspelldata
193 # Alias for doaspelldict.
195 doaspelldata() { doaspelldict ${@} ; }
197 #****o* aspell-dict.cygclass/src_compile (aspell-dict)
206 readonly -f aspell_dict_compile doaspelldict doaspelldata