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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Mon Jun 27 20:07:32 2005 UTC (8 years, 9 months ago) by agriffis
Branch: MAIN
Changes since 1.7: +6 -7 lines
Don't list normal functions on EXPORT_FUNCTIONS line.  Prefix src_install et al. with cannadic_ in the eclass.

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