1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: cannadic.eclass
6 # Original author: Mamoru KOMACHI <usata@gentoo.org>
7 # @BLURB: Function for Canna compatible dictionaries
9 # The cannadic eclass is used for installation and setup of Canna
10 # compatible dictionaries within the Portage system.
13 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
17 HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
18 SRC_URI="mirror://gentoo/${P}.tar.gz"
20 LICENSE="public-domain"
25 DICSDIRFILE="${FILESDIR}/*.dics.dir"
26 CANNADICS="${CANNADICS}" # (optional)
29 # You don't need to modify these
30 #local cannadir dicsdir
31 cannadir="${ROOT}/var/lib/canna/dic/canna"
32 dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
34 # @FUNCTION: cannadic_pkg_setup
36 # Sets up cannadic dir
37 cannadic_pkg_setup() {
40 fowners bin:bin $cannadir
44 # @FUNCTION: cannadic-install
46 # Installs dictionaries to cannadir
50 insopts -m0664 -o bin -g bin
54 # @FUNCTION: dicsdir-install
56 # Installs dics.dir from ${DICSDIRFILE}
63 # @FUNCTION: cannadic_src_install
65 # Installs all dictionaries under ${WORKDIR}
66 # plus dics.dir and docs
67 cannadic_src_install() {
69 for f in *.c[btl]d *.t ; do
73 dicsdir-install || die
78 # @FUNCTION: update-cannadic-dir
80 # Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
82 # compiles dics.dir files for Canna Server
83 # Copyright 2001 ISHIKAWA Mutsumi
84 # Licensed under the GNU General Public License, version 2. See the file
85 # /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
86 update-cannadic-dir() {
89 einfo "Updating dics.dir for Canna ..."
92 # write new dics.dir file in case we are interrupted
93 cat >${cannadir}/dics.dir.update-new<<-EOF
94 # dics.dir -- automatically generated file by Portage.
95 # DO NOT EDIT BY HAND.
98 for file in ${dicsdir}/*.dics.dir ; do
99 echo "# $file" >> ${cannadir}/dics.dir.update-new
100 cat $file >> ${cannadir}/dics.dir.update-new
104 mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
111 # @FUNCTION: cannadic_pkg_postinst
113 # Updates dics.dir and print out notice after install
114 cannadic_pkg_postinst() {
117 einfo "Please restart cannaserver to fit the changes."
118 einfo "You need to modify your config file (~/.canna) to enable dictionaries."
120 if [ -n "${CANNADICS}" ] ; then
121 einfo "e.g) add $(for d in ${CANNADICS}; do
123 done)to section use-dictionary()."
124 einfo "For details, see documents under /usr/share/doc/${PF}"
127 einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
128 ewarn "If you are upgrading from existing dictionary, you may need to recreate"
129 ewarn "user dictionary if you have one."
133 # @FUNCTION: cannadic_pkg_postrm
135 # Updates dics.dir and print out notice after uninstall
136 cannadic_pkg_postrm() {
139 einfo "Please restart cannaserver to fit changes."
140 einfo "and modify your config file (~/.canna) to disable dictionary."
142 if [ -n "${CANNADICS}" ] ; then
143 einfo "e.g) delete $(for d in ${CANNADICS}; do
145 done)from section use-dictionary()."