1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: myspell-r2.eclass
6 # maintainer-needed@gentoo.org
8 # Tomáš Chvátal <scarabeus@gentoo.org>
9 # @BLURB: An eclass to ease the construction of ebuilds for myspell dicts
12 EXPORT_FUNCTIONS src_unpack src_install
14 # @ECLASS-VARIABLE: MYSPELL_DICT
17 # Array variable containing list of all dictionary files.
18 # MYSPELL_DICT=( "file.dic" "dir/file2.aff" )
20 # @ECLASS-VARIABLE: MYSPELL_HYPH
22 # Array variable containing list of all hyphenation files.
23 # MYSPELL_HYPH=( "file.dic" "dir/file2.dic" )
25 # @ECLASS-VARIABLE: MYSPELL_THES
27 # Array variable containing list of all thesarus files.
28 # MYSPELL_THES=( "file.dat" "dir/file2.idx" )
30 # Basically no extra deps needed.
31 # Unzip is required for .oxt libreoffice extensions
32 # which are just fancy zip files.
33 DEPEND="app-arch/unzip"
36 # by default this stuff does not have any folder in the pack
39 # @FUNCTION: myspell-r2_src_unpack
41 # Unpack all variants of weird stuff.
42 # In our case .oxt packs.
43 myspell-r2_src_unpack() {
44 debug-print-function ${FUNCNAME} "$@"
50 echo ">>> Unpacking "${DISTDIR}/${f}" to ${PWD}"
51 unzip -qoj ${DISTDIR}/${f}
52 assert "failed unpacking ${DISTDIR}/${f}"
59 # @FUNCTION: myspell-r2_src_install
61 # Install the dictionaries to the right places.
62 myspell-r2_src_install() {
63 debug-print-function ${FUNCNAME} "$@"
67 # Following the debian directory layout here.
68 # DICT: /usr/share/hunspell
69 # THES: /usr/share/mythes
70 # HYPH: /usr/share/hyphen
71 # We just need to copy the required files to proper places.
73 # TODO: backcompat dosym remove when all dictionaries and libreoffice
74 # ebuilds in tree use only the new paths
76 # Very old installs have hunspell to be symlink to myspell.
77 # This results in fcked up install/symlink stuff.
78 if [[ -L "${EPREFIX}/usr/share/hunspell" ]] ; then
79 eerror "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
80 eerror "Please remove it so it is created properly as folder"
81 die "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
84 insinto /usr/share/hunspell
85 for x in "${MYSPELL_DICT[@]}"; do
87 newins "${x}" "${target}" || die
88 dosym ../hunspell/"${target}" /usr/share/myspell/"${target}" || die
91 insinto /usr/share/mythes
92 for x in "${MYSPELL_THES[@]}"; do
94 newins "${x}" "${target}" || die
95 dosym ../mythes/"${target}" /usr/share/myspell/"${target}" || die
98 insinto /usr/share/hyphen
99 for x in "${MYSPELL_HYPH[@]}"; do
101 newins "${x}" "${target}" || die
102 dosym ../hyphen/"${target}" /usr/share/myspell/"${target}" || die
105 # Remove licenses as they suffix them with .txt too
112 for x in *.txt README*; do
113 if [[ -f ${x} ]]; then