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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Wed Jul 6 20:20:03 2005 UTC (9 years, 1 month ago) by agriffis
Branch: MAIN
Changes since 1.8: +1 -2 lines
Remove ECLASS= and INHERITED= which haven't been necessary for a long time now

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

  ViewVC Help
Powered by ViewVC 1.1.20