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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Wed Jan 5 09:26:30 2005 UTC (9 years, 9 months ago) by usata
Branch: MAIN
Changes since 1.6: +2 -1 lines
Add instruction for finding sample configuration files.

1 vapier 1.6 # Copyright 1999-2004 Gentoo Foundation
2 usata 1.1 # Distributed under the terms of the GNU General Public License v2
3 usata 1.7 # $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.6 2004/06/25 00:39:48 vapier Exp $
4 usata 1.1 #
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 usata 1.4 cannadir="${ROOT}/var/lib/canna/dic/canna"
34     dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
35 usata 1.1
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 mr_bones_ 1.5 if use canna ; then
75 usata 1.1 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 mr_bones_ 1.5 if use canna ; then
120 usata 1.1 update-cannadic-dir
121     einfo
122 usata 1.4 einfo "Please restart cannaserver to fit the changes."
123     einfo "You need to modify your config file (~/.canna) to enable dictionaries."
124 usata 1.1
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 usata 1.7 einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
133 usata 1.4 ewarn "If you are upgrading from existing dictionary, you may need to recreate"
134     ewarn "user dictionary if you have one."
135 usata 1.1 einfo
136     fi
137     }
138    
139     #
140     # pkg_postrm() : updates dics.dir and print out notice after uninstall
141     #
142     pkg_postrm() {
143    
144 mr_bones_ 1.5 if use canna ; then
145 usata 1.1 update-cannadic-dir
146     einfo
147     einfo "Please restart cannaserver to fit changes."
148     einfo "and modify your config file (~/.canna) to disable dictionary."
149    
150     if [ -n "${CANNADICS}" ] ; then
151     einfo "e.g) delete $(for d in ${CANNADICS}; do
152     echo -n \"$d\"\
153     done)from section use-dictionary()."
154     fi
155    
156     einfo
157     fi
158     }

  ViewVC Help
Powered by ViewVC 1.1.20