stardict-4.0.0_pre20160518-r1.ebuild 6.6 KB

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