Fix alive ibus-x11 with Xephyr -query

- Delete upstreamed ibus-xx-cross-compile.patch
- Fix missing ibusenumtypes.h with parallel build
- Fix to build libibus-1.0.la twice
This commit is contained in:
Takao Fujiwara 2023-07-05 20:54:42 +09:00
parent 2438880ffc
commit 4d8deb73d3
3 changed files with 850 additions and 401 deletions

View File

@ -1493,3 +1493,846 @@ index fc486692..c807c751 100644
-- --
2.40.0 2.40.0
From f0492c86f7c42d35bedff1a1910075617243d1f0 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Sun, 18 Jun 2023 10:59:35 +0900
Subject: [PATCH] m4: Update m4 files
- Revert .gitignore because m4 files cannot be added
- Delete as-version.m4 which has been unused since 2010
- Update the latest introspection.m4
- Update the latest vapigen.m4
Fixes: https://github.com/ibus/ibus/commit/d23bbdd
Fixes: https://github.com/ibus/ibus/commit/3b3f56d
BUG=https://github.com/ibus/ibus/pull/2527
---
m4/Makefile.am | 1 -
m4/as-version.m4 | 71 ---------------------------------------------
m4/introspection.m4 | 60 ++++++++++++++++++++++++++++++++++----
m4/vapigen.m4 | 19 +++++++-----
5 files changed, 66 insertions(+), 86 deletions(-)
delete mode 100644 m4/as-version.m4
diff --git a/m4/Makefile.am b/m4/Makefile.am
index dcf84ac3..49ecbb89 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -21,7 +21,6 @@
# USA
EXTRA_DIST = \
- as-version.m4 \
ibuslocale.m4 \
vapigen.m4 \
$(NULL)
diff --git a/m4/as-version.m4 b/m4/as-version.m4
deleted file mode 100644
index a5b43990..00000000
--- a/m4/as-version.m4
+++ /dev/null
@@ -1,71 +0,0 @@
-dnl as-version.m4 0.2.0
-
-dnl autostars m4 macro for versioning
-
-dnl Thomas Vander Stichele <thomas at apestaart dot org>
-
-dnl $Id: as-version.m4,v 1.4 2004/06/01 09:40:05 thomasvs Exp $
-
-dnl AS_VERSION
-
-dnl example
-dnl AS_VERSION
-
-dnl this macro
-dnl - AC_SUBST's PACKAGE_VERSION_MAJOR, _MINOR, _MICRO
-dnl - AC_SUBST's PACKAGE_VERSION_RELEASE,
-dnl which can be used for rpm release fields
-dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
-dnl maintainer mode from running correctly
-dnl
-dnl don't forget to put #undef PACKAGE_VERSION_RELEASE in acconfig.h
-dnl if you use acconfig.h
-
-AC_DEFUN([AS_VERSION],
-[
- PACKAGE_VERSION_MAJOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f1)
- PACKAGE_VERSION_MINOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f2)
- PACKAGE_VERSION_MICRO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f3)
-
- AC_SUBST(PACKAGE_VERSION_MAJOR)
- AC_SUBST(PACKAGE_VERSION_MINOR)
- AC_SUBST(PACKAGE_VERSION_MICRO)
-])
-
-dnl AS_NANO(ACTION-IF-NO-NANO, [ACTION-IF-NANO])
-
-dnl requires AC_INIT to be called before
-dnl For projects using a fourth or nano number in your versioning to indicate
-dnl development or prerelease snapshots, this macro allows the build to be
-dnl set up differently accordingly.
-
-dnl this macro:
-dnl - parses AC_PACKAGE_VERSION, set by AC_INIT, and extracts the nano number
-dnl - sets the variable PACKAGE_VERSION_NANO
-dnl - sets the variable PACKAGE_VERSION_RELEASE, which can be used
-dnl for rpm release fields
-dnl - executes ACTION-IF-NO-NANO or ACTION-IF-NANO
-
-dnl example:
-dnl AS_NANO(RELEASE="yes", RELEASE="no")
-
-AC_DEFUN([AS_NANO],
-[
- AC_MSG_CHECKING(nano version)
-
- NANO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f4)
-
- if test x"$NANO" = x || test "x$NANO" = "x0" ; then
- AC_MSG_RESULT([0 (release)])
- NANO=0
- PACKAGE_VERSION_RELEASE=1
- ifelse([$1], , :, [$1])
- else
- AC_MSG_RESULT($NANO)
- PACKAGE_VERSION_RELEASE=0.`date +%Y%m%d.%H%M%S`
- ifelse([$2], , :, [$2])
- fi
- PACKAGE_VERSION_NANO=$NANO
- AC_SUBST(PACKAGE_VERSION_NANO)
- AC_SUBST(PACKAGE_VERSION_RELEASE)
-])
diff --git a/m4/introspection.m4 b/m4/introspection.m4
index 589721c5..b0ccd689 100644
--- a/m4/introspection.m4
+++ b/m4/introspection.m4
@@ -8,6 +8,47 @@ dnl
# serial 1
+dnl This is a copy of AS_AC_EXPAND
+dnl
+dnl (C) 2003, 2004, 2005 Thomas Vander Stichele <thomas at apestaart dot org>
+dnl Copying and distribution of this file, with or without modification,
+dnl are permitted in any medium without royalty provided the copyright
+dnl notice and this notice are preserved.
+m4_define([_GOBJECT_INTROSPECTION_AS_AC_EXPAND],
+[
+ EXP_VAR=[$1]
+ FROM_VAR=[$2]
+
+ dnl first expand prefix and exec_prefix if necessary
+ prefix_save=$prefix
+ exec_prefix_save=$exec_prefix
+
+ dnl if no prefix given, then use /usr/local, the default prefix
+ if test "x$prefix" = "xNONE"; then
+ prefix="$ac_default_prefix"
+ fi
+ dnl if no exec_prefix given, then use prefix
+ if test "x$exec_prefix" = "xNONE"; then
+ exec_prefix=$prefix
+ fi
+
+ full_var="$FROM_VAR"
+ dnl loop until it doesn't change anymore
+ while true; do
+ new_full_var="`eval echo $full_var`"
+ if test "x$new_full_var" = "x$full_var"; then break; fi
+ full_var=$new_full_var
+ done
+
+ dnl clean up
+ full_var=$new_full_var
+ AC_SUBST([$1], "$full_var")
+
+ dnl restore prefix and exec_prefix
+ prefix=$prefix_save
+ exec_prefix=$exec_prefix_save
+])
+
m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
[
AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
@@ -41,6 +82,8 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
],dnl
[auto],[dnl
PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+ dnl Canonicalize enable_introspection
+ enable_introspection=$found_introspection
],dnl
[dnl
AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
@@ -48,20 +91,25 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
AC_MSG_RESULT([$found_introspection])
+ dnl expand datadir/libdir so we can pass them to pkg-config
+ dnl and get paths relative to our target directories
+ _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_DATADIR, "$datadir")
+ _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_LIBDIR, "$libdir")
+
INTROSPECTION_SCANNER=
INTROSPECTION_COMPILER=
INTROSPECTION_GENERATE=
INTROSPECTION_GIRDIR=
INTROSPECTION_TYPELIBDIR=
if test "x$found_introspection" = "xyes"; then
- INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
- INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
- INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
- INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
- INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+ INTROSPECTION_SCANNER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+ INTROSPECTION_COMPILER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+ INTROSPECTION_GENERATE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --define-variable=datadir="${_GI_EXP_DATADIR}" --variable=girdir gobject-introspection-1.0`
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --define-variable=libdir="${_GI_EXP_LIBDIR}" --variable=typelibdir gobject-introspection-1.0)"
INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
- INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+ INTROSPECTION_MAKEFILE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
fi
AC_SUBST(INTROSPECTION_SCANNER)
AC_SUBST(INTROSPECTION_COMPILER)
diff --git a/m4/vapigen.m4 b/m4/vapigen.m4
index 051ccd2e..6228991a 100644
--- a/m4/vapigen.m4
+++ b/m4/vapigen.m4
@@ -16,15 +16,20 @@ dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION], [DEFAULT])
+# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND_INTROSPECTION], [DEFAULT])
# --------------------------------------
# Check vapigen existence and version
#
# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
AC_DEFUN([VAPIGEN_CHECK],
[
- AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0])
- AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0])
+ AS_IF([test "x$3" != "xyes"], [
+ m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [
+ m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [
+ AC_MSG_ERROR([[You must call GOBJECT_INTROSPECTION_CHECK or GOBJECT_INTROSPECTION_REQUIRE before using VAPIGEN_CHECK unless using the FOUND_INTROSPECTION argument is "yes"]])
+ ])
+ ])
+ ])
AC_ARG_ENABLE([vala],
[AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[
@@ -77,12 +82,12 @@ AC_DEFUN([VAPIGEN_CHECK],
AS_CASE([$enable_vala],
[yes], [
- VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
- VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir $vapigen_pkg_name`/vala/Makefile.vapigen
+ VAPIGEN=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
+ VAPIGEN_MAKEFILE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=datadir $vapigen_pkg_name`/vala/Makefile.vapigen
AS_IF([test "x$2" = "x"], [
- VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir $vapigen_pkg_name`
+ VAPIGEN_VAPIDIR=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=vapidir $vapigen_pkg_name`
], [
- VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned $vapigen_pkg_name`
+ VAPIGEN_VAPIDIR=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=vapidir_versioned $vapigen_pkg_name`
])
])
--
2.41.0
From 18f0d9f5f245f92dee086ce57a5bb94e63f1c222 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Sun, 18 Jun 2023 11:08:59 +0900
Subject: [PATCH] configure: Fix cross compiling
Use AX_PROG_CC_FOR_BUILD to get build CC/CFLAGS/LDFLAGS/etc.
Use PKG_PROG_PKG_CONFIG_FOR_BUILD to find build pkg-config binary.
https://sourceware.org/autobook/autobook/autobook_143.html#Supporting-Cross-Compiler-in-Make
BUG=https://github.com/ibus/ibus/issues/2479
---
configure.ac | 12 +++
m4/Makefile.am | 2 +
m4/ax_prog_cc_for_build.m4 | 155 +++++++++++++++++++++++++++++++++++++
m4/pkg_config_for_build.m4 | 20 +++++
src/Makefile.am | 67 ++++++++++++----
5 files changed, 240 insertions(+), 16 deletions(-)
create mode 100644 m4/ax_prog_cc_for_build.m4
create mode 100644 m4/pkg_config_for_build.m4
diff --git a/configure.ac b/configure.ac
index cbdfbd05..fb51367f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,6 +129,7 @@ AM_PROG_CC_C_O
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])
@@ -150,6 +151,9 @@ 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_C_BIGENDIAN([ENDIAN=big], [ENDIAN=little], [ENDIAN=unknown], [ENDIAN=big])
if test x"$ENDIAN" != xlittle -a x"$ENDIAN" != xbig; then
@@ -183,6 +187,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 49ecbb89..8ea759e6 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -21,7 +21,9 @@
# USA
EXTRA_DIST = \
+ 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 adc7f04a..68dde2f3 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 \
@@ -196,11 +228,12 @@ gen_internal_compose_table_SOURCES = \
ibuskeyuni.c \
ibusenumtypes.h \
$(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 = \
@@ -363,15 +396,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
@@ -408,13 +441,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
--
2.41.0
From 25a2dfc12410fff5f32a3caf793a958d7e41dc4c Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 4 Jul 2023 22:46:31 +0900
Subject: [PATCH] bus: Avoid to hang the process with SIGUSR1 signal
Seems multiple `Xephyr -query` to a remote GDM login session causes
to leave the some processes of ibus-daemon even if the Xephyr sessions
are terminated and the issue is caused by calling bus_server_quit()
with SIGUSR1 signal.
I cannot reproduce the issue but calling the unsafe code from a signal
handler might lead to hangs and this is another signal connection
not to hang ibus-daemon.
BUG=https://github.com/ibus/ibus/pull/2499
---
bus/main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bus/main.c b/bus/main.c
index e80185b1..c4b8d651 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2013-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2008-2018 Red Hat, Inc.
+ * Copyright (C) 2013-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2023 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -166,11 +166,12 @@ daemon (gint nochdir, gint noclose)
#endif
#ifdef HAVE_SYS_PRCTL_H
-static void
-_sig_usr1_handler (int sig)
+static gboolean
+_on_sigusr1 (void)
{
g_warning ("The parent process died.");
bus_server_quit (FALSE);
+ return G_SOURCE_REMOVE;
}
#endif
@@ -350,7 +351,7 @@ main (gint argc, gchar **argv)
if (prctl (PR_SET_PDEATHSIG, SIGUSR1))
g_printerr ("Cannot bind SIGUSR1 for parent death\n");
else
- signal (SIGUSR1, _sig_usr1_handler);
+ g_unix_signal_add (SIGUSR1, (GSourceFunc)_on_sigusr1, NULL);
#endif
}
bus_server_run ();
--
2.41.0
From be1f1d0da86006b019aaf78781d8c0c9c68fd46d Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Wed, 5 Jul 2023 13:33:25 +0900
Subject: [PATCH 1/2] src: Fix missing ibusenumtypes.h with parallel build
When `./autogen.sh && make -C src ibusresources.c -j2` runs,
it causes a build failure due to no ibusenumtypes.h file.
The chained dependencies are:
ibusresources.c -> compose/sequences-$(ENDIAN)-endian
-> gen-internal-compose-table -> gencomposetable.c
gencomposetable.c includes ibus.h and it causes no ibusenumtypes.h with
the parallel build with multi CPUs.
ibusenumtypes.h is in BUILT_SOURCES so it is built (with other files in
BUILT_SOURCES) before any other rules.
But ibus.h is included by gencomposetable.c which is needed to generate
ibusresources.c in BUILT_SOURCES.
Since gencomposetable.c is an internal build source file and
it doesn't have to include ibus.h but can include each ibus header
files.
Deleting ibus.h in gencomposetable.c can fix the build failure.
BUG=https://github.com/ibus/ibus/pull/2523
---
src/gencomposetable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gencomposetable.c b/src/gencomposetable.c
index 6e52d6a6..35d6ce83 100644
--- a/src/gencomposetable.c
+++ b/src/gencomposetable.c
@@ -20,7 +20,7 @@
* USA
*/
-#include <ibus.h>
+/* #2523 Should not include <ibus.h> but each IBus header file. */
#include <glib.h>
#include <glib/gstdio.h>
#include <errno.h>
--
2.41.0
From f25c48a1989be221e98b863c947e52eaf80dc4a3 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Wed, 5 Jul 2023 13:41:33 +0900
Subject: [PATCH 2/2] src: Fix to build libibus-1.0.la twice
The purpose of autotools is to automatically handle dependencies. By
calling $(MAKE) manually and without specifying any dependencies below,
we are going out of our way to prevent automake from doing its job.
ibusunicodegen.h:
$(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict
This avoids a build error whereby libibus-1.0.la is built twice
simultaneously, races with itself, and breaks the build.
dicts/unicode-blocks.dict ibusunicodegen.h: unicode-parser
The two build targets let `make ibusunicodegen.h` try to make
`dicts/unicode-blocks.dict` and `ibusunicodegen.h` with unicode-parser.
Unlike `ibusunicodegen.h`, we cannot add `ibusemojigen.h` to the rule
that produces it (as a side-effect) because the rule is specified with
GNU Make syntax:
dicts/emoji-%.dict: emoji-parser
and doing so yields an error:
config.status: error: Something went wrong bootstrapping makefile
fragments for automatic dependency tracking. If GNU make was
not used, consider re-running the configure script with
MAKE="gmake" (or whatever is necessary). You can also try
re-running configure with the '--disable-dependency-tracking'
option to at least be able to build the package (albeit without
support for automatic dependency tracking).
So instead, add a prerequisite to the rule.
Both emoji-parser and unicode-parser has $(libibus) in LDADD
and $(libibus) is built before emoji-parser and unicode-parser are
built.
BUG=https://github.com/ibus/ibus/pull/2523
---
src/Makefile.am | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 68dde2f3..fee0b3ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -372,8 +372,9 @@ dicts/emoji-%.dict: emoji-parser
echo "Skip $$plus_comment $@"; \
fi;
-ibusemojigen.h:
- $(MAKE) $(AM_MAKEFLAGS) dicts/emoji-en.dict
+# #2523 Should use autotool dependency
+ibusemojigen.h: dicts/emoji-en.dict
+ $(MAKE) $(AM_MAKEFLAGS) $^
# We put dicts/emoji-%.dict as the make target for the parallel build
# and the make target has to be genarated even if the file size is zero.
@@ -424,7 +425,8 @@ dicts/unicode-names.dict: unicode-parser
echo "Generated $@"; \
fi;
-dicts/unicode-blocks.dict: unicode-parser
+# #2523 Should use autotool dependency
+dicts/unicode-blocks.dict ibusunicodegen.h: unicode-parser
$(AM_V_at)input_file="$(UCD_DIR)/Blocks.txt"; \
if test ! -f "$$input_file" ; then \
echo "WARNING: Not found $$input_file" 1>&2; \
@@ -436,9 +438,6 @@ dicts/unicode-blocks.dict: unicode-parser
echo "Generated $@"; \
fi;
-ibusunicodegen.h:
- $(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict
-
unicode_parser_SOURCES = \
unicode-parser.c \
$(parser_extra_sources) \
--
2.41.0

View File

@ -1,398 +0,0 @@
From 3d69b8f402f954c5c832a564f9bcfba44d071a58 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Fri, 12 May 2023 08:18:10 +0900
Subject: [PATCH] configure: Fix cross compiling
Use AX_PROG_CC_FOR_BUILD to get build CC/CFLAGS/LDFLAGS/etc.
Use PKG_PROG_PKG_CONFIG_FOR_BUILD to find build pkg-config binary.
https://sourceware.org/autobook/autobook/autobook_143.html#Supporting-Cross-Compiler-in-Make
BUG=https://github.com/ibus/ibus/issues/2479
---
configure.ac | 12 +++
m4/Makefile.am | 2 +
m4/ax_prog_cc_for_build.m4 | 155 +++++++++++++++++++++++++++++++++++++
m4/pkg_config_for_build.m4 | 20 +++++
src/Makefile.am | 67 ++++++++++++----
5 files changed, 240 insertions(+), 16 deletions(-)
create mode 100644 m4/ax_prog_cc_for_build.m4
create mode 100644 m4/pkg_config_for_build.m4
diff --git a/configure.ac b/configure.ac
index b3eacbcb..b286c62f 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,6 +152,9 @@ 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_C_BIGENDIAN([ENDIAN=big], [ENDIAN=little], [ENDIAN=unknown], [ENDIAN=big])
if test x"$ENDIAN" != xlittle -a x"$ENDIAN" != xbig; then
@@ -184,6 +188,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 adc7f04a..68dde2f3 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 \
@@ -196,11 +228,12 @@ gen_internal_compose_table_SOURCES = \
ibuskeyuni.c \
ibusenumtypes.h \
$(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 = \
@@ -363,15 +396,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
@@ -408,13 +441,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
--
2.40.0

View File

@ -50,7 +50,7 @@
Name: ibus Name: ibus
Version: 1.5.28 Version: 1.5.28
Release: 8%{?dist} Release: 9%{?dist}
Summary: Intelligent Input Bus for Linux OS Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.0-or-later License: LGPL-2.0-or-later
URL: https://github.com/ibus/%name/wiki URL: https://github.com/ibus/%name/wiki
@ -65,8 +65,6 @@ Patch1: %{name}-1385349-segv-bus-proxy.patch
# Use mutter window manager in RHEL CI # Use mutter window manager in RHEL CI
Patch2: %{name}-xx-desktop-testing-mutter.patch Patch2: %{name}-xx-desktop-testing-mutter.patch
%endif %endif
# https://github.com/ibus/ibus/issues/2479
Patch3: %{name}-xx-cross-compile.patch
# autoreconf requires autopoint but not po.m4 # autoreconf requires autopoint but not po.m4
BuildRequires: gettext-devel BuildRequires: gettext-devel
@ -559,6 +557,12 @@ dconf update || :
%{_datadir}/installed-tests/ibus %{_datadir}/installed-tests/ibus
%changelog %changelog
* Wed Jul 05 2023 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.28-9
- Delete upstreamed ibus-xx-cross-compile.patch
- Fix alive ibus-x11 with `Xephyr -query`
- Fix missing ibusenumtypes.h with parallel build
- Fix to build libibus-1.0.la twice
* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1.5.28-8 * Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1.5.28-8
- Rebuilt for Python 3.12 - Rebuilt for Python 3.12