summaryrefslogtreecommitdiff
blob: 282ea4db5d1555d7f9930d514b315c14dfce380e (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-i18n/x-unikey/x-unikey-1.0.4.ebuild,v 1.4 2007/07/22 09:48:19 calchan Exp $

inherit eutils

DESCRIPTION="Vietnamese X Input Method"
HOMEPAGE="http://unikey.sourceforge.net/linux.php"
SRC_URI="mirror://sourceforge/unikey/${P}.tar.bz2
	doc? ( http://unikey.org/manual/x-unikey-manual.html http://unikey.org/manual/x-unikey-manual.pdf )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc ~x86"
IUSE="nls gtk doc"

DEPEND="x11-libs/libX11
	x11-libs/libSM
	x11-libs/libICE
	nls? ( sys-devel/gettext )
	gtk? ( >=x11-libs/gtk+-2.2 )"

src_unpack() {
	unpack ${P}.tar.bz2 || die "unpack failed"
	if use doc; then
		cp ${DISTDIR}/x-unikey-manual.html ${DISTDIR}/x-unikey-manual.pdf ${WORKDIR}/${P}/doc
	fi
}

src_compile() {
	local myconf
	# --with-gtk-sysconfdir to prevent sandbox violation only
	use gtk && myconf="--with-unikey-gtk --with-gtk-sysconfdir=${D}/etc/gtk-2.0"
	econf ${myconf} || die "./configure failed"
	emake || die
}

src_install() {
	if use gtk;then
		dodir etc/gtk-2.0
		make DESTDIR=${D} install -C src/unikey-gtk
	fi
	dobin src/xim/ukxim src/gui/unikey
	doenvd ${FILESDIR}/01x-unikey
	dodoc doc/*
}

pkg_postinst() {
	elog ""
	elog "Go to /etc/env.d/01x-unikey and uncomment appropriate lines"
	elog "to enable x-unikey"
	elog ""
	if use gtk; then
		gtk-query-immodules-2.0 > ${ROOT}/etc/gtk-2.0/gtk.immodules
		elog "If you want to use x-unikey as the default gtk+ input method,"
		elog "change GTK_IM_MODULE in /etc/env.d/01x-unikey to \"unikey\""
		elog ""
	fi
}

pkg_postrm() {
	if use gtk; then
		gtk-query-immodules-2.0 > ${ROOT}/etc/gtk-2.0/gtk.immodules
	fi
}