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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations) (download)
Mon Aug 22 04:46:31 2011 UTC (3 years, 1 month ago) by vapier
Branch: MAIN
Changes since 1.15: +4 -6 lines
fix random bugs in eclass documentation, and convert to new @AUTHOR tag

1 vapier 1.16 # Copyright 1999-2011 Gentoo Foundation
2 usata 1.1 # Distributed under the terms of the GNU General Public License v2
3 vapier 1.16 # $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.15 2008/09/10 08:15:48 pva Exp $
4 pva 1.15
5     # @ECLASS: cannadic.eclass
6 vapier 1.16 # @AUTHOR:
7 pva 1.15 # Original author: Mamoru KOMACHI <usata@gentoo.org>
8     # @BLURB: Function for Canna compatible dictionaries
9     # @DESCRIPTION:
10 usata 1.1 # The cannadic eclass is used for installation and setup of Canna
11     # compatible dictionaries within the Portage system.
12 pva 1.15
13 usata 1.1
14 agriffis 1.8 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
15 usata 1.1
16 flameeyes 1.14 IUSE=""
17 usata 1.1
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 antarus 1.13 DICSDIRFILE="${FILESDIR}/*.dics.dir"
28 usata 1.1 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 pva 1.15 # @FUNCTION: cannadic_pkg_setup
37 vapier 1.16 # @DESCRIPTION:
38 pva 1.15 # Sets up cannadic dir
39 agriffis 1.8 cannadic_pkg_setup() {
40 usata 1.1
41     keepdir $cannadir
42     fowners bin:bin $cannadir
43     fperms 0775 $cannadir
44     }
45    
46 pva 1.15 # @FUNCTION: cannadic-install
47     # @DESCRIPTION:
48     # Installs dictionaries to cannadir
49 usata 1.1 cannadic-install() {
50    
51     insinto $cannadir
52     insopts -m0664 -o bin -g bin
53     doins "$@"
54     }
55    
56 pva 1.15 # @FUNCTION: dicsdir-install
57     # @DESCRIPTION:
58     # Installs dics.dir from ${DICSDIRFILE}
59 usata 1.1 dicsdir-install() {
60    
61     insinto ${dicsdir}
62     doins ${DICSDIRFILE}
63     }
64    
65 pva 1.15 # @FUNCTION: cannadic_src_install
66     # @DESCRIPTION:
67     # Installs all dictionaries under ${WORKDIR}
68     # plus dics.dir and docs
69 agriffis 1.8 cannadic_src_install() {
70 usata 1.1
71     for f in *.c[btl]d *.t ; do
72     cannadic-install $f
73     done 2>/dev/null
74    
75 flameeyes 1.14 dicsdir-install || die
76 usata 1.1
77     dodoc ${DOCS}
78     }
79    
80 pva 1.15 # @FUNCTION: update-cannadic-dir
81     # @DESCRIPTION:
82     # Updates dics.dir for Canna Server, 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 usata 1.1 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 pva 1.15 # @FUNCTION: cannadic_pkg_postinst
114     # @DESCRIPTION:
115     # Updates dics.dir and print out notice after install
116 agriffis 1.8 cannadic_pkg_postinst() {
117 flameeyes 1.14 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 usata 1.1
122 flameeyes 1.14 if [ -n "${CANNADICS}" ] ; then
123     einfo "e.g) add $(for d in ${CANNADICS}; do
124 swegener 1.11 echo -n "\"$d\" "
125 usata 1.1 done)to section use-dictionary()."
126 flameeyes 1.14 einfo "For details, see documents under /usr/share/doc/${PF}"
127     fi
128 usata 1.1
129 flameeyes 1.14 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 usata 1.1 }
134    
135 pva 1.15 # @FUNCTION: cannadic_pkg_postrm
136     # @DESCRIPTION:
137     # Updates dics.dir and print out notice after uninstall
138 agriffis 1.8 cannadic_pkg_postrm() {
139 flameeyes 1.14 update-cannadic-dir
140     einfo
141     einfo "Please restart cannaserver to fit changes."
142     einfo "and modify your config file (~/.canna) to disable dictionary."
143 usata 1.1
144 flameeyes 1.14 if [ -n "${CANNADICS}" ] ; then
145     einfo "e.g) delete $(for d in ${CANNADICS}; do
146 swegener 1.11 echo -n "\"$d\" "
147 usata 1.1 done)from section use-dictionary()."
148 flameeyes 1.14 fi
149 usata 1.1
150 flameeyes 1.14 einfo
151 usata 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20