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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Thu Jun 3 23:40:50 2004 UTC (10 years, 1 month ago) by mr_bones_
Branch: MAIN
Changes since 1.4: +4 -4 lines
Fix use invocation

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

  ViewVC Help
Powered by ViewVC 1.1.20