summaryrefslogtreecommitdiff
blob: 71c55dbae3fb7ec4f56f5219c1e496c09c26c052 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs

DESCRIPTION="SKK dictionary server based on cdb"
HOMEPAGE="https://github.com/jj1bdx/dbskkd-cdb"
SRC_URI="https://github.com/jj1bdx/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ppc x86"

DEPEND="
	|| (
		dev-db/tinycdb
		dev-db/cdb
	)
"

RDEPEND="
	acct-group/dbskkd
	acct-user/dbskkd
	app-i18n/skk-jisyo[cdb]
	sys-apps/xinetd
"

PATCHES=( "${FILESDIR}"/${PN}-gentoo.patch )

src_prepare() {
	default

	local cdblib=()
	if has_version dev-db/cdb; then
		append-cflags -I"${EPREFIX}"/usr/include/cdb
		local a
		for a in cdb.a alloc.a buffer.a byte.a unix.a; do
			cdblib+=( "${EPREFIX}"/usr/$(get_libdir)/${a} )
		done
	else
		cdblib+=( -lcdb )
	fi

	sed -i "/^CDBLIB/s|=.*$|= ${cdblib[*]}|" Makefile
}

src_compile() {
	emake \
		CC="$(tc-getCC)" \
		COMPAT="-DJISYO_FILE=\\\"${EPREFIX}/usr/share/skk/SKK-JISYO.L.cdb\\\""
}

src_install() {
	exeinto /usr/libexec
	doexe dbskkd-cdb
	dodoc examples.md
	einstalldocs

	insinto /etc/xinetd.d
	newins "${FILESDIR}"/dbskkd-cdb.xinetd dbskkd-cdb
}