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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Wed Sep 10 08:15:48 2008 UTC (5 years, 11 months ago) by pva
Branch: MAIN
Changes since 1.14: +38 -32 lines
Make eclass-manpages ready, bug #210776, thank mren for report.

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

  ViewVC Help
Powered by ViewVC 1.1.20