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

Contents of /eclass/cannadic.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations) (download)
Mon Aug 22 04:46:31 2011 UTC (2 years, 11 months 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 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.15 2008/09/10 08:15:48 pva Exp $
4
5 # @ECLASS: cannadic.eclass
6 # @AUTHOR:
7 # Original author: Mamoru KOMACHI <usata@gentoo.org>
8 # @BLURB: Function for Canna compatible dictionaries
9 # @DESCRIPTION:
10 # The cannadic eclass is used for installation and setup of Canna
11 # compatible dictionaries within the Portage system.
12
13
14 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
15
16 IUSE=""
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 SLOT="0"
24
25 S="${WORKDIR}"
26
27 DICSDIRFILE="${FILESDIR}/*.dics.dir"
28 CANNADICS="${CANNADICS}" # (optional)
29 DOCS="README*"
30
31 # You don't need to modify these
32 #local cannadir dicsdir
33 cannadir="${ROOT}/var/lib/canna/dic/canna"
34 dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
35
36 # @FUNCTION: cannadic_pkg_setup
37 # @DESCRIPTION:
38 # Sets up cannadic dir
39 cannadic_pkg_setup() {
40
41 keepdir $cannadir
42 fowners bin:bin $cannadir
43 fperms 0775 $cannadir
44 }
45
46 # @FUNCTION: cannadic-install
47 # @DESCRIPTION:
48 # Installs dictionaries to cannadir
49 cannadic-install() {
50
51 insinto $cannadir
52 insopts -m0664 -o bin -g bin
53 doins "$@"
54 }
55
56 # @FUNCTION: dicsdir-install
57 # @DESCRIPTION:
58 # Installs dics.dir from ${DICSDIRFILE}
59 dicsdir-install() {
60
61 insinto ${dicsdir}
62 doins ${DICSDIRFILE}
63 }
64
65 # @FUNCTION: cannadic_src_install
66 # @DESCRIPTION:
67 # Installs all dictionaries under ${WORKDIR}
68 # plus dics.dir and docs
69 cannadic_src_install() {
70
71 for f in *.c[btl]d *.t ; do
72 cannadic-install $f
73 done 2>/dev/null
74
75 dicsdir-install || die
76
77 dodoc ${DOCS}
78 }
79
80 # @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 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 # @FUNCTION: cannadic_pkg_postinst
114 # @DESCRIPTION:
115 # Updates dics.dir and print out notice after install
116 cannadic_pkg_postinst() {
117 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
122 if [ -n "${CANNADICS}" ] ; then
123 einfo "e.g) add $(for d in ${CANNADICS}; do
124 echo -n "\"$d\" "
125 done)to section use-dictionary()."
126 einfo "For details, see documents under /usr/share/doc/${PF}"
127 fi
128
129 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 }
134
135 # @FUNCTION: cannadic_pkg_postrm
136 # @DESCRIPTION:
137 # Updates dics.dir and print out notice after uninstall
138 cannadic_pkg_postrm() {
139 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
144 if [ -n "${CANNADICS}" ] ; then
145 einfo "e.g) delete $(for d in ${CANNADICS}; do
146 echo -n "\"$d\" "
147 done)from section use-dictionary()."
148 fi
149
150 einfo
151 }

  ViewVC Help
Powered by ViewVC 1.1.20