stardict-3.0.6-r3.ebuild 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. # NOTE: Even though the *.dict.dz are the same as dictd/freedict's files,
  5. # their indexes seem to be in a different format. So we'll keep them
  6. # seperate for now.
  7. GNOME2_LA_PUNT=yes
  8. PYTHON_COMPAT=( python2_7 )
  9. inherit flag-o-matic gnome2 python-single-r1
  10. DESCRIPTION="A international dictionary supporting fuzzy and glob style matching"
  11. HOMEPAGE="http://stardict-4.sourceforge.net/"
  12. SRC_URI="mirror://sourceforge/${PN}-4/${P}.tar.bz2
  13. pronounce? ( https://${PN}-3.googlecode.com/files/WyabdcRealPeopleTTS.tar.bz2 )
  14. qqwry? ( mirror://gentoo/QQWry.Dat.bz2 )"
  15. LICENSE="CPL-1.0 GPL-3 LGPL-2"
  16. SLOT="0"
  17. KEYWORDS="amd64 ~arm ~arm64 ppc ppc64 sparc x86"
  18. IUSE="advertisement debug dictdotcn espeak examples +gucharmap
  19. +htmlparse man perl +powerwordparse pronounce python qqwry spell
  20. tools updateinfo +wikiparse +wordnet +xdxfparse"
  21. RESTRICT="test"
  22. COMMON_DEPEND="
  23. >=dev-libs/glib-2.16:2
  24. dev-libs/libsigc++:2=
  25. sys-libs/zlib:=
  26. x11-libs/gdk-pixbuf:2
  27. >=x11-libs/gtk+-2.20:2
  28. x11-libs/libX11
  29. x11-libs/pango
  30. gucharmap? ( gnome-extra/gucharmap:0= )
  31. spell? ( >=app-text/enchant-1.2 )
  32. tools? (
  33. dev-libs/libpcre:=
  34. dev-libs/libxml2:=
  35. virtual/mysql
  36. python? ( ${PYTHON_DEPS} )
  37. )
  38. "
  39. RDEPEND="${COMMON_DEPEND}
  40. espeak? ( >=app-accessibility/espeak-1.29 )
  41. perl? ( dev-lang/perl )
  42. "
  43. DEPEND="${COMMON_DEPEND}
  44. app-text/docbook-xml-dtd:4.3
  45. app-text/gnome-doc-utils
  46. dev-libs/libxslt
  47. dev-util/intltool
  48. sys-devel/gettext
  49. virtual/pkgconfig
  50. "
  51. REQUIRED_USE="tools? ( python? ( ${PYTHON_REQUIRED_USE} ) )"
  52. # docs are messy, installed manually below
  53. DOCS=""
  54. src_prepare() {
  55. # From Fedora
  56. # Remove unneeded sigc++ header files to make it sure
  57. # that we are using system-wide libsigc++
  58. # (and these does not work on gcc43)
  59. find dict/src/sigc++* -name \*.h -or -name \*.cc | xargs rm -f || die
  60. # libsigc++ started to require c++11 support
  61. append-cxxflags "-std=c++11"
  62. if use python; then
  63. local f
  64. # force python shebangs handlable by python_doscript
  65. for f in tools/src/*.py; do
  66. [[ $(head -n1 "${f}") =~ ^#! ]] || continue
  67. sed -i '1 s|.*|#!/usr/bin/python|' tools/src/*.py || die
  68. done
  69. # script contains UTF-8 symbols, but has no ecoding set
  70. sed -i '1 a # -*- coding: utf-8 -*-' tools/src/uyghur2dict.py || die
  71. fi
  72. eapply_user
  73. gnome2_src_prepare
  74. }
  75. src_configure() {
  76. # Hint: EXTRA_ECONF="--enable-gnome-support" and manual install of
  77. # libbonobo-2, libgnome-2, libgnomeui-2, gconf-2 and orbit-2 will
  78. # give you GNOME 2.x support, that is otherwise considered deprecated
  79. # because of the deep GNOME 2.x core library dependencies
  80. # Festival plugin crashes, bug 188684. Disable for now.
  81. gnome2_src_configure \
  82. --disable-festival \
  83. --disable-gnome-support \
  84. --disable-gpe-support \
  85. --disable-schemas-install \
  86. --disable-scrollkeeper \
  87. $(use_enable advertisement) \
  88. $(use_enable debug) \
  89. $(use_enable dictdotcn) \
  90. $(use_enable espeak) \
  91. $(use_enable gucharmap) \
  92. $(use_enable htmlparse) \
  93. $(use_enable man) \
  94. $(use_enable powerwordparse) \
  95. $(use_enable qqwry) \
  96. $(use_enable spell) \
  97. $(use_enable tools) \
  98. $(use_enable updateinfo) \
  99. $(use_enable wikiparse) \
  100. $(use_enable wordnet) \
  101. $(use_enable xdxfparse)
  102. }
  103. src_install() {
  104. gnome2_src_install
  105. dodoc AUTHORS ChangeLog README
  106. docinto dict
  107. dodoc dict/{AUTHORS,ChangeLog,README,TODO}
  108. dodoc dict/doc/{Documentation,FAQ,HowToCreateDictionary,Skins,StarDictFileFormat,TextualDictionaryFileFormat,Translation}
  109. docinto lib
  110. dodoc lib/{AUTHORS,ChangeLog,README}
  111. if use examples; then
  112. insinto /usr/share/doc/${PF}/dict
  113. doins dict/doc/stardict-textual-dict*
  114. fi
  115. if use qqwry; then
  116. insinto /usr/share/${PN}/data
  117. doins ../QQWry.Dat
  118. fi
  119. if use pronounce; then
  120. docinto WyabdcRealPeopleTTS
  121. dodoc ../WyabdcRealPeopleTTS/{README,readme.txt}
  122. rm -f ../WyabdcRealPeopleTTS/{README,readme.txt}
  123. insinto /usr/share
  124. doins -r ../WyabdcRealPeopleTTS
  125. fi
  126. # noinst_PROGRAMS with ${PN}_ prefix from tools/src/Makefile.am wrt #292773
  127. # and additional scripts from tools dir
  128. if use tools; then
  129. local app
  130. local apps="${PN}-editor pydict2dic olddic2newdic oxford2dic directory2dic
  131. dictd2dic wquick2dic ec50 directory2treedic treedict2dir jdictionary mova
  132. xmlinout soothill kanjidic2 powerword kdic 21tech 21shiji buddhist
  133. tabfile cedict edict duden ${PN}-dict-update degb2utf frgb2utf
  134. jpgb2utf gmx2utf rucn kingsoft wikipedia wikipediaImage babylon
  135. ${PN}2txt ${PN}-verify fest2dict i2e2dict downloadwiki
  136. ooo2dict myspell2dic exc2i2e dictbuilder tabfile2sql KangXi Unihan
  137. xiaoxuetang-ja wubi ydp2dict wordnet lingvosound2resdb
  138. resdatabase2dir dir2resdatabase ${PN}-index sd2foldoc ${PN}-text2bin
  139. ${PN}-bin2text ${PN}-repair"
  140. use perl && apps+=" dicts-dump.pl ncce2stardict.pl parse-oxford.perl"
  141. use python && apps+=" hanzim2dict.py jm2stardict.py lingea-trd-decoder.py
  142. makevietdict.py uyghur2dict.py"
  143. for app in ${apps}; do
  144. if [[ "${app}" =~ ^${PN} ]]; then
  145. dobin "tools/src/${app}"
  146. else
  147. newbin "tools/src/${app}" "${PN}_${app}"
  148. fi
  149. done
  150. use python && python_doscript "${ED}"usr/bin/*.py
  151. docinto tools
  152. dodoc tools/{AUTHORS,ChangeLog,README}
  153. if use examples; then
  154. insinto /usr/share/doc/${PF}/tools
  155. doins tools/src/{dictbuilder.{example,readme},example.ifo,example_treedict.tar.bz2}
  156. fi
  157. fi
  158. }
  159. pkg_postinst() {
  160. elog
  161. elog "Note: festival text to speech (TTS) plugin is not built. To use festival"
  162. elog 'TTS plugin, please, emerge festival and enable "Use TTS program." at:'
  163. elog '"Preferences -> Dictionary -> Sound" and fill in "Commandline" with:'
  164. elog '"echo %s | festival --tts"'
  165. elog
  166. elog "You will now need to install ${PN} dictionary files. If"
  167. elog "you have not, execute the below to get a list of dictionaries:"
  168. elog " emerge -s ${PN}-"
  169. elog
  170. elog "Additionally you may install any stardict dictionary from the net"
  171. elog "by unpacking it to:"
  172. elog " /usr/share/stardict/dic"
  173. elog
  174. gnome2_pkg_postinst
  175. }