summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMamoru Komachi <usata@gentoo.org>2003-09-11 06:22:21 +0000
committerMamoru Komachi <usata@gentoo.org>2003-09-11 06:22:21 +0000
commit46a798f1ba24236cd0d3e456c5b9ade0edb2a6b8 (patch)
treed09326af8eca1c7757a5115c4d702edbaa7b28db /eclass
parentReadd patch with -ko so cvs doesn't b0rk it. (diff)
downloadgentoo-2-46a798f1ba24236cd0d3e456c5b9ade0edb2a6b8.tar.gz
gentoo-2-46a798f1ba24236cd0d3e456c5b9ade0edb2a6b8.tar.bz2
gentoo-2-46a798f1ba24236cd0d3e456c5b9ade0edb2a6b8.zip
Initial import.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cannadic.eclass162
1 files changed, 162 insertions, 0 deletions
diff --git a/eclass/cannadic.eclass b/eclass/cannadic.eclass
new file mode 100644
index 000000000000..4dec4d59d793
--- /dev/null
+++ b/eclass/cannadic.eclass
@@ -0,0 +1,162 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.1 2003/09/11 06:22:21 usata Exp $
+#
+# Author: Mamoru KOMACHI <usata@gentoo.org>
+#
+# The cannadic eclass is used for installation and setup of Canna
+# compatible dictionaries within the Portage system.
+#
+
+ECLASS=cannadic
+INHERITED="$INHERITED $ECLASS"
+EXPORT_FUNCTIONS cannadic-install dicsdir-install update-cannadic-dir \
+ src_install pkg_setup pkg_postinst pkg_postrm
+
+IUSE="${IUSE} canna"
+
+DESCRIPTION="Based on the $ECLASS eclass"
+HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="public-domain"
+# I added all keywords form /usr/portage/profiles/keyword.desc atm since
+# cannadic source is basically plain text and will run on any platform
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~mips ~hpps ~arm ~amd64"
+SLOT="0"
+
+# I don't add Canna as a dependency because Anthy also uses cannadic
+DEPEND="${DEPEND}
+ canna? ( app-i18n/canna )"
+
+S="${WORKDIR}"
+
+DICSDIRFILE="$(echo ${FILESDIR}/*.dics.dir)"
+CANNADICS="${CANNADICS}" # (optional)
+DOCS="README*"
+
+# You don't need to modify these
+#local cannadir dicsdir
+cannadir="/var/lib/canna/dic/canna"
+dicsdir="/var/lib/canna/dic/dics.d"
+
+#
+# pkg_setup() : sets up cannadic dir
+pkg_setup() {
+
+ keepdir $cannadir
+ fowners bin:bin $cannadir
+ fperms 0775 $cannadir
+}
+
+#
+# cannadic-install() : installs dictionaries to cannadir
+#
+cannadic-install() {
+
+ insinto $cannadir
+ insopts -m0664 -o bin -g bin
+ doins "$@"
+}
+
+#
+# dicsdir-install() : installs dics.dir from ${FILESDIR}
+#
+dicsdir-install() {
+
+ insinto ${dicsdir}
+ doins ${DICSDIRFILE}
+}
+
+#
+# src_install() : installs all dictionaries under ${WORKDIR}
+# plus dics.dir and docs
+#
+src_install() {
+
+ for f in *.c[btl]d *.t ; do
+ cannadic-install $f
+ done 2>/dev/null
+
+ if [ -n "`use canna`" ] ; then
+ dicsdir-install || die
+ fi
+
+ dodoc ${DOCS}
+}
+
+#
+# update-cannadic-dir() : updates dics.dir for Canna Server,
+# script for this part taken from Debian GNU/Linux
+#
+# compiles dics.dir files for Canna Server
+# Copyright 2001 ISHIKAWA Mutsumi
+# Licensed under the GNU General Public License, version 2. See the file
+# /usr/portage/license/GPL-2 or <http://www.gnu.org/copyleft/gpl.txt>.
+update-cannadic-dir() {
+
+ einfo
+ einfo "Updating dics.dir for Canna ..."
+ einfo
+
+ # write new dics.dir file in case we are interrupted
+ cat >${cannadir}/dics.dir.update-new<<-EOF
+ # dics.dir -- automatically generated file by Portage.
+ # DO NOT EDIT BY HAND.
+ EOF
+
+ for file in ${dicsdir}/*.dics.dir ; do
+ echo "# $file" >> ${cannadir}/dics.dir.update-new
+ cat $file >> ${cannadir}/dics.dir.update-new
+ einfo "Added $file."
+ done
+
+ mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
+
+ einfo
+ einfo "Done."
+ einfo
+}
+
+#
+# pkg_postinst() : updates dics.dir and print out notice after install
+#
+pkg_postinst() {
+
+ if [ -n "`use canna`" ] ; then
+ update-cannadic-dir
+ einfo
+ einfo "Please restart cannaserver to fit changes."
+ einfo "and modify your config file (~/.canna) to enable dictionary."
+
+ if [ -n "${CANNADICS}" ] ; then
+ einfo "e.g) add $(for d in ${CANNADICS}; do
+ echo -n \"$d\"\
+ done)to section use-dictionary()."
+ einfo "For details, see documents under /usr/share/doc/${PF}"
+ fi
+
+ einfo
+ fi
+}
+
+#
+# pkg_postrm() : updates dics.dir and print out notice after uninstall
+#
+pkg_postrm() {
+
+ if [ -n "`use canna`" ] ; then
+ update-cannadic-dir
+ einfo
+ einfo "Please restart cannaserver to fit changes."
+ einfo "and modify your config file (~/.canna) to disable dictionary."
+
+ if [ -n "${CANNADICS}" ] ; then
+ einfo "e.g) delete $(for d in ${CANNADICS}; do
+ echo -n \"$d\"\
+ done)from section use-dictionary()."
+ fi
+
+ einfo
+ fi
+}