1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: aspell-dict.eclass
7 # maintainer-needed@gentoo.org
9 # Tomáš Chvátal <scarabeus@gentoo.org>
10 # @BLURB: An eclass to ease the construction of ebuilds for myspell dicts
13 EXPORT_FUNCTIONS src_unpack src_install
15 # @ECLASS-VARIABLE: MYSPELL_DICT
18 # Array variable containing list of all dictionary files.
19 # MYSPELL_DICT=( "file.dic" "dir/file2.aff" )
21 # @ECLASS-VARIABLE: MYSPELL_HYPH
23 # Array variable containing list of all hyphenation files.
24 # MYSPELL_HYPH=( "file.dic" "dir/file2.dic" )
26 # @ECLASS-VARIABLE: MYSPELL_THES
28 # Array variable containing list of all thesarus files.
29 # MYSPELL_HYPH=( "file.dat" "dir/file2.idx" )
31 # Basically no extra deps needed.
32 # Unzip is required for .oxt libreoffice extensions
33 # which are just fancy zip files.
34 DEPEND="app-arch/unzip"
37 # by default this stuff does not have any folder in the pack
40 # @FUNCTION: myspell-r2_src_unpack
42 # Unpack all variants of weird stuff.
43 # In our case .oxt packs.
44 myspell-r2_src_unpack() {
45 debug-print-function ${FUNCNAME} "$@"
51 echo ">>> Unpacking "${DISTDIR}/${f}" to ${PWD}"
52 unzip -qoj ${DISTDIR}/${f}
53 assert "failed unpacking ${DISTDIR}/${f}"
60 # @FUNCTION: myspell-r2_src_install
62 # Install the dictionaries to the right places.
63 myspell-r2_src_install() {
64 debug-print-function ${FUNCNAME} "$@"
68 # Following the debian directory layout here.
69 # DICT: /usr/share/hunspell
70 # THES: /usr/share/mythes
71 # HYPH: /usr/share/hyphen
72 # We just need to copy the required files to proper places.
74 # TODO: backcompat dosym remove when all dictionaries and libreoffice
75 # ebuilds in tree use only the new paths
77 # Very old installs have hunspell to be symlink to myspell.
78 # This results in fcked up install/symlink stuff.
79 if [[ -L "${EPREFIX}/usr/share/hunspell" ]] ; then
80 eerror "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
81 eerror "Please remove it so it is created properly as folder"
82 die "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
85 insinto /usr/share/hunspell
86 for x in "${MYSPELL_DICT[@]}"; do
88 newins "${x}" "${target}" || die
89 dosym /usr/share/hunspell/"${target}" /usr/share/myspell/"${target}" || die
92 insinto /usr/share/mythes
93 for x in "${MYSPELL_THES[@]}"; do
95 newins "${x}" "${target}" || die
96 dosym /usr/share/mythes/"${target}" /usr/share/myspell/"${target}" || die
99 insinto /usr/share/hyphen
100 for x in "${MYSPELL_HYPH[@]}"; do
102 newins "${x}" "${target}" || die
103 dosym /usr/share/hyphen/"${target}" /usr/share/myspell/"${target}" || die
106 # Remove licenses as they suffix them with .txt too
113 for x in *.txt README*; do
114 if [[ -f ${x} ]]; then