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