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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Mon Dec 29 15:50:08 2003 UTC (10 years, 7 months ago) by usata
Branch: MAIN
Changes since 1.1: +1 -5 lines
Removed DEPEND list

1 usata 1.1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2     # Distributed under the terms of the GNU General Public License v2
3 usata 1.2 # $Header: /home/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.1 2003/09/11 06:22:21 usata 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     # I added all keywords form /usr/portage/profiles/keyword.desc atm since
24     # cannadic source is basically plain text and will run on any platform
25     KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hpps ~arm ~amd64"
26     SLOT="0"
27    
28     S="${WORKDIR}"
29    
30     DICSDIRFILE="$(echo ${FILESDIR}/*.dics.dir)"
31     CANNADICS="${CANNADICS}" # (optional)
32     DOCS="README*"
33    
34     # You don't need to modify these
35     #local cannadir dicsdir
36     cannadir="/var/lib/canna/dic/canna"
37     dicsdir="/var/lib/canna/dic/dics.d"
38    
39     #
40     # pkg_setup() : sets up cannadic dir
41     pkg_setup() {
42    
43     keepdir $cannadir
44     fowners bin:bin $cannadir
45     fperms 0775 $cannadir
46     }
47    
48     #
49     # cannadic-install() : installs dictionaries to cannadir
50     #
51     cannadic-install() {
52    
53     insinto $cannadir
54     insopts -m0664 -o bin -g bin
55     doins "$@"
56     }
57    
58     #
59     # dicsdir-install() : installs dics.dir from ${FILESDIR}
60     #
61     dicsdir-install() {
62    
63     insinto ${dicsdir}
64     doins ${DICSDIRFILE}
65     }
66    
67     #
68     # src_install() : installs all dictionaries under ${WORKDIR}
69     # plus dics.dir and docs
70     #
71     src_install() {
72    
73     for f in *.c[btl]d *.t ; do
74     cannadic-install $f
75     done 2>/dev/null
76    
77     if [ -n "`use canna`" ] ; then
78     dicsdir-install || die
79     fi
80    
81     dodoc ${DOCS}
82     }
83    
84     #
85     # update-cannadic-dir() : updates dics.dir for Canna Server,
86     # script for this part taken from Debian GNU/Linux
87     #
88     # compiles dics.dir files for Canna Server
89     # Copyright 2001 ISHIKAWA Mutsumi
90     # Licensed under the GNU General Public License, version 2. See the file
91     # /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
92     update-cannadic-dir() {
93    
94     einfo
95     einfo "Updating dics.dir for Canna ..."
96     einfo
97    
98     # write new dics.dir file in case we are interrupted
99     cat >${cannadir}/dics.dir.update-new<<-EOF
100     # dics.dir -- automatically generated file by Portage.
101     # DO NOT EDIT BY HAND.
102     EOF
103    
104     for file in ${dicsdir}/*.dics.dir ; do
105     echo "# $file" >> ${cannadir}/dics.dir.update-new
106     cat $file >> ${cannadir}/dics.dir.update-new
107     einfo "Added $file."
108     done
109    
110     mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
111    
112     einfo
113     einfo "Done."
114     einfo
115     }
116    
117     #
118     # pkg_postinst() : updates dics.dir and print out notice after install
119     #
120     pkg_postinst() {
121    
122     if [ -n "`use canna`" ] ; then
123     update-cannadic-dir
124     einfo
125     einfo "Please restart cannaserver to fit changes."
126     einfo "and modify your config file (~/.canna) to enable dictionary."
127    
128     if [ -n "${CANNADICS}" ] ; then
129     einfo "e.g) add $(for d in ${CANNADICS}; do
130     echo -n \"$d\"\
131     done)to section use-dictionary()."
132     einfo "For details, see documents under /usr/share/doc/${PF}"
133     fi
134    
135     einfo
136     fi
137     }
138    
139     #
140     # pkg_postrm() : updates dics.dir and print out notice after uninstall
141     #
142     pkg_postrm() {
143    
144     if [ -n "`use canna`" ] ; then
145     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