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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Sat Sep 15 16:16:53 2012 UTC (23 months ago) by zmedico
Branch: MAIN
CVS Tags: HEAD
Changes since 1.16: +2 -3 lines
Remove redundant DESCRIPTION variable settings.

1 zmedico 1.17 # Copyright 1999-2012 Gentoo Foundation
2 usata 1.1 # Distributed under the terms of the GNU General Public License v2
3 zmedico 1.17 # $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.16 2011/08/22 04:46:31 vapier 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     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 antarus 1.13 DICSDIRFILE="${FILESDIR}/*.dics.dir"
27 usata 1.1 CANNADICS="${CANNADICS}" # (optional)
28     DOCS="README*"
29    
30     # You don't need to modify these
31     #local cannadir dicsdir
32 usata 1.4 cannadir="${ROOT}/var/lib/canna/dic/canna"
33     dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
34 usata 1.1
35 pva 1.15 # @FUNCTION: cannadic_pkg_setup
36 vapier 1.16 # @DESCRIPTION:
37 pva 1.15 # Sets up cannadic dir
38 agriffis 1.8 cannadic_pkg_setup() {
39 usata 1.1
40     keepdir $cannadir
41     fowners bin:bin $cannadir
42     fperms 0775 $cannadir
43     }
44    
45 pva 1.15 # @FUNCTION: cannadic-install
46     # @DESCRIPTION:
47     # Installs dictionaries to cannadir
48 usata 1.1 cannadic-install() {
49    
50     insinto $cannadir
51     insopts -m0664 -o bin -g bin
52     doins "$@"
53     }
54    
55 pva 1.15 # @FUNCTION: dicsdir-install
56     # @DESCRIPTION:
57     # Installs dics.dir from ${DICSDIRFILE}
58 usata 1.1 dicsdir-install() {
59    
60     insinto ${dicsdir}
61     doins ${DICSDIRFILE}
62     }
63    
64 pva 1.15 # @FUNCTION: cannadic_src_install
65     # @DESCRIPTION:
66     # Installs all dictionaries under ${WORKDIR}
67     # plus dics.dir and docs
68 agriffis 1.8 cannadic_src_install() {
69 usata 1.1
70     for f in *.c[btl]d *.t ; do
71     cannadic-install $f
72     done 2>/dev/null
73    
74 flameeyes 1.14 dicsdir-install || die
75 usata 1.1
76     dodoc ${DOCS}
77     }
78    
79 pva 1.15 # @FUNCTION: update-cannadic-dir
80     # @DESCRIPTION:
81     # Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
82     #
83     # compiles dics.dir files for Canna Server
84     # Copyright 2001 ISHIKAWA Mutsumi
85     # Licensed under the GNU General Public License, version 2. See the file
86     # /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
87 usata 1.1 update-cannadic-dir() {
88    
89     einfo
90     einfo "Updating dics.dir for Canna ..."
91     einfo
92    
93     # write new dics.dir file in case we are interrupted
94     cat >${cannadir}/dics.dir.update-new<<-EOF
95     # dics.dir -- automatically generated file by Portage.
96     # DO NOT EDIT BY HAND.
97     EOF
98    
99     for file in ${dicsdir}/*.dics.dir ; do
100     echo "# $file" >> ${cannadir}/dics.dir.update-new
101     cat $file >> ${cannadir}/dics.dir.update-new
102     einfo "Added $file."
103     done
104    
105     mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
106    
107     einfo
108     einfo "Done."
109     einfo
110     }
111    
112 pva 1.15 # @FUNCTION: cannadic_pkg_postinst
113     # @DESCRIPTION:
114     # Updates dics.dir and print out notice after install
115 agriffis 1.8 cannadic_pkg_postinst() {
116 flameeyes 1.14 update-cannadic-dir
117     einfo
118     einfo "Please restart cannaserver to fit the changes."
119     einfo "You need to modify your config file (~/.canna) to enable dictionaries."
120 usata 1.1
121 flameeyes 1.14 if [ -n "${CANNADICS}" ] ; then
122     einfo "e.g) add $(for d in ${CANNADICS}; do
123 swegener 1.11 echo -n "\"$d\" "
124 usata 1.1 done)to section use-dictionary()."
125 flameeyes 1.14 einfo "For details, see documents under /usr/share/doc/${PF}"
126     fi
127 usata 1.1
128 flameeyes 1.14 einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
129     ewarn "If you are upgrading from existing dictionary, you may need to recreate"
130     ewarn "user dictionary if you have one."
131     einfo
132 usata 1.1 }
133    
134 pva 1.15 # @FUNCTION: cannadic_pkg_postrm
135     # @DESCRIPTION:
136     # Updates dics.dir and print out notice after uninstall
137 agriffis 1.8 cannadic_pkg_postrm() {
138 flameeyes 1.14 update-cannadic-dir
139     einfo
140     einfo "Please restart cannaserver to fit changes."
141     einfo "and modify your config file (~/.canna) to disable dictionary."
142 usata 1.1
143 flameeyes 1.14 if [ -n "${CANNADICS}" ] ; then
144     einfo "e.g) delete $(for d in ${CANNADICS}; do
145 swegener 1.11 echo -n "\"$d\" "
146 usata 1.1 done)from section use-dictionary()."
147 flameeyes 1.14 fi
148 usata 1.1
149 flameeyes 1.14 einfo
150 usata 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20