dev-python/pycxx: ppc stable wrt bug #721778
[gentoo.git] / app-text / stardict / stardict-4.0.0_pre20170304.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
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
8 #       seperate for now.
9
10 GNOME2_LA_PUNT=yes
11 PYTHON_COMPAT=( python2_7 )
12
13 inherit autotools flag-o-matic gnome2 python-single-r1
14
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 )"
21
22 LICENSE="CPL-1.0 GPL-3 LGPL-2"
23 SLOT="0"
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"
29
30 RESTRICT="test"
31
32 COMMON_DEPEND="
33         >=dev-libs/glib-2.32:2
34         dev-libs/libsigc++:2=
35         media-libs/libcanberra[gtk3]
36         sys-libs/zlib:=
37         x11-libs/gdk-pixbuf:2
38         x11-libs/gtk+:3
39         x11-libs/libX11
40         x11-libs/pango
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 )
45         tools? (
46                 dev-db/mysql-connector-c
47                 dev-libs/expat
48                 dev-libs/libpcre:=
49                 dev-libs/libxml2:=
50                 python? ( ${PYTHON_DEPS} )
51         )
52 "
53 RDEPEND="${COMMON_DEPEND}
54         info? ( sys-apps/texinfo )
55         fortune? ( games-misc/fortune-mod )
56         perl? ( dev-lang/perl )
57 "
58 DEPEND="${COMMON_DEPEND}
59         app-text/docbook-xml-dtd:4.3
60         app-text/gnome-doc-utils
61         dev-libs/libxslt
62         dev-util/intltool
63         sys-devel/gettext
64         virtual/pkgconfig
65 "
66 REQUIRED_USE="tools? ( python? ( ${PYTHON_REQUIRED_USE} ) )"
67
68 # docs are messy, installed manually below
69 DOCS=""
70
71 PATCHES=( "${FILESDIR}/${PN}-4.0.0_pre20160518-tabfile.patch" )
72
73 src_prepare() {
74         # From Fedora
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
79
80         # libsigc++ started to require c++11 support
81         append-cxxflags "-std=c++11"
82
83         if use python; then
84                 local f
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
89                 done
90                 # script contains UTF-8 symbols, but has no ecoding set
91                 sed -i '1 a # -*- coding: utf-8 -*-' tools/src/uyghur2dict.py || die
92         fi
93
94         # bug 604318
95         sed -i '/AM_GCONF_SOURCE_2/d' dict/configure.ac || die
96
97         eapply_user
98         eautoreconf
99         gnome2_src_prepare
100 }
101
102 src_configure() {
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 \
107                 --disable-festival \
108                 --disable-gnome-support \
109                 --disable-gpe-support \
110                 --disable-maemo-support \
111                 --disable-schemas-install \
112                 --disable-scrollkeeper \
113                 $(use_enable advertisement) \
114                 $(use_enable cal) \
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) \
122                 $(use_enable info) \
123                 $(use_enable man) \
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)
133 }
134
135 src_install() {
136         gnome2_src_install
137
138         dodoc AUTHORS ChangeLog README
139
140         docinto dict
141         dodoc dict/{AUTHORS,ChangeLog,README,TODO}
142         dodoc dict/doc/{Documentation,FAQ,HowToCreateDictionary,Skins,StarDictFileFormat,TextualDictionaryFileFormat,Translation}
143         dodoc -r dict/doc/wiki
144
145         docinto lib
146         dodoc lib/{AUTHORS,ChangeLog,README}
147
148         if use examples; then
149                 insinto /usr/share/doc/${PF}/dict
150                 doins dict/doc/stardict-textual-dict*
151         fi
152
153         if use qqwry; then
154                 insinto /usr/share/${PN}/data
155                 doins ../QQWry.Dat
156         fi
157
158         if use pronounce; then
159                 docinto WyabdcRealPeopleTTS
160                 dodoc ../WyabdcRealPeopleTTS/{README,readme.txt}
161                 rm -f ../WyabdcRealPeopleTTS/{README,readme.txt}
162                 insinto /usr/share
163                 doins -r ../WyabdcRealPeopleTTS
164         fi
165
166         # noinst_PROGRAMS with ${PN}_ prefix from tools/src/Makefile.am wrt #292773
167         # and additional scripts from tools dir
168         if use tools; then
169                 local app
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
178                         sd2foldoc
179                         ${PN}-text2bin ${PN}-bin2text ${PN}-repair"
180
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"
184
185                 for app in ${apps}; do
186                         if [[ "${app}" =~ ^${PN} ]]; then
187                                 dobin "tools/src/${app}"
188                         else
189                                 newbin "tools/src/${app}" "${PN}_${app}"
190                         fi
191                 done
192                 use python && python_doscript "${ED}"usr/bin/*.py
193
194                 docinto tools
195                 dodoc tools/{AUTHORS,ChangeLog,README}
196
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}
200                 fi
201         fi
202 }
203
204 pkg_postinst() {
205         elog
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"'
210         elog
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}-"
214         elog
215         elog "Additionally you may install any stardict dictionary from the net"
216         elog "by unpacking it to:"
217         elog "  /usr/share/stardict/dic"
218         elog
219
220         gnome2_pkg_postinst
221 }