/[gentoo-x86]/eclass/cannadic.eclass
Gentoo

Diff of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1.1.1 Revision 1.17
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.1.1.1 2005/11/30 09:59:19 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.17 2012/09/15 16:16:53 zmedico Exp $
4# 4
5# @ECLASS: cannadic.eclass
6# @AUTHOR:
5# Author: Mamoru KOMACHI <usata@gentoo.org> 7# Original author: Mamoru KOMACHI <usata@gentoo.org>
6# 8# @BLURB: Function for Canna compatible dictionaries
9# @DESCRIPTION:
7# The cannadic eclass is used for installation and setup of Canna 10# The cannadic eclass is used for installation and setup of Canna
8# compatible dictionaries within the Portage system. 11# compatible dictionaries within the Portage system.
9# 12
10 13
11EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm 14EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
12 15
13IUSE="canna" 16IUSE=""
14 17
15DESCRIPTION="Based on the $ECLASS eclass"
16HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this! 18HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
17SRC_URI="mirror://gentoo/${P}.tar.gz" 19SRC_URI="mirror://gentoo/${P}.tar.gz"
18 20
19LICENSE="public-domain" 21LICENSE="public-domain"
20SLOT="0" 22SLOT="0"
21 23
22S="${WORKDIR}" 24S="${WORKDIR}"
23 25
24DICSDIRFILE="$(echo ${FILESDIR}/*.dics.dir)" 26DICSDIRFILE="${FILESDIR}/*.dics.dir"
25CANNADICS="${CANNADICS}" # (optional) 27CANNADICS="${CANNADICS}" # (optional)
26DOCS="README*" 28DOCS="README*"
27 29
28# You don't need to modify these 30# You don't need to modify these
29#local cannadir dicsdir 31#local cannadir dicsdir
30cannadir="${ROOT}/var/lib/canna/dic/canna" 32cannadir="${ROOT}/var/lib/canna/dic/canna"
31dicsdir="${ROOT}/var/lib/canna/dic/dics.d" 33dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
32 34
33# 35# @FUNCTION: cannadic_pkg_setup
34# pkg_setup() : sets up cannadic dir 36# @DESCRIPTION:
37# Sets up cannadic dir
35cannadic_pkg_setup() { 38cannadic_pkg_setup() {
36 39
37 keepdir $cannadir 40 keepdir $cannadir
38 fowners bin:bin $cannadir 41 fowners bin:bin $cannadir
39 fperms 0775 $cannadir 42 fperms 0775 $cannadir
40} 43}
41 44
42# 45# @FUNCTION: cannadic-install
43# cannadic-install() : installs dictionaries to cannadir 46# @DESCRIPTION:
44# 47# Installs dictionaries to cannadir
45cannadic-install() { 48cannadic-install() {
46 49
47 insinto $cannadir 50 insinto $cannadir
48 insopts -m0664 -o bin -g bin 51 insopts -m0664 -o bin -g bin
49 doins "$@" 52 doins "$@"
50} 53}
51 54
52# 55# @FUNCTION: dicsdir-install
53# dicsdir-install() : installs dics.dir from ${FILESDIR} 56# @DESCRIPTION:
54# 57# Installs dics.dir from ${DICSDIRFILE}
55dicsdir-install() { 58dicsdir-install() {
56 59
57 insinto ${dicsdir} 60 insinto ${dicsdir}
58 doins ${DICSDIRFILE} 61 doins ${DICSDIRFILE}
59} 62}
60 63
61# 64# @FUNCTION: cannadic_src_install
65# @DESCRIPTION:
62# src_install() : installs all dictionaries under ${WORKDIR} 66# Installs all dictionaries under ${WORKDIR}
63# plus dics.dir and docs 67# plus dics.dir and docs
64#
65cannadic_src_install() { 68cannadic_src_install() {
66 69
67 for f in *.c[btl]d *.t ; do 70 for f in *.c[btl]d *.t ; do
68 cannadic-install $f 71 cannadic-install $f
69 done 2>/dev/null 72 done 2>/dev/null
70 73
71 if use canna ; then
72 dicsdir-install || die 74 dicsdir-install || die
73 fi
74 75
75 dodoc ${DOCS} 76 dodoc ${DOCS}
76} 77}
77 78
79# @FUNCTION: update-cannadic-dir
80# @DESCRIPTION:
81# Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
78# 82#
79# update-cannadic-dir() : updates dics.dir for Canna Server,
80# script for this part taken from Debian GNU/Linux
81#
82# compiles dics.dir files for Canna Server 83# compiles dics.dir files for Canna Server
83# Copyright 2001 ISHIKAWA Mutsumi 84# Copyright 2001 ISHIKAWA Mutsumi
84# Licensed under the GNU General Public License, version 2. See the file 85# Licensed under the GNU General Public License, version 2. See the file
85# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>. 86# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
86update-cannadic-dir() { 87update-cannadic-dir() {
87 88
88 einfo 89 einfo
89 einfo "Updating dics.dir for Canna ..." 90 einfo "Updating dics.dir for Canna ..."
90 einfo 91 einfo
106 einfo 107 einfo
107 einfo "Done." 108 einfo "Done."
108 einfo 109 einfo
109} 110}
110 111
111# 112# @FUNCTION: cannadic_pkg_postinst
113# @DESCRIPTION:
112# pkg_postinst() : updates dics.dir and print out notice after install 114# Updates dics.dir and print out notice after install
113#
114cannadic_pkg_postinst() { 115cannadic_pkg_postinst() {
116 update-cannadic-dir
117 einfo
118 einfo "Please restart cannaserver to fit the changes."
119 einfo "You need to modify your config file (~/.canna) to enable dictionaries."
115 120
116 if use canna ; then
117 update-cannadic-dir
118 einfo
119 einfo "Please restart cannaserver to fit the changes."
120 einfo "You need to modify your config file (~/.canna) to enable dictionaries."
121
122 if [ -n "${CANNADICS}" ] ; then 121 if [ -n "${CANNADICS}" ] ; then
123 einfo "e.g) add $(for d in ${CANNADICS}; do 122 einfo "e.g) add $(for d in ${CANNADICS}; do
124 echo -n "\"$d\" " 123 echo -n "\"$d\" "
125 done)to section use-dictionary()." 124 done)to section use-dictionary()."
126 einfo "For details, see documents under /usr/share/doc/${PF}" 125 einfo "For details, see documents under /usr/share/doc/${PF}"
127 fi 126 fi
128 127
129 einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna." 128 einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
130 ewarn "If you are upgrading from existing dictionary, you may need to recreate" 129 ewarn "If you are upgrading from existing dictionary, you may need to recreate"
131 ewarn "user dictionary if you have one." 130 ewarn "user dictionary if you have one."
132 einfo 131 einfo
133 fi
134} 132}
135 133
136# 134# @FUNCTION: cannadic_pkg_postrm
135# @DESCRIPTION:
137# pkg_postrm() : updates dics.dir and print out notice after uninstall 136# Updates dics.dir and print out notice after uninstall
138#
139cannadic_pkg_postrm() { 137cannadic_pkg_postrm() {
138 update-cannadic-dir
139 einfo
140 einfo "Please restart cannaserver to fit changes."
141 einfo "and modify your config file (~/.canna) to disable dictionary."
140 142
141 if use canna ; then
142 update-cannadic-dir
143 einfo
144 einfo "Please restart cannaserver to fit changes."
145 einfo "and modify your config file (~/.canna) to disable dictionary."
146
147 if [ -n "${CANNADICS}" ] ; then 143 if [ -n "${CANNADICS}" ] ; then
148 einfo "e.g) delete $(for d in ${CANNADICS}; do 144 einfo "e.g) delete $(for d in ${CANNADICS}; do
149 echo -n "\"$d\" " 145 echo -n "\"$d\" "
150 done)from section use-dictionary()." 146 done)from section use-dictionary()."
151 fi 147 fi
152 148
153 einfo 149 einfo
154 fi
155} 150}

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20