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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $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 # The cannadic eclass is used for installation and setup of Canna
13 # compatible dictionaries within the Portage system.
14
15
16 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
17
18 IUSE=""
19
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 DICSDIRFILE="${FILESDIR}/*.dics.dir"
30 CANNADICS="${CANNADICS}" # (optional)
31 DOCS="README*"
32
33 # You don't need to modify these
34 #local cannadir dicsdir
35 cannadir="${ROOT}/var/lib/canna/dic/canna"
36 dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
37
38 # @FUNCTION: cannadic_pkg_setup
39 # @DESCRIPTION:
40 # Sets up cannadic dir
41 cannadic_pkg_setup() {
42
43 keepdir $cannadir
44 fowners bin:bin $cannadir
45 fperms 0775 $cannadir
46 }
47
48 # @FUNCTION: cannadic-install
49 # @DESCRIPTION:
50 # Installs dictionaries to cannadir
51 cannadic-install() {
52
53 insinto $cannadir
54 insopts -m0664 -o bin -g bin
55 doins "$@"
56 }
57
58 # @FUNCTION: dicsdir-install
59 # @DESCRIPTION:
60 # Installs dics.dir from ${DICSDIRFILE}
61 dicsdir-install() {
62
63 insinto ${dicsdir}
64 doins ${DICSDIRFILE}
65 }
66
67 # @FUNCTION: cannadic_src_install
68 # @DESCRIPTION:
69 # Installs all dictionaries under ${WORKDIR}
70 # plus dics.dir and docs
71 cannadic_src_install() {
72
73 for f in *.c[btl]d *.t ; do
74 cannadic-install $f
75 done 2>/dev/null
76
77 dicsdir-install || die
78
79 dodoc ${DOCS}
80 }
81
82 # @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 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 # @FUNCTION: cannadic_pkg_postinst
116 # @DESCRIPTION:
117 # Updates dics.dir and print out notice after install
118 cannadic_pkg_postinst() {
119 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
124 if [ -n "${CANNADICS}" ] ; then
125 einfo "e.g) add $(for d in ${CANNADICS}; do
126 echo -n "\"$d\" "
127 done)to section use-dictionary()."
128 einfo "For details, see documents under /usr/share/doc/${PF}"
129 fi
130
131 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 }
136
137 # @FUNCTION: cannadic_pkg_postrm
138 # @DESCRIPTION:
139 # Updates dics.dir and print out notice after uninstall
140 cannadic_pkg_postrm() {
141 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
146 if [ -n "${CANNADICS}" ] ; then
147 einfo "e.g) delete $(for d in ${CANNADICS}; do
148 echo -n "\"$d\" "
149 done)from section use-dictionary()."
150 fi
151
152 einfo
153 }

  ViewVC Help
Powered by ViewVC 1.1.20