| 1 |
vapier |
1.6 |
# Copyright 1999-2004 Gentoo Foundation
|
| 2 |
usata |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
swegener |
1.11 |
# $Header: /var/cvsroot/gentoo-x86/eclass/cannadic.eclass,v 1.10 2005/07/06 20:23:20 agriffis Exp $
|
| 4 |
usata |
1.1 |
#
|
| 5 |
|
|
# Author: Mamoru KOMACHI <usata@gentoo.org>
|
| 6 |
|
|
#
|
| 7 |
|
|
# The cannadic eclass is used for installation and setup of Canna
|
| 8 |
|
|
# compatible dictionaries within the Portage system.
|
| 9 |
|
|
#
|
| 10 |
|
|
|
| 11 |
agriffis |
1.8 |
EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm
|
| 12 |
usata |
1.1 |
|
| 13 |
|
|
IUSE="${IUSE} canna"
|
| 14 |
|
|
|
| 15 |
|
|
DESCRIPTION="Based on the $ECLASS eclass"
|
| 16 |
|
|
HOMEPAGE="http://canna.sourceforge.jp/" # you need to change this!
|
| 17 |
|
|
SRC_URI="mirror://gentoo/${P}.tar.gz"
|
| 18 |
|
|
|
| 19 |
|
|
LICENSE="public-domain"
|
| 20 |
|
|
SLOT="0"
|
| 21 |
|
|
|
| 22 |
|
|
S="${WORKDIR}"
|
| 23 |
|
|
|
| 24 |
|
|
DICSDIRFILE="$(echo ${FILESDIR}/*.dics.dir)"
|
| 25 |
|
|
CANNADICS="${CANNADICS}" # (optional)
|
| 26 |
|
|
DOCS="README*"
|
| 27 |
|
|
|
| 28 |
|
|
# You don't need to modify these
|
| 29 |
|
|
#local cannadir dicsdir
|
| 30 |
usata |
1.4 |
cannadir="${ROOT}/var/lib/canna/dic/canna"
|
| 31 |
|
|
dicsdir="${ROOT}/var/lib/canna/dic/dics.d"
|
| 32 |
usata |
1.1 |
|
| 33 |
|
|
#
|
| 34 |
|
|
# pkg_setup() : sets up cannadic dir
|
| 35 |
agriffis |
1.8 |
cannadic_pkg_setup() {
|
| 36 |
usata |
1.1 |
|
| 37 |
|
|
keepdir $cannadir
|
| 38 |
|
|
fowners bin:bin $cannadir
|
| 39 |
|
|
fperms 0775 $cannadir
|
| 40 |
|
|
}
|
| 41 |
|
|
|
| 42 |
|
|
#
|
| 43 |
|
|
# cannadic-install() : installs dictionaries to cannadir
|
| 44 |
|
|
#
|
| 45 |
|
|
cannadic-install() {
|
| 46 |
|
|
|
| 47 |
|
|
insinto $cannadir
|
| 48 |
|
|
insopts -m0664 -o bin -g bin
|
| 49 |
|
|
doins "$@"
|
| 50 |
|
|
}
|
| 51 |
|
|
|
| 52 |
|
|
#
|
| 53 |
|
|
# dicsdir-install() : installs dics.dir from ${FILESDIR}
|
| 54 |
|
|
#
|
| 55 |
|
|
dicsdir-install() {
|
| 56 |
|
|
|
| 57 |
|
|
insinto ${dicsdir}
|
| 58 |
|
|
doins ${DICSDIRFILE}
|
| 59 |
|
|
}
|
| 60 |
|
|
|
| 61 |
|
|
#
|
| 62 |
|
|
# src_install() : installs all dictionaries under ${WORKDIR}
|
| 63 |
|
|
# plus dics.dir and docs
|
| 64 |
|
|
#
|
| 65 |
agriffis |
1.8 |
cannadic_src_install() {
|
| 66 |
usata |
1.1 |
|
| 67 |
|
|
for f in *.c[btl]d *.t ; do
|
| 68 |
|
|
cannadic-install $f
|
| 69 |
|
|
done 2>/dev/null
|
| 70 |
|
|
|
| 71 |
mr_bones_ |
1.5 |
if use canna ; then
|
| 72 |
usata |
1.1 |
dicsdir-install || die
|
| 73 |
|
|
fi
|
| 74 |
|
|
|
| 75 |
|
|
dodoc ${DOCS}
|
| 76 |
|
|
}
|
| 77 |
|
|
|
| 78 |
|
|
#
|
| 79 |
|
|
# update-cannadic-dir() : updates dics.dir for Canna Server,
|
| 80 |
|
|
# script for this part taken from Debian GNU/Linux
|
| 81 |
|
|
#
|
| 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() {
|
| 87 |
|
|
|
| 88 |
|
|
einfo
|
| 89 |
|
|
einfo "Updating dics.dir for Canna ..."
|
| 90 |
|
|
einfo
|
| 91 |
|
|
|
| 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.
|
| 96 |
|
|
EOF
|
| 97 |
|
|
|
| 98 |
|
|
for file in ${dicsdir}/*.dics.dir ; do
|
| 99 |
|
|
echo "# $file" >> ${cannadir}/dics.dir.update-new
|
| 100 |
|
|
cat $file >> ${cannadir}/dics.dir.update-new
|
| 101 |
|
|
einfo "Added $file."
|
| 102 |
|
|
done
|
| 103 |
|
|
|
| 104 |
|
|
mv ${cannadir}/dics.dir.update-new ${cannadir}/dics.dir
|
| 105 |
|
|
|
| 106 |
|
|
einfo
|
| 107 |
|
|
einfo "Done."
|
| 108 |
|
|
einfo
|
| 109 |
|
|
}
|
| 110 |
|
|
|
| 111 |
|
|
#
|
| 112 |
|
|
# pkg_postinst() : updates dics.dir and print out notice after install
|
| 113 |
|
|
#
|
| 114 |
agriffis |
1.8 |
cannadic_pkg_postinst() {
|
| 115 |
usata |
1.1 |
|
| 116 |
mr_bones_ |
1.5 |
if use canna ; then
|
| 117 |
usata |
1.1 |
update-cannadic-dir
|
| 118 |
|
|
einfo
|
| 119 |
usata |
1.4 |
einfo "Please restart cannaserver to fit the changes."
|
| 120 |
|
|
einfo "You need to modify your config file (~/.canna) to enable dictionaries."
|
| 121 |
usata |
1.1 |
|
| 122 |
|
|
if [ -n "${CANNADICS}" ] ; then
|
| 123 |
|
|
einfo "e.g) add $(for d in ${CANNADICS}; do
|
| 124 |
swegener |
1.11 |
echo -n "\"$d\" "
|
| 125 |
usata |
1.1 |
done)to section use-dictionary()."
|
| 126 |
|
|
einfo "For details, see documents under /usr/share/doc/${PF}"
|
| 127 |
|
|
fi
|
| 128 |
|
|
|
| 129 |
usata |
1.7 |
einfo "If you do not have ~/.canna, you can find sample files in /usr/share/canna."
|
| 130 |
usata |
1.4 |
ewarn "If you are upgrading from existing dictionary, you may need to recreate"
|
| 131 |
|
|
ewarn "user dictionary if you have one."
|
| 132 |
usata |
1.1 |
einfo
|
| 133 |
|
|
fi
|
| 134 |
|
|
}
|
| 135 |
|
|
|
| 136 |
|
|
#
|
| 137 |
|
|
# pkg_postrm() : updates dics.dir and print out notice after uninstall
|
| 138 |
|
|
#
|
| 139 |
agriffis |
1.8 |
cannadic_pkg_postrm() {
|
| 140 |
usata |
1.1 |
|
| 141 |
mr_bones_ |
1.5 |
if use canna ; then
|
| 142 |
usata |
1.1 |
update-cannadic-dir
|
| 143 |
|
|
einfo
|
| 144 |
|
|
einfo "Please restart cannaserver to fit changes."
|
| 145 |
|
|
einfo "and modify your config file (~/.canna) to disable dictionary."
|
| 146 |
|
|
|
| 147 |
|
|
if [ -n "${CANNADICS}" ] ; then
|
| 148 |
|
|
einfo "e.g) delete $(for d in ${CANNADICS}; do
|
| 149 |
swegener |
1.11 |
echo -n "\"$d\" "
|
| 150 |
usata |
1.1 |
done)from section use-dictionary()."
|
| 151 |
|
|
fi
|
| 152 |
|
|
|
| 153 |
|
|
einfo
|
| 154 |
|
|
fi
|
| 155 |
|
|
}
|