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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed Nov 30 09:59:19 2005 UTC (8 years, 9 months ago) by chriswhite
Changes since 1.1: +20 -27 lines
*** empty log message ***

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.12 2005/08/23 14:55:11 swegener 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 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
12
13 IUSE="canna"
14
15 DESCRIPTION="Based on the $ECLASS eclass"
16 HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
17 SRC_URI="mirror://gentoo/${P}.tar.gz"
18
19 LICENSE="public-domain"
20 SLOT="0"
21
22 S="${WORKDIR}"
23
24 DICSDIRFILE="$(echo ${FILESDIR}/*.dics.dir)"
25 CANNADICS="${CANNADICS}" # (optional)
26 DOCS="README*"
27
28 # You don't need to modify these
29 #local cannadir dicsdir
30 cannadir="${ROOT}/var/lib/canna/dic/canna"
31 dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
32
33 #
34 # pkg_setup() : sets up cannadic dir
35 cannadic_pkg_setup() {
36
37 keepdir $cannadir
38 fowners bin:bin $cannadir
39 fperms 0775 $cannadir
40 }
41
42 #
43 # cannadic-install() : installs dictionaries to cannadir
44 #
45 cannadic-install() {
46
47 insinto $cannadir
48 insopts -m0664 -o bin -g bin
49 doins "$@"
50 }
51
52 #
53 # dicsdir-install() : installs dics.dir from ${FILESDIR}
54 #
55 dicsdir-install() {
56
57 insinto ${dicsdir}
58 doins ${DICSDIRFILE}
59 }
60
61 #
62 # src_install() : installs all dictionaries under ${WORKDIR}
63 # plus dics.dir and docs
64 #
65 cannadic_src_install() {
66
67 for f in *.c[btl]d *.t ; do
68 cannadic-install $f
69 done 2>/dev/null
70
71 if use canna ; then
72 dicsdir-install || die
73 fi
74
75 dodoc ${DOCS}
76 }
77
78 #
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 # Copyright 2001 ISHIKAWA Mutsumi
84 # 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 update-cannadic-dir() {
87
88 einfo
89 einfo "Updating dics.dir for Canna ..."
90 einfo
91
92 # write new dics.dir file in case we are interrupted
93 cat >${cannadir}/dics.dir.update-new<<-EOF
94 # dics.dir -- automatically generated file by Portage.
95 # DO NOT EDIT BY HAND.
96 EOF
97
98 for file in ${dicsdir}/*.dics.dir ; do
99 echo "# $file" >> ${cannadir}/dics.dir.update-new
100 cat $file >> ${cannadir}/dics.dir.update-new
101 einfo "Added $file."
102 done
103
104 mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
105
106 einfo
107 einfo "Done."
108 einfo
109 }
110
111 #
112 # pkg_postinst() : updates dics.dir and print out notice after install
113 #
114 cannadic_pkg_postinst() {
115
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
123 einfo "e.g) add $(for d in ${CANNADICS}; do
124 echo -n "\"$d\" "
125 done)to section use-dictionary()."
126 einfo "For details, see documents under /usr/share/doc/${PF}"
127 fi
128
129 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"
131 ewarn "user dictionary if you have one."
132 einfo
133 fi
134 }
135
136 #
137 # pkg_postrm() : updates dics.dir and print out notice after uninstall
138 #
139 cannadic_pkg_postrm() {
140
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
148 einfo "e.g) delete $(for d in ${CANNADICS}; do
149 echo -n "\"$d\" "
150 done)from section use-dictionary()."
151 fi
152
153 einfo
154 fi
155 }

  ViewVC Help
Powered by ViewVC 1.1.20