ibus: update to 1.5.30.

This commit is contained in:
oreo639 2024-01-25 13:21:25 -08:00 committed by oreo639
parent 46bf254316
commit 487435bb73
6 changed files with 12 additions and 831 deletions

View File

@ -1,324 +0,0 @@
From 497f0c74230a65309e22ce5569060ce48310406b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 23 Mar 2023 13:07:30 +0900
Subject: [PATCH] client/x11: Fix Key typing order
ibus-x11 now also uses the hybrid process key events with
IBUS_ENABLE_SYNC_MODE=2 and it waits for the async API
with GSource and g_main_context_iteration() in xim_forward_event().
But g_main_context_iteration() calls gdk_event_source_dispatch()
and it can call another xim_forward_event() and the callbacks
of ibus_input_context_process_key_event_async() can be nested.
So if the forwarding API is called out of the callbacks of
ibus_input_context_process_key_event_async(), the key events
order is swapped due to the delayed return of
g_main_context_iteration().
To resolve this issue, the forwarding API should be called in
the callbacks of ibus_input_context_process_key_event_async().
Fixes: https://github.com/ibus/ibus/commit/506ac99
BUG=https://github.com/ibus/ibus/issues/2480
---
client/x11/main.c | 160 ++++++++++++++++++++++++----------------------
1 file changed, 83 insertions(+), 77 deletions(-)
diff --git a/client/x11/main.c b/client/x11/main.c
index 905fd2516..83d95cb75 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -2,7 +2,7 @@
/* vim:set et sts=4: */
/* ibus
* Copyright (C) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2015-2022 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2015-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2007-2015 Red Hat, Inc.
*
* main.c:
@@ -49,6 +49,8 @@
#include <getopt.h>
#define ESC_SEQUENCE_ISO10646_1 "\033%G"
+/* Wait for about 120 secs to return a key from async process-key-event. */
+#define MAX_WAIT_KEY_TIME 120000
#define LOG(level, fmt_args...) \
if (g_debug_level >= (level)) { \
@@ -461,11 +463,39 @@ xim_unset_ic_focus (XIMS xims, IMChangeFocusStruct *call_data)
}
+static void
+_xim_forward_key_event_done (X11IC *x11ic,
+ XEvent *event,
+ gboolean processed)
+{
+ IMForwardEventStruct fe;
+ if (processed) {
+ if (!x11ic->has_preedit_area) {
+ _xim_set_cursor_location (x11ic);
+ }
+ return;
+ }
+ g_assert (x11ic);
+ g_assert (event);
+
+ memset (&fe, 0, sizeof (fe));
+ fe.major_code = XIM_FORWARD_EVENT;
+ fe.icid = x11ic->icid;
+ fe.connect_id = x11ic->connect_id;
+ fe.sync_bit = 0;
+ fe.serial_number = 0L;
+ fe.event = *event;
+ IMForwardEvent (_xims, (XPointer) &fe);
+}
+
+
typedef struct {
- IMForwardEventStruct *pfe;
int count;
guint count_cb_id;
gboolean retval;
+ X11IC *x11ic;
+ CARD16 connect_id;
+ XEvent event;
} ProcessKeyEventReplyData;
static void
@@ -474,7 +504,7 @@ _process_key_event_done (GObject *object,
gpointer user_data)
{
IBusInputContext *context = (IBusInputContext *)object;
- IMForwardEventStruct *pfe = (IMForwardEventStruct*) user_data;
+ ProcessKeyEventReplyData *data = (ProcessKeyEventReplyData *)user_data;
GError *error = NULL;
gboolean retval = ibus_input_context_process_key_event_async_finish (
@@ -488,16 +518,15 @@ _process_key_event_done (GObject *object,
}
if (g_hash_table_lookup (_connections,
- GINT_TO_POINTER ((gint) pfe->connect_id))
+ GINT_TO_POINTER ((gint)data->connect_id))
== NULL) {
- g_slice_free (IMForwardEventStruct, pfe);
+ g_slice_free (ProcessKeyEventReplyData, data);
return;
}
- if (retval == FALSE) {
- IMForwardEvent (_xims, (XPointer) pfe);
- }
- g_slice_free (IMForwardEventStruct, pfe);
+ if (retval == FALSE)
+ _xim_forward_key_event_done (data->x11ic, &data->event, retval);
+ g_slice_free (ProcessKeyEventReplyData, data);
}
static void
@@ -518,6 +547,21 @@ _process_key_event_reply_done (GObject *object,
}
g_return_if_fail (data);
data->retval = retval;
+ if (g_hash_table_lookup (_connections,
+ GINT_TO_POINTER ((gint)data->connect_id))
+ == NULL) {
+ return;
+ }
+ /* _xim_forward_key_event_done() should be called in
+ * _process_key_event_reply_done() because g_main_context_iteration()
+ * can call another xim_forward_event() and xim_forward_event() can be
+ * nested and the first _process_key_event_reply_done() is returned
+ * at last with g_main_context_iteration() so
+ * if _xim_forward_key_event_done() is called out of
+ * _process_key_event_reply_done(), the key events order
+ * can be swapped.
+ */
+ _xim_forward_key_event_done (data->x11ic, &data->event, retval);
data->count = 0;
g_source_remove (data->count_cb_id);
}
@@ -529,9 +573,8 @@ _process_key_event_count_cb (gpointer user_data)
g_return_val_if_fail (data, G_SOURCE_REMOVE);
if (!data->count)
return G_SOURCE_REMOVE;
- /* Wait for about 10 secs. */
- if (data->count++ == 10000) {
- data->count = 0;
+ if (data->count++ == MAX_WAIT_KEY_TIME) {
+ g_warning ("Key event is not returned for %usecs.", MAX_WAIT_KEY_TIME);
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
@@ -571,32 +614,13 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
event.keyval,
event.hardware_keycode - 8,
event.state);
- if (retval) {
- if (!x11ic->has_preedit_area) {
- _xim_set_cursor_location (x11ic);
- }
- return 1;
- }
-
- IMForwardEventStruct fe;
- memset (&fe, 0, sizeof (fe));
-
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = call_data->event;
-
- IMForwardEvent (_xims, (XPointer) &fe);
-
+ _xim_forward_key_event_done (x11ic, &call_data->event, retval);
retval = 1;
break;
}
case 2: {
GSource *source = g_timeout_source_new (1);
ProcessKeyEventReplyData *data = NULL;
- IMForwardEventStruct fe;
if (source)
data = g_slice_new0 (ProcessKeyEventReplyData);
@@ -610,11 +634,13 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
if (source)
g_source_destroy (source);
} else {
- CARD16 connect_id = x11ic->connect_id;
data->count = 1;
g_source_attach (source, NULL);
g_source_unref (source);
data->count_cb_id = g_source_get_id (source);
+ data->connect_id = call_data->connect_id;
+ data->x11ic = x11ic;
+ data->event = *((XEvent*)xevent);
ibus_input_context_process_key_event_async (
x11ic->context,
event.keyval,
@@ -626,7 +652,7 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
data);
g_source_set_callback (source, _process_key_event_count_cb,
data, NULL);
- while (data->count)
+ while (data->count > 0 && data->count < MAX_WAIT_KEY_TIME)
g_main_context_iteration (NULL, TRUE);
if (source->ref_count > 0) {
/* g_source_get_id() could causes a SEGV */
@@ -634,46 +660,33 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
"issue in %p.", source);
}
retval = data->retval;
- g_slice_free (ProcessKeyEventReplyData, data);
-
- if (g_hash_table_lookup (_connections,
- GINT_TO_POINTER ((gint)connect_id))
- == NULL) {
+ if (data->count == 0) {
+ g_slice_free (ProcessKeyEventReplyData, data);
return 1;
}
}
- if (retval) {
- if (! x11ic->has_preedit_area) {
- _xim_set_cursor_location (x11ic);
- }
- return 1;
+ g_slice_free (ProcessKeyEventReplyData, data);
+ if (g_hash_table_lookup (_connections,
+ GINT_TO_POINTER ((gint)call_data->connect_id))
+ == NULL) {
+ return 1;
}
-
- memset (&fe, 0, sizeof (fe));
-
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = call_data->event;
-
- IMForwardEvent (_xims, (XPointer) &fe);
-
+ _xim_forward_key_event_done (x11ic, &call_data->event, retval);
retval = 1;
break;
}
default: {
- IMForwardEventStruct *pfe;
+ ProcessKeyEventReplyData *data;
- pfe = g_slice_new0 (IMForwardEventStruct);
- pfe->major_code = XIM_FORWARD_EVENT;
- pfe->icid = x11ic->icid;
- pfe->connect_id = x11ic->connect_id;
- pfe->sync_bit = 0;
- pfe->serial_number = 0L;
- pfe->event = call_data->event;
+ if (!(data = g_slice_new0 (ProcessKeyEventReplyData))) {
+ g_warning ("Cannot allocate async data");
+ _xim_forward_key_event_done (x11ic, &call_data->event, 0);
+ return 1;
+ }
+ data->connect_id = call_data->connect_id;
+ data->x11ic = x11ic;
+ data->event = call_data->event;
ibus_input_context_process_key_event_async (
x11ic->context,
@@ -683,7 +696,7 @@ xim_forward_event (XIMS xims, IMForwardEventStruct *call_data)
-1,
NULL,
_process_key_event_done,
- pfe);
+ data);
retval = 1;
}
}
@@ -962,11 +975,10 @@ _xim_forward_key_event (X11IC *x11ic,
guint keycode,
guint state)
{
- g_return_if_fail (x11ic != NULL);
-
- IMForwardEventStruct fe = {0};
XEvent xkp = {0};
+ g_return_if_fail (x11ic != NULL);
+
xkp.xkey.type = (state & IBUS_RELEASE_MASK) ? KeyRelease : KeyPress;
xkp.xkey.serial = 0L;
xkp.xkey.send_event = False;
@@ -975,20 +987,14 @@ _xim_forward_key_event (X11IC *x11ic,
xkp.xkey.window =
x11ic->focus_window ? x11ic->focus_window : x11ic->client_window;
xkp.xkey.subwindow = None;
- xkp.xkey.root = DefaultRootWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ xkp.xkey.root = DefaultRootWindow (
+ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
xkp.xkey.time = 0;
xkp.xkey.state = state;
xkp.xkey.keycode = (keycode == 0) ? 0 : keycode + 8;
- fe.major_code = XIM_FORWARD_EVENT;
- fe.icid = x11ic->icid;
- fe.connect_id = x11ic->connect_id;
- fe.sync_bit = 0;
- fe.serial_number = 0L;
- fe.event = xkp;
-
- IMForwardEvent (_xims, (XPointer) & fe);
+ _xim_forward_key_event_done (x11ic, &xkp, FALSE);
}
static void

View File

@ -1,34 +0,0 @@
From 7c8abbe89403c2fcb08e3fda42049a97187e53ab Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 28 Feb 2023 17:46:10 +0900
Subject: [PATCH] src: Call IBUS_TYPE_EMOJI_DATA in ibus_init()
Seems the evaluation of IBUS_EMOJI_DATA() depends on the compiler
optimization.
BUG=https://github.com/ibus/ibus/issues/2476
---
src/ibusshare.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 340168c84..bb59f3cbf 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -308,12 +308,15 @@ ibus_init (void)
IBUS_TYPE_TEXT;
IBUS_TYPE_ATTRIBUTE;
IBUS_TYPE_ATTR_LIST;
- IBUS_TYPE_LOOKUP_TABLE;
IBUS_TYPE_COMPONENT;
+ IBUS_TYPE_EMOJI_DATA;
IBUS_TYPE_ENGINE_DESC;
+ IBUS_TYPE_LOOKUP_TABLE;
IBUS_TYPE_OBSERVED_PATH;
IBUS_TYPE_REGISTRY;
IBUS_TYPE_X_EVENT;
+ IBUS_TYPE_UNICODE_BLOCK;
+ IBUS_TYPE_UNICODE_DATA;
_ibus_register_resource ();
}

View File

@ -1,46 +0,0 @@
From 8f706d160631f1ffdbfa16543a38b9d5f91c16ad Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 23 Mar 2023 13:07:38 +0900
Subject: [PATCH] util/IMdkit: Disable while loop before call
ForwardEventMessageProc()
Seems ProcessQueue() had a wrong XFree() with async process-key-event.
Fixes: https://github.com/ibus/ibus/commit/506ac99
BUG=https://github.com/ibus/ibus/issues/2484
---
util/IMdkit/i18nPtHdr.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/util/IMdkit/i18nPtHdr.c b/util/IMdkit/i18nPtHdr.c
index 8dc52714d..ec20e3228 100644
--- a/util/IMdkit/i18nPtHdr.c
+++ b/util/IMdkit/i18nPtHdr.c
@@ -1747,11 +1747,13 @@ static void ProcessQueue (XIMS ims, CARD16 connect_id)
XimProtoHdr *hdr = (XimProtoHdr *) client->pending->p;
unsigned char *p1 = (unsigned char *) (hdr + 1);
IMProtocol call_data;
+ XIMPending *old = client->pending;
call_data.major_code = hdr->major_opcode;
call_data.any.minor_code = hdr->minor_opcode;
call_data.any.connect_id = connect_id;
+ client->pending = old->next;
switch (hdr->major_opcode)
{
case XIM_FORWARD_EVENT:
@@ -1760,12 +1762,7 @@ static void ProcessQueue (XIMS ims, CARD16 connect_id)
}
/*endswitch*/
XFree (hdr);
- {
- XIMPending *old = client->pending;
-
- client->pending = old->next;
- XFree (old);
- }
+ XFree (old);
}
/*endwhile*/
return;

View File

@ -1,28 +0,0 @@
From a4007f7d0bdfb98457487c85304188c411e6d991 Mon Sep 17 00:00:00 2001
From: Sibo Dong <46512211+dongsibo@users.noreply.github.com>
Date: Thu, 23 Mar 2023 13:08:12 +0900
Subject: [PATCH] ui/gtk3: Update Emoji shortcut key in ibus-emoji(7)
The default Emoji shortcut key was changed but not updated in the
ibus-emoji.7 man page.
Fixes: https://github.com/ibus/ibus/commit/1520c39
BUG=https://github.com/ibus/ibus/pull/2475
---
ui/gtk3/ibus-emoji.7.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/gtk3/ibus-emoji.7.in b/ui/gtk3/ibus-emoji.7.in
index b4d941eca..31074300b 100644
--- a/ui/gtk3/ibus-emoji.7.in
+++ b/ui/gtk3/ibus-emoji.7.in
@@ -51,7 +51,7 @@ E.g. "Noto Color Emoji", "Android Emoji" font.
.SH "KEYBOARD OPERATIONS"
.TP
-\fBControl-Period or Control-Semicolon\fR
+\fBSuper-Period\fR
Launch IBus Emojier. The shortcut key can be customized by
.B ibus\-setup (1).
.TP

View File

@ -1,388 +0,0 @@
diff --git a/configure.ac b/configure.ac
index cba242df..f442bac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,6 +130,7 @@ AC_PROG_CC_STDC
AM_PROG_VALAC([0.20])
AC_PROG_INSTALL
AC_PROG_MAKE_SET
+AX_PROG_CC_FOR_BUILD
# i18n stuff
AM_GNU_GETTEXT_VERSION([0.19.8])
@@ -151,10 +152,13 @@ AC_CHECK_FUNCS(daemon)
AC_CHECK_LIB(c, dlclose, LIBDL="", [AC_CHECK_LIB(dl, dlclose, LIBDL="-ldl")])
AC_SUBST(LIBDL)
+# Check if cross compiling.
+AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
+
# Check endianness.
AC_MSG_CHECKING([build system endianness])
ENDIAN=unknown
-AC_RUN_IFELSE(
+AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <endian.h>
@@ -165,7 +169,7 @@ AC_RUN_IFELSE(
)],
[ENDIAN=little]
)
-AC_RUN_IFELSE(
+AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <endian.h>
@@ -207,6 +211,14 @@ AH_BOTTOM([
#endif
])
+if test "x$cross_compiling" = "xyes"; then
+PKG_PROG_PKG_CONFIG_FOR_BUILD
+GLIB_CFLAGS_FOR_BUILD=`$PKG_CONFIG_FOR_BUILD --cflags glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 gthread-2.0`
+GLIB_LIBS_FOR_BUILD=`$PKG_CONFIG_FOR_BUILD --libs glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 gthread-2.0`
+AC_SUBST(GLIB_CFLAGS_FOR_BUILD)
+AC_SUBST(GLIB_LIBS_FOR_BUILD)
+fi
+
# --disable-tests option.
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--disable-tests],
diff --git a/m4/Makefile.am b/m4/Makefile.am
index dcf84ac3..dcaaa350 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -22,7 +22,9 @@
EXTRA_DIST = \
as-version.m4 \
+ ax_prog_cc_for_build.m4 \
ibuslocale.m4 \
+ pkg_config_for_build.m4 \
vapigen.m4 \
$(NULL)
diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
new file mode 100644
index 00000000..1db8d73f
--- /dev/null
+++ b/m4/ax_prog_cc_for_build.m4
@@ -0,0 +1,155 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PROG_CC_FOR_BUILD
+#
+# DESCRIPTION
+#
+# This macro searches for a C compiler that generates native executables,
+# that is a C compiler that surely is not a cross-compiler. This can be
+# useful if you have to generate source code at compile-time like for
+# example GCC does.
+#
+# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
+# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
+# The value of these variables can be overridden by the user by specifying
+# a compiler with an environment variable (like you do for standard CC).
+#
+# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
+# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
+# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
+# substituted in the Makefile.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 21
+
+AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
+AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+
+dnl Use the standard macros, but make them use other variable names
+dnl
+pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
+pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
+pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
+pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
+pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
+pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
+pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
+pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
+pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
+pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
+pushdef([ac_cv_objext], ac_cv_build_objext)dnl
+pushdef([ac_exeext], ac_build_exeext)dnl
+pushdef([ac_objext], ac_build_objext)dnl
+pushdef([CC], CC_FOR_BUILD)dnl
+pushdef([CPP], CPP_FOR_BUILD)dnl
+pushdef([GCC], GCC_FOR_BUILD)dnl
+pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
+pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
+pushdef([EXEEXT], BUILD_EXEEXT)dnl
+pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
+pushdef([OBJEXT], BUILD_OBJEXT)dnl
+pushdef([host], build)dnl
+pushdef([host_alias], build_alias)dnl
+pushdef([host_cpu], build_cpu)dnl
+pushdef([host_vendor], build_vendor)dnl
+pushdef([host_os], build_os)dnl
+pushdef([ac_cv_host], ac_cv_build)dnl
+pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
+pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
+pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
+pushdef([ac_cv_host_os], ac_cv_build_os)dnl
+pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
+pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
+pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
+pushdef([cross_compiling], cross_compiling_build)dnl
+
+cross_compiling_build=no
+
+ac_build_tool_prefix=
+AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"],
+ [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
+
+AC_LANG_PUSH([C])
+
+dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover
+dnl the use of this variable in _AC_LANG_COMPILER_GNU called by
+dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround.
+was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y}
+AS_IF([test ${was_set_c_compiler_gnu}],
+ [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu]
+ AS_UNSET([[ac_cv_c_compiler_gnu]])])
+
+AC_PROG_CC
+
+dnl Restore ac_cv_c_compiler_gnu
+AS_IF([test ${was_set_c_compiler_gnu}],
+ [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]])
+
+_AC_COMPILER_EXEEXT
+_AC_COMPILER_OBJEXT
+AC_PROG_CPP
+
+dnl Restore the old definitions
+dnl
+popdef([cross_compiling])dnl
+popdef([am_cv_prog_cc_c_o])dnl
+popdef([am_cv_CC_dependencies_compiler_type])dnl
+popdef([ac_tool_prefix])dnl
+popdef([ac_cv_host_os])dnl
+popdef([ac_cv_host_vendor])dnl
+popdef([ac_cv_host_cpu])dnl
+popdef([ac_cv_host_alias])dnl
+popdef([ac_cv_host])dnl
+popdef([host_os])dnl
+popdef([host_vendor])dnl
+popdef([host_cpu])dnl
+popdef([host_alias])dnl
+popdef([host])dnl
+popdef([OBJEXT])dnl
+popdef([LDFLAGS])dnl
+popdef([EXEEXT])dnl
+popdef([CPPFLAGS])dnl
+popdef([CFLAGS])dnl
+popdef([GCC])dnl
+popdef([CPP])dnl
+popdef([CC])dnl
+popdef([ac_objext])dnl
+popdef([ac_exeext])dnl
+popdef([ac_cv_objext])dnl
+popdef([ac_cv_exeext])dnl
+popdef([ac_cv_c_compiler_gnu])dnl
+popdef([ac_cv_prog_cc_g])dnl
+popdef([ac_cv_prog_cc_cross])dnl
+popdef([ac_cv_prog_cc_works])dnl
+popdef([ac_cv_prog_cc_c89])dnl
+popdef([ac_cv_prog_gcc])dnl
+popdef([ac_cv_prog_CPP])dnl
+
+dnl restore global variables ac_ext, ac_cpp, ac_compile,
+dnl ac_link, ac_compiler_gnu (dependant on the current
+dnl language after popping):
+AC_LANG_POP([C])
+
+dnl Finally, set Makefile variables
+dnl
+AC_SUBST(BUILD_EXEEXT)dnl
+AC_SUBST(BUILD_OBJEXT)dnl
+AC_SUBST([CFLAGS_FOR_BUILD])dnl
+AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
+AC_SUBST([LDFLAGS_FOR_BUILD])dnl
+])
diff --git a/m4/pkg_config_for_build.m4 b/m4/pkg_config_for_build.m4
new file mode 100644
index 00000000..0422f482
--- /dev/null
+++ b/m4/pkg_config_for_build.m4
@@ -0,0 +1,20 @@
+# PKG_PROG_PKG_CONFIG_FOR_BUILD([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG_FOR_BUILD],
+[m4_pattern_allow([^PKG_CONFIG_FOR_BUILD$])
+AC_ARG_VAR([PKG_CONFIG_FOR_BUILD], [path to build system's pkg-config utility])
+
+if test "x$ac_cv_env_PKG_CONFIG_FOR_BUILD_set" != "xset"; then
+ AC_PATH_PROG([PKG_CONFIG_FOR_BUILD], [pkg-config])
+fi
+if test -n "$PKG_CONFIG_FOR_BUILD"; then
+ _pkg_for_build_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([build system's pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG_FOR_BUILD --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG_FOR_BUILD=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG_FOR_BUILD
diff --git a/src/Makefile.am b/src/Makefile.am
index 426376dd..50cf746f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,9 +46,6 @@ noinst_PROGRAMS = gen-internal-compose-table
# C preprocessor flags
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"IBUS\" \
- @GLIB2_CFLAGS@ \
- @GOBJECT2_CFLAGS@ \
- @GIO2_CFLAGS@ \
-DIBUS_CACHE_DIR=\""$(localstatedir)/cache/ibus"\" \
-DIBUS_DATA_DIR=\"$(pkgdatadir)\" \
-DIBUS_DISABLE_DEPRECATION_WARNINGS \
@@ -65,6 +62,11 @@ libibus_1_0_la_LIBADD = \
@GOBJECT2_LIBS@ \
@GIO2_LIBS@ \
$(NULL)
+libibus_1_0_la_CFLAGS = \
+ @GLIB2_CFLAGS@ \
+ @GOBJECT2_CFLAGS@ \
+ @GIO2_CFLAGS@ \
+ $(NULL)
libibus_1_0_la_LDFLAGS = \
-no-undefined \
-export-symbols-regex "ibus_.*" \
@@ -107,7 +109,7 @@ ibus_sources = \
ibusxevent.c \
ibusxml.c \
$(NULL)
-libibus_1_0_la_SOURCES = \
+libibus_sources = \
ibuscomposetable.c \
ibusenumtypes.c \
ibusmarshalers.c \
@@ -166,6 +168,7 @@ ibus_headers = \
ibusxevent.h \
ibusxml.h \
$(NULL)
+libibus_1_0_la_SOURCES = $(libibus_sources)
ibusincludedir = $(includedir)/ibus-@IBUS_API_VERSION@
ibus_public_headers = \
$(ibus_headers) \
@@ -188,6 +191,35 @@ noinst_HEADERS = \
$(ibus_private_headers) \
$(NULL)
+if CROSS_COMPILING
+# Avoid libtool when building native libraries
+libnativeibus =
+parser_extra_sources = $(libibus_sources)
+
+glib_cflags = @GLIB_CFLAGS_FOR_BUILD@
+glib_libs = @GLIB_LIBS_FOR_BUILD@
+
+$(noinst_PROGRAMS): CC=$(CC_FOR_BUILD)
+$(noinst_PROGRAMS): CCLD=$(CC_FOR_BUILD)
+$(noinst_PROGRAMS): CFLAGS=$(CFLAGS_FOR_BUILD)
+$(noinst_PROGRAMS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+$(noinst_PROGRAMS): LDFLAGS=$(LDFLAGS_FOR_BUILD)
+else
+libnativeibus = $(libibus)
+parser_extra_sources =
+
+glib_libs = \
+ @GLIB2_LIBS@ \
+ @GOBJECT2_LIBS@ \
+ @GIO2_LIBS@ \
+ $(NULL)
+glib_cflags = \
+ @GLIB2_CFLAGS@ \
+ @GOBJECT2_CFLAGS@ \
+ @GIO2_CFLAGS@ \
+ $(NULL)
+endif
+
gen_internal_compose_table_SOURCES = \
gencomposetable.c \
ibuscomposetable.c \
@@ -195,11 +227,12 @@ gen_internal_compose_table_SOURCES = \
ibuskeynames.c \
ibuskeyuni.c \
$(NULL)
-gen_internal_compose_table_CFLAGS = $(AM_CFLAGS)
+gen_internal_compose_table_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(glib_cflags) \
+ $(NULL)
gen_internal_compose_table_LDADD = \
- @GLIB2_LIBS@ \
- @GOBJECT2_LIBS@ \
- @GIO2_LIBS@ \
+ $(glib_libs) \
$(NULL)
BUILT_SOURCES = \
@@ -362,15 +395,15 @@ install-data-hook:
emoji_parser_SOURCES = \
emoji-parser.c \
+ $(parser_extra_sources) \
$(NULL)
emoji_parser_CFLAGS = \
- $(GLIB2_CFLAGS) \
- $(GOBJECT2_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(glib_cflags) \
$(NULL)
emoji_parser_LDADD = \
- $(libibus) \
- $(GLIB2_LIBS) \
- $(GOBJECT2_LIBS) \
+ $(libnativeibus) \
+ $(glib_libs) \
$(NULL)
endif
@@ -407,13 +440,15 @@ ibusunicodegen.h:
unicode_parser_SOURCES = \
unicode-parser.c \
+ $(parser_extra_sources) \
$(NULL)
unicode_parser_CFLAGS = \
- $(GLIB2_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(glib_cflags) \
$(NULL)
unicode_parser_LDADD = \
- $(GLIB2_LIBS) \
- $(libibus) \
+ $(glib_libs) \
+ $(libnativeibus) \
$(NULL)
endif

View File

@ -1,7 +1,7 @@
# Template file for 'ibus'
pkgname=ibus
version=1.5.28
revision=4
version=1.5.30
revision=1
build_style=gnu-configure
build_helper="gir"
configure_args="--enable-ui --enable-gtk3 --enable-gtk4
@ -15,7 +15,7 @@ hostmakedepends="pkg-config libtool gettext-devel
$(vopt_if dicts 'cldr-emoji-annotation unicode-character-database unicode-emoji')"
makedepends="dconf-devel gtk+-devel gtk+3-devel gtk4-devel hicolor-icon-theme
iso-codes json-glib-devel libnotify-devel librsvg-devel python3-xdg
vala libXtst-devel"
vala libXtst-devel libdbusmenu-gtk3-devel"
depends="hicolor-icon-theme iso-codes setxkbmap dconf python3-xdg
dbus-x11 ibus-gtk+3 $(vopt_if ibus_setup 'python3-gobject>=3.12.1_3')"
short_desc="Intelligent Input Bus"
@ -23,18 +23,19 @@ maintainer="oreo639 <oreo6391@gmail.com>"
license="LGPL-2.1-or-later"
homepage="https://github.com/ibus/ibus"
distfiles="https://github.com/ibus/ibus/releases/download/${version}/ibus-${version}.tar.gz"
checksum=6c9ff3a7576c3d61264f386030f47ee467eb7298c8104367002986e008765667
checksum=05b84d4a45139face161596e5ade8e6c5da55cfaf6f194861da66516190f5b96
build_options="ibus_setup dicts"
desc_option_ibus_setup="Enable support for building the ibus setup UI"
build_options_default="ibus_setup dicts"
pre_build() {
export GIR_EXTRA_LIBS_PATH="${wrksrc}/src/.libs"
post_configure() {
# Force re-generate valac files for gcc 14
make -C ui/gtk3 maintainer-clean-generic
}
pre_configure() {
autoreconf -fi
pre_build() {
export GIR_EXTRA_LIBS_PATH="${wrksrc}/src/.libs"
}
post_install() {
@ -42,21 +43,21 @@ post_install() {
}
ibus-gtk+_package() {
short_desc+=" - GTK+ IME"
short_desc+=" - GTK+ IME plugin (X11)"
pkg_install() {
vmove usr/lib/gtk-2.0
}
}
ibus-gtk+3_package() {
short_desc+=" - GTK+3 IME"
short_desc+=" - GTK+3 IME plugin (X11)"
pkg_install() {
vmove usr/lib/gtk-3.0
}
}
ibus-gtk4_package() {
short_desc+=" - GTK4 IME"
short_desc+=" - GTK4 IME plugin (X11)"
pkg_install() {
vmove usr/lib/gtk-4.0
}