skk-jisyo-999999.ebuild 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. USE_RUBY="ruby20 ruby21"
  5. inherit cvs ruby-single
  6. MY_PN=${PN^^}
  7. DESCRIPTION="Jisyo (dictionary) files for the SKK Japanese-input software"
  8. HOMEPAGE="http://openlab.ring.gr.jp/skk/dic.html"
  9. ECVS_SERVER="openlab.jp:/circus/cvsroot"
  10. ECVS_MODULE="skk/dic"
  11. ECVS_USER="guest"
  12. ECVS_PASS="guest"
  13. LICENSE="GPL-2 freedist public-domain"
  14. SLOT="0"
  15. KEYWORDS=""
  16. IUSE="cdb"
  17. DEPEND="${RUBY_DEPS}
  18. app-i18n/skktools
  19. virtual/awk
  20. cdb? (
  21. || (
  22. dev-db/tinycdb
  23. dev-db/cdb
  24. )
  25. )"
  26. RDEPEND=""
  27. S="${WORKDIR}/${ECVS_MODULE}"
  28. DOCS=( ChangeLog{,.{1..3}} READMEs/committers.txt edict_doc.txt zipcode/README.ja )
  29. SKKTOOLS_DIR="${EPREFIX}/usr/share/skktools/convert2skk"
  30. src_prepare() {
  31. rm -f ${MY_PN}.{wrong*,noregist,not_wrong,hukugougo,notes,requested,pubdic+}
  32. eapply_user
  33. }
  34. cdb_make() {
  35. cdbmake "${1}" "${1}.tmp"
  36. }
  37. tinycdb_make() {
  38. cdb -c "${1}"
  39. }
  40. src_compile() {
  41. local ctdic="${MY_PN}.china_taiwan" ruby
  42. mv ${ctdic}{.header,}
  43. for ruby in ${USE_RUBY}; do
  44. if has_version dev-lang/ruby:${ruby:4:1}.${ruby:5}; then
  45. ${ruby} ${SKKTOOLS_DIR}/ctdicconv.rb csv/${ctdic##*.}.csv | skkdic-expr2 >> ${ctdic}
  46. break
  47. fi
  48. done
  49. if use cdb; then
  50. local cdbmake=cdb_make f
  51. if has_version dev-db/tinycdb; then
  52. cdbmake=tinycdb_make
  53. fi
  54. for f in {,zipcode/}${MY_PN}.*; do
  55. LC_ALL=C awk '
  56. /^[^;]/ {
  57. s = substr($0, index($0, " ") + 1)
  58. print "+" length($1) "," length(s) ":" $1 "->" s
  59. }
  60. END {
  61. print ""
  62. }
  63. ' ${f} | ${cdbmake} ${f}.cdb || die
  64. done
  65. fi
  66. }
  67. src_install() {
  68. insinto /usr/share/skk
  69. doins {,zipcode/}${MY_PN}.*
  70. }