summaryrefslogtreecommitdiff
blob: aa86f7b65fdca55ec0ffaed95f8a2ea4d4482980 (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
75
76
77
78
79
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

inherit toolchain-funcs systemd

DESCRIPTION="Yet Another SKK server"
HOMEPAGE="http://umiushi.org/~wac/yaskkserv/"
SRC_URI="http://umiushi.org/~wac/${PN}/${P}.tar.xz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="gnutls libressl systemd"

RDEPEND="app-i18n/skk-jisyo
	gnutls? ( net-libs/gnutls:= )
	!gnutls? (
		!libressl? ( dev-libs/openssl:0= )
		libressl? ( dev-libs/libressl:0= )
	)
	systemd? ( virtual/udev[systemd] )"
DEPEND="${RDEPEND}
	dev-lang/perl"

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

src_configure() {
	econf \
		$(use_enable gnutls) \
		$(use_enable systemd) \
		--compiler="${tc-getCXX}"
}

src_install() {
	emake DESTDIR="${D}" install_all
	einstalldocs

	newinitd "${FILESDIR}"/${PN}.initd ${PN}
	newconfd "${FILESDIR}"/${PN}.confd ${PN}

	systemd_dounit examples/${PN}.socket
	systemd_dounit "${FILESDIR}"/${PN}.service
}

yaskkserv_update() {
	local f
	for f in "${ROOT}"/usr/share/skk/SKK-JISYO.*; do
		case ${f} in
		*.cdb)
			;;
		*.${PN})
			[[ -f ${f%.*} ]] || rm -f "${f}"
			;;
		*)
			[[ ${f} -nt ${f}.${PN} ]] && ${PN}_make_dictionary "${f}" "${f}.${PN}"
			;;
		esac
	done
}

pkg_postinst() {
	yaskkserv_update

	elog "You need to run:"
	elog "  emerge --config =${CATEGORY}/${PF}"
	elog "after updating app-i18n/skk-jisyo from next time."
}

pkg_postrm() {
	rm -f "${ROOT}"/usr/share/skk/SKK-JISYO.*.${PN}
	rmdir "${ROOT}"/usr/share/skk 2>/dev/null
}

pkg_config() {
	yaskkserv_update
}