1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: cannadic.eclass
7 # Original author: Mamoru KOMACHI <usata@gentoo.org>
8 # @BLURB: Function for Canna compatible dictionaries
10 # The cannadic eclass is used for installation and setup of Canna
11 # compatible dictionaries within the Portage system.
14 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
18 HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
19 SRC_URI="mirror://gentoo/${P}.tar.gz"
21 LICENSE="public-domain"
26 DICSDIRFILE="${FILESDIR}/*.dics.dir"
27 CANNADICS="${CANNADICS}" # (optional)
30 # You don't need to modify these
31 #local cannadir dicsdir
32 cannadir="${ROOT}/var/lib/canna/dic/canna"
33 dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
35 # @FUNCTION: cannadic_pkg_setup
37 # Sets up cannadic dir
38 cannadic_pkg_setup() {
41 fowners bin:bin $cannadir
45 # @FUNCTION: cannadic-install
47 # Installs dictionaries to cannadir
51 insopts -m0664 -o bin -g bin
55 # @FUNCTION: dicsdir-install
57 # Installs dics.dir from ${DICSDIRFILE}
64 # @FUNCTION: cannadic_src_install
66 # Installs all dictionaries under ${WORKDIR}
67 # plus dics.dir and docs
68 cannadic_src_install() {
70 for f in *.c[btl]d *.t ; do
74 dicsdir-install || die
79 # @FUNCTION: update-cannadic-dir
81 # Updates dics.dir for Canna Server, script for this part taken from Debian GNU/Linux
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 update-cannadic-dir() {
90 einfo "Updating dics.dir for Canna ..."
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.
99 for file in ${dicsdir}/*.dics.dir ; do
100 echo "# $file" >> ${cannadir}/dics.dir.update-new
101 cat $file >> ${cannadir}/dics.dir.update-new
105 mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
112 # @FUNCTION: cannadic_pkg_postinst
114 # Updates dics.dir and print out notice after install
115 cannadic_pkg_postinst() {
118 einfo "Please restart cannaserver to fit the changes."
119 einfo "You need to modify your config file (~/.canna) to enable dictionaries."
121 if [ -n "${CANNADICS}" ] ; then
122 einfo "e.g) add $(for d in ${CANNADICS}; do
124 done)to section use-dictionary()."
125 einfo "For details, see documents under /usr/share/doc/${PF}"
128 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."
134 # @FUNCTION: cannadic_pkg_postrm
136 # Updates dics.dir and print out notice after uninstall
137 cannadic_pkg_postrm() {
140 einfo "Please restart cannaserver to fit changes."
141 einfo "and modify your config file (~/.canna) to disable dictionary."
143 if [ -n "${CANNADICS}" ] ; then
144 einfo "e.g) delete $(for d in ${CANNADICS}; do
146 done)from section use-dictionary()."