1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 # NOTE: Even though the *.dict.dz are the same as dictd/freedict's files,
7 # their indexes seem to be in a different format. So we'll keep them
11 PYTHON_COMPAT=( python2_7 )
13 inherit autotools flag-o-matic gnome2 python-single-r1
15 DESCRIPTION="A international dictionary supporting fuzzy and glob style matching"
16 HOMEPAGE="http://stardict-4.sourceforge.net/
17 https://github.com/huzheng001/stardict-3"
18 SRC_URI="https://dev.gentoo.org/~bircoph/distfiles/${P}.tar.xz
19 pronounce? ( https://${PN}-3.googlecode.com/files/WyabdcRealPeopleTTS.tar.bz2 )
20 qqwry? ( mirror://gentoo/QQWry.Dat.bz2 )"
22 LICENSE="CPL-1.0 GPL-3 LGPL-2"
24 KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
25 IUSE="advertisement cal debug dictdotcn espeak examples flite
26 fortune gucharmap +htmlparse info man perl +powerwordparse
27 pronounce python qqwry spell tools updateinfo +wikiparse +wordnet
28 +xdxfparse youdaodict"
33 >=dev-libs/glib-2.32:2
35 media-libs/libcanberra[gtk3]
41 espeak? ( >=app-accessibility/espeak-1.29 )
42 flite? ( app-accessibility/flite )
43 gucharmap? ( gnome-extra/gucharmap:2.90= )
44 spell? ( >=app-text/enchant-1.2:0 )
46 dev-db/mysql-connector-c
50 python? ( ${PYTHON_DEPS} )
53 RDEPEND="${COMMON_DEPEND}
54 info? ( sys-apps/texinfo )
55 fortune? ( games-misc/fortune-mod )
56 perl? ( dev-lang/perl )
58 DEPEND="${COMMON_DEPEND}
59 app-text/docbook-xml-dtd:4.3
60 app-text/gnome-doc-utils
66 REQUIRED_USE="tools? ( python? ( ${PYTHON_REQUIRED_USE} ) )"
68 # docs are messy, installed manually below
71 PATCHES=( "${FILESDIR}/${PN}-4.0.0_pre20160518-tabfile.patch" )
75 # Remove unneeded sigc++ header files to make it sure
76 # that we are using system-wide libsigc++
77 # (and these does not work on gcc43)
78 find dict/src/sigc++* -name \*.h -or -name \*.cc | xargs rm -f || die
80 # libsigc++ started to require c++11 support
81 append-cxxflags "-std=c++11"
85 # force python shebangs handlable by python_doscript
86 for f in tools/src/*.py; do
87 [[ $(head -n1 "${f}") =~ ^#! ]] || continue
88 sed -i '1 s|.*|#!/usr/bin/python|' tools/src/*.py || die
90 # script contains UTF-8 symbols, but has no ecoding set
91 sed -i '1 a # -*- coding: utf-8 -*-' tools/src/uyghur2dict.py || die
95 sed -i '/AM_GCONF_SOURCE_2/d' dict/configure.ac || die
103 # Festival plugin crashes, bug 188684. Disable for now.
104 # Gnome2 support is disabled due to deprecation request, bug 644346
105 gnome2_src_configure \
106 --disable-darwin-support \
108 --disable-gnome-support \
109 --disable-gpe-support \
110 --disable-maemo-support \
111 --disable-schemas-install \
112 --disable-scrollkeeper \
113 $(use_enable advertisement) \
115 $(use_enable debug) \
116 $(use_enable dictdotcn) \
117 $(use_enable espeak) \
118 $(use_enable flite) \
119 $(use_enable fortune) \
120 $(use_enable gucharmap) \
121 $(use_enable htmlparse) \
124 $(use_enable powerwordparse) \
125 $(use_enable qqwry) \
126 $(use_enable spell) \
127 $(use_enable tools) \
128 $(use_enable updateinfo) \
129 $(use_enable wikiparse) \
130 $(use_enable wordnet) \
131 $(use_enable xdxfparse) \
132 $(use_enable youdaodict)
138 dodoc AUTHORS ChangeLog README
141 dodoc dict/{AUTHORS,ChangeLog,README,TODO}
142 dodoc dict/doc/{Documentation,FAQ,HowToCreateDictionary,Skins,StarDictFileFormat,TextualDictionaryFileFormat,Translation}
143 dodoc -r dict/doc/wiki
146 dodoc lib/{AUTHORS,ChangeLog,README}
148 if use examples; then
149 insinto /usr/share/doc/${PF}/dict
150 doins dict/doc/stardict-textual-dict*
154 insinto /usr/share/${PN}/data
158 if use pronounce; then
159 docinto WyabdcRealPeopleTTS
160 dodoc ../WyabdcRealPeopleTTS/{README,readme.txt}
161 rm -f ../WyabdcRealPeopleTTS/{README,readme.txt}
163 doins -r ../WyabdcRealPeopleTTS
166 # noinst_PROGRAMS with ${PN}_ prefix from tools/src/Makefile.am wrt #292773
167 # and additional scripts from tools dir
170 local apps="${PN}-editor pydict2dic olddic2newdic oxford2dic directory2dic dictd2dic
171 wquick2dic ec50 directory2treedic treedict2dir jdictionary mova xmlinout
172 soothill kanjidic2 powerword kdic 21tech 21shiji buddhist tabfile
173 cedict edict duden ${PN}-dict-update degb2utf frgb2utf jpgb2utf gmx2utf
174 rucn kingsoft kingsoft2 wikipedia wikipediaImage babylon ${PN}2txt ${PN}-verify
175 fest2dict i2e2dict downloadwiki ooo2dict myspell2dic exc2i2e
176 dictbuilder tabfile2sql KangXi Unihan xiaoxuetang-ja wubi ydp2dict
177 wordnet lingvosound2resdb resdatabase2dir dir2resdatabase ${PN}-index
179 ${PN}-text2bin ${PN}-bin2text ${PN}-repair"
181 use perl && apps+=" dicts-dump.pl ncce2stardict.pl parse-oxford.perl"
182 use python && apps+=" hanzim2dict.py jm2stardict.py lingea-trd-decoder.py
183 makevietdict.py uyghur2dict.py"
185 for app in ${apps}; do
186 if [[ "${app}" =~ ^${PN} ]]; then
187 dobin "tools/src/${app}"
189 newbin "tools/src/${app}" "${PN}_${app}"
192 use python && python_doscript "${ED}"usr/bin/*.py
195 dodoc tools/{AUTHORS,ChangeLog,README}
197 if use examples; then
198 insinto /usr/share/doc/${PF}/tools
199 doins tools/src/{dictbuilder.{example,readme},example.ifo,example_treedict.tar.bz2}
206 elog "Note: festival text to speech (TTS) plugin is not built. To use festival"
207 elog 'TTS plugin, please, emerge festival and enable "Use TTS program." at:'
208 elog '"Preferences -> Dictionary -> Sound" and fill in "Commandline" with:'
209 elog '"echo %s | festival --tts"'
211 elog "You will now need to install ${PN} dictionary files. If"
212 elog "you have not, execute the below to get a list of dictionaries:"
213 elog " emerge -s ${PN}-"
215 elog "Additionally you may install any stardict dictionary from the net"
216 elog "by unpacking it to:"
217 elog " /usr/share/stardict/dic"