summaryrefslogtreecommitdiff
blob: aafd7b642d3d0d44520bd64cd664b23637d87cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-i18n/dbskkd-cdb/dbskkd-cdb-1.71.ebuild,v 1.3 2008/04/07 19:38:39 klausman Exp $

inherit eutils multilib toolchain-funcs

MY_P="${P}dev"
DESCRIPTION="Yet another Dictionary server for the SKK Japanese-input software"
HOMEPAGE="http://www.ne.jp/asahi/bdx/info/software/jp-dbskkd.html"
SRC_URI="http://www.ne.jp/asahi/bdx/info/software/${MY_P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="alpha amd64 ~ppc ~sparc x86"
IUSE=""

DEPEND="dev-db/cdb
	|| (
		>=app-i18n/skk-jisyo-200705
		app-i18n/skk-jisyo-cdb
	)"
RDEPEND="sys-process/daemontools
	sys-apps/ucspi-tcp"
PROVIDE="virtual/skkserv"

S="${WORKDIR}/${MY_P}"

JISYO_FILE="/usr/share/skk/SKK-JISYO.L.cdb"

pkg_setup() {
	if has_version '>=app-i18n/skk-jisyo-200705' && ! built_with_use '>=app-i18n/skk-jisyo-200705' cdb ; then
		eerror "multiskkserv requires skk-jisyo to be built with cdb support. Please add"
		eerror "'cdb' to your USE flags, and re-emerge app-i18n/skk-jisyo."
		die "Missing cdb USE flag."
	fi
	# from READMEJP
	enewuser dbskkd -1 -1 -1 nofiles
	enewuser svlog -1 -1 -1 nofiles
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i \
		-e 's/IP\.ADD\.RE\.SS/127.0.0.1/' \
		-e 's:/usr/local:/usr:' \
		run.example || die
}

src_compile() {
	$(tc-getCC) ${CFLAGS} \
		-DSERVERDIR="\"/service/dbskkd-cdb/root\"" \
		-o dbskkd-cdb dbskkd-cdb.c /usr/$(get_libdir)/{cdb,unix,byte}.a || die
}

src_install() {
	exeinto /usr/libexec; doexe dbskkd-cdb || die
	dodoc CHANGES READMEJP

	exeinto /var/dbskkd-cdb/service; newexe run.example run || die
	exeinto /var/dbskkd-cdb/service/log; newexe run.log.example run || die
	keepdir /var/dbskkd-cdb/service/log/main
	insinto /var/dbskkd-cdb/service/root; doins "${JISYO_FILE}"
	fperms +t /var/dbskkd-cdb/service
	fowners -R svlog:nofiles /var/dbskkd-cdb/service/log
}

pkg_postinst() {
	elog "To start dbskkd-cdb at boot you have to enable the /etc/init.d/svscan"
	elog "rc file and create the following link:"
	elog
	elog "# ln -sf /var/dbskkd-cdb/service /service/dbskkd-cdb"
	elog
}