summaryrefslogtreecommitdiff
path: root/app-i18n/uim/uim-1.9.6-r1.ebuild
blob: 93c772c350ace8f0476149b4fabfca3fcfeb26cf (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"

inherit autotools dot-a elisp-common flag-o-matic gnome2-utils qt-utils xdg

DESCRIPTION="Multilingual input method framework"
HOMEPAGE="https://github.com/uim/uim"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.bz2"

LICENSE="BSD GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="amd64 ~arm ~hppa ppc ppc64 ~riscv x86"
IUSE="X +anthy curl eb emacs expat libffi gtk gtk2 l10n_ja l10n_ko l10n_zh-CN l10n_zh-TW libedit libnotify m17n-lib ncurses qt6 skk sqlite ssl static-libs"
RESTRICT="test"
REQUIRED_USE="
	gtk? ( X )
	gtk2? ( X )
	qt6? ( X )
"
GTK_DEPEND="
	dev-libs/glib:2
	x11-libs/cairo
	x11-libs/gdk-pixbuf:2
	x11-libs/pango
"
COMMON_DEPEND="
	virtual/libintl
	X? (
		x11-libs/libX11
		x11-libs/libXext
		x11-libs/libXft
	)
	anthy? ( app-i18n/anthy-unicode )
	curl? ( net-misc/curl )
	eb? ( dev-libs/eb )
	emacs? ( >=app-editors/emacs-23.1:* )
	expat? ( dev-libs/expat )
	gtk? (
		${GTK_DEPEND}
		x11-libs/gtk+:3[X]
	)
	gtk2? (
		${GTK_DEPEND}
		x11-libs/gtk+:2
	)
	libedit? ( dev-libs/libedit )
	libffi? ( dev-libs/libffi:= )
	libnotify? (
		dev-libs/glib:2
		x11-libs/libnotify
	)
	m17n-lib? ( dev-libs/m17n-lib )
	ncurses? ( sys-libs/ncurses:0= )
	qt6? ( dev-qt/qtbase:6[widgets,X] )
	skk? ( app-i18n/skk-jisyo )
	sqlite? ( dev-db/sqlite:3 )
	ssl? ( dev-libs/openssl:0= )
"
DEPEND="
	${COMMON_DEPEND}
	X? (
		x11-libs/libICE
		x11-libs/libSM
		x11-libs/libXrender
		x11-libs/libXt
		x11-base/xorg-proto
	)
"
RDEPEND="
	${COMMON_DEPEND}
	!dev-scheme/sigscheme
	X? (
		media-fonts/font-sony-misc
		l10n_ja? (
			|| (
				media-fonts/font-jis-misc
				media-fonts/intlfonts
			)
		)
		l10n_ko? (
			|| (
				media-fonts/font-daewoo-misc
				media-fonts/intlfonts
			)
		)
		l10n_zh-CN? (
			|| (
				media-fonts/font-isas-misc
				media-fonts/intlfonts
			)
		)
		l10n_zh-TW? ( media-fonts/intlfonts )
	)
"
BDEPEND="
	dev-util/intltool
	sys-devel/gettext
	virtual/pkgconfig
"

PATCHES=(
	"${FILESDIR}"/${PN}-zh-TW.patch

	# PR merged https://github.com/uim/uim/pull/274.patch
	"${FILESDIR}"/${P}-missing_includes.patch
	"${FILESDIR}"/${P}-skk.patch
	"${FILESDIR}"/${PN}-kde.patch
	"${FILESDIR}"/${PN}-tinfo.patch
	"${FILESDIR}"/${PN}-xkb.patch
	# PR merged https://github.com/uim/uim/pull/275.patch
	"${FILESDIR}"/${P}-pkg_config.patch
	"${FILESDIR}"/${P}-volatile.patch
)

DOCS=( AUTHORS NEWS README RELNOTE doc )

SITEFILE="50${PN}-gentoo.el"

src_prepare() {
	default
	sed -i "s:\$libedit_path/lib:/$(get_libdir):g" configure.ac || die

	# Fix build w/ Clang 16+ and >= openssl 1.1.x, tries to use
	# SSLv2_method otherwise.
	append-cppflags -DOPENSSL_NO_SSL2

	eautoreconf
}

src_configure() {
	use static-libs && lto-guarantee-fat

	# mask gosh, checked for the unavailable unit-test #884321
	export ac_cv_path_GOSH=

	# order of preference
	TOOLKIT=(
		$(usev gtk gtk3)
		$(usev qt6)
		$(usev gtk2 gtk)
	)

	local myconf=(
		$(use_with X x)
		$(use_with X xft)
		$(use_with anthy anthy-utf8)
		$(use_with curl)
		$(use_with eb)
		$(use_enable emacs)
		$(use_with emacs lispdir "${SITELISP}")
		$(use_with expat)
		$(use_with libedit)
		$(use_with libffi ffi)
		$(use_with gtk gtk3)
		$(use_with gtk2)
		$(use_with m17n-lib m17nlib)
		$(use_enable ncurses fep)
		--without-qt5
		--without-qt5-immodule
		$(use_with qt6)
		$(use_with qt6 qt6-immodule)
		$(use_with skk)
		$(use_with sqlite sqlite3)
		$(use_enable ssl openssl)
		$(use_enable static-libs static)
		--enable-nls
		--enable-default-toolkit="${TOOLKIT[0]}"
		--disable-gnome-applet
		--disable-gnome3-applet
		--disable-kde5-applet
		--without-mana
		--without-anthy
		--without-canna
		--without-prime
	)

	if (use gtk || use gtk2) && use anthy; then
		myconf+=( --enable-dict )
	else
		myconf+=( --disable-dict )
	fi

	if use qt6; then
		myconf+=( _QMAKE6=$(qt_get_broot_binary 6 qmake) )
	fi

	if use libnotify; then
		myconf+=( --enable-notify=libnotify )
	fi

	if [[ -n "${TOOLKIT[@]}" ]]; then
		myconf+=( --enable-pref )
	else
		myconf+=( --disable-pref )
	fi

	econf "${myconf[@]}"
}

src_compile() {
	default

	if use emacs; then
		pushd emacs >/dev/null || die
		elisp-compile *.el || die
		popd >/dev/null || die
	fi
}

src_install() {
	# bug #222677
	emake -j1 DESTDIR="${D}" install
	rm -f doc/Makefile*
	einstalldocs

	find "${ED}"/usr/$(get_libdir)/${PN} -name '*.la' -delete || die

	if use static-libs; then
		strip-lto-bytecode
	else
		find "${ED}" -name '*.la' -delete || die
	fi

	insinto /etc/X11/xinit/xinput.d
	sed \
		-e "s:@EPREFIX@:${EPREFIX}:g" \
		"${FILESDIR}"/xinput-${PN} > "${T}"/${PN}.conf || die
	doins "${T}"/${PN}.conf

	if use X; then
		docinto xim
		dodoc xim/README*
	fi

	if use emacs; then
		elisp-install ${PN}-el emacs/*.el{,c}
		elisp-site-file-install "${FILESDIR}"/${SITEFILE} ${PN}-el
		docinto emacs
		dodoc emacs/README*
	fi

	if use ncurses; then
		docinto fep
		dodoc fep/README*
	fi
}

pkg_postinst() {
	xdg_pkg_postinst

	elog " "
	elog "uim is defined as an input method on X into ${EROOT}/etc/X11/xinit/xinput.d/uim.conf"
	elog "However, you may need to set anyway:"
	elog "  % GTK_IM_MODULE=uim ; export GTK_IM_MODULE"
	elog "  % QT_IM_MODULE=uim ; export QT_IM_MODULE"
	elog "  % XMODIFIERS=@im=uim ; export XMODIFIERS"

	elog " "
	elog "User preferences are defined by:"
	elog "editing ~/.uim"
	if use anthy; then
		elog "  e.g. to use uim-anthy-utf8 as default input method, put"
		elog "  (define default-im-name 'anthy-utf8)"
	fi
	if [[ -n "${TOOLKIT[@]}" ]]; then
		elog "or running GUIs:"
		elog "$(printf "  %s\n" "${TOOLKIT[@]/#/uim-pref-}")"
		elog " "
		elog "Input methods are available by running:"
		elog "$(printf "  %s\n" "${TOOLKIT[@]/#/uim-im-switcher-}")"
	fi

	if use emacs; then
		elisp-site-regen
		elog " "
		elog "uim is autoloaded with Emacs with a minimal set of features:"
		elog "There is no keybinding defined to call it directly, so please"
		elog "create one yourself and choose an input method."
		elog "Integration with LEIM is not done with this ebuild, please have"
		elog "a look at the documentation how to achieve this."
	fi
	use gtk && gnome2_query_immodules_gtk3
	use gtk2 && gnome2_query_immodules_gtk2
}

pkg_postrm() {
	use emacs && elisp-site-regen
	use gtk && gnome2_query_immodules_gtk3
	use gtk2 && gnome2_query_immodules_gtk2
}