Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 670248 - media-libs/libsdl2: Support app-i18n/fcitx and app-i18n/ibus
Summary: media-libs/libsdl2: Support app-i18n/fcitx and app-i18n/ibus
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-11-04 06:51 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2020-10-15 16:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch (libsdl2.patch,8.98 KB, patch)
2018-11-04 06:55 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff
Patch (libsdl2.patch,7.16 KB, patch)
2020-09-30 22:52 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff
Patch (libsdl2.patch,7.16 KB, patch)
2020-09-30 22:57 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff
Patch (libsdl2.patch,7.75 KB, patch)
2020-10-14 22:33 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2018-11-04 06:51:25 UTC
SDL 2 library contains support for Fcitx and IBus input method frameworks.
Ebuild currently unconditionally passes --disable-ibus option, but does not pass any Fcitx-related option, so support for Fcitx is automagic.

If Fcitx is installed, then:
...
checking for pkg-config... (cached) /usr/bin/pkg-config
checking dbus/dbus.h usability... yes
checking dbus/dbus.h presence... no
configure: WARNING: dbus/dbus.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: dbus/dbus.h: proceeding with the compiler's result
checking for dbus/dbus.h... yes
checking for pkg-config... (cached) /usr/bin/pkg-config
checking fcitx/frontend.h usability... yes
checking fcitx/frontend.h presence... yes
checking for fcitx/frontend.h... yes
...
SDL2 Configure Summary:
Building Shared Libraries
Enabled modules : atomic audio video render events joystick sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx sse sse2 sse3
Audio drivers   : disk dummy alsa
Video drivers   : dummy x11 kmsdrm opengl opengl_es2 vulkan wayland
X11 libraries   : xcursor xdbe xinput2 xinput2_multitouch xrandr xscrnsaver xshape xvidmode
Input drivers   : linuxev linuxkd
Using libsamplerate : YES
Using libudev       : YES
Using dbus          : YES
Using ime           : YES
Using ibus          : NO
Using fcitx         : YES
>>> Source configured.
...


In case of support for both Fcitx and IBus, SDL 2 library would use only their headers at build time.
There is no linking against Fcitx / IBus libraries.
At run time, communication with Fcitx / IBus occurs through DBus.
Support for Fcitx / IBus requires enabled support for DBus:
...
                elif test x$enable_dbus != xyes; then
                    AC_MSG_WARN([DBus support is required for IBus.])
                    have_ibus_ibus_h_hdr=no
...
                elif test x$enable_dbus != xyes; then
                    AC_MSG_WARN([DBus support is required for fcitx.])
                    have_fcitx_frontend_h_hdr=no
...


Headers of IBus use headers of GLib 2.
glibconfig.h header is ABI-specific, so GLib 2 for matching ABIs is required at build time.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2018-11-04 06:55:25 UTC
Created attachment 554006 [details, diff]
Patch
Comment 2 Arfrever Frehtes Taifersar Arahesis 2020-09-30 22:52:31 UTC
Created attachment 663295 [details, diff]
Patch
Comment 3 Arfrever Frehtes Taifersar Arahesis 2020-09-30 22:57:24 UTC
Created attachment 663298 [details, diff]
Patch
Comment 4 James Le Cuirot gentoo-dev 2020-10-01 15:33:49 UTC
Why is the CPPFLAGS stuff for ibus necessary? configure appears to use pkg-config to locate it.
Comment 5 Arfrever Frehtes Taifersar Arahesis 2020-10-01 18:53:00 UTC
Fcitx and IBus ebuilds have no multilib support, and for the purpose of this bug they do NOT need multilib support. (D-Bus connection from 32-bit library to 64-bit D-Bus daemon works correctly.)

So fcitx.pc and ibus-1.0.pc exist only in directory for native ABI (e.g. /usr/lib64/pkgconfig on multilib x86_64 system).

Fcitx headers happen to need no -I options for being useable:

> $ pkg-config --cflags fcitx
> 
> $ pkg-config --cflags ibus-1.0
> -pthread -I/usr/include/ibus-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/lib64/libffi/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include

So 'PKG_CHECK_MODULES([IBUS], [ibus-1.0], have_ibus=yes, have_ibus=no)' and 'PKG_CHECK_MODULES([FCITX], [fcitx], have_fcitx=yes, have_fcitx=no)' succeed only for native ABI. Fortunately have_ibus and have_fcitx are not used at all. Checks for headers using AC_CHECK_HEADER are not conditional on these variables.

So manually adding these 3 -I options to CPPFLAGS is required for non-native ABIs.
Comment 6 James Le Cuirot gentoo-dev 2020-10-13 20:46:15 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> Fcitx and IBus ebuilds have no multilib support, and for the purpose of this
> bug they do NOT need multilib support. (D-Bus connection from 32-bit library
> to 64-bit D-Bus daemon works correctly.)
> 
> So fcitx.pc and ibus-1.0.pc exist only in directory for native ABI (e.g.
> /usr/lib64/pkgconfig on multilib x86_64 system).

Fair enough. Shame there's no way to override the pkg-config path only for specific packages. Might I suggest you do it like this though? It feels nicer.

> local mypc=$(ABI="${DEFAULT_ABI}" tc-getPKG_CONFIG)
> use fcitx4 && export FCITX_CFLAGS="$(${mypc} --cflags fcitx)"
> use ibus && export IBUS_CFLAGS="$(${mypc} --cflags ibus-1.0)"

One more thing. I see that app-i18n/mozc has used the flag name fcitx4 but that doesn't seem like a strong reason to not use fcitx here?
Comment 7 James Le Cuirot gentoo-dev 2020-10-14 08:26:26 UTC
> > local mypc=$(ABI="${DEFAULT_ABI}" tc-getPKG_CONFIG)
> > use fcitx4 && export FCITX_CFLAGS="$(${mypc} --cflags fcitx)"
> > use ibus && export IBUS_CFLAGS="$(${mypc} --cflags ibus-1.0)"

Sorry, I was slightly guessing above. That doesn't work at all! Even if the ABI stuff worked, it would probably return the same value anyway as it's PKG_CONFIG_PATH that differs. Perhaps you could do this instead:

> src_configure() {
>   use fcitx4 && export FCITX_CFLAGS="$($(tc-getPKG_CONFIG) --cflags fcitx)"
>   use ibus && export IBUS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags ibus-1.0)"
>
>   multilib-minimal_src_configure
> }

Alternative just specify the flags manually as you did but still use IBUS_CFLAGS.
Comment 8 Arfrever Frehtes Taifersar Arahesis 2020-10-14 22:33:38 UTC
Created attachment 665675 [details, diff]
Patch
Comment 9 Arfrever Frehtes Taifersar Arahesis 2020-10-14 22:37:44 UTC
(In reply to James Le Cuirot from comment #7)
> Perhaps you could do this instead:
> 
> > src_configure() {
> >   use fcitx4 && export FCITX_CFLAGS="$($(tc-getPKG_CONFIG) --cflags fcitx)"
> >   use ibus && export IBUS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags ibus-1.0)"

It cannot be done.
It would result in using -I/usr/lib64/glib-2.0/include for 32-bit ABI.
Comment 10 Larry the Git Cow gentoo-dev 2020-10-15 16:09:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c8a5f8499c8f8ee869dd9d7a1ba7858926ad3a3

commit 4c8a5f8499c8f8ee869dd9d7a1ba7858926ad3a3
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2018-11-04 06:51:48 +0000
Commit:     James Le Cuirot <chewi@gentoo.org>
CommitDate: 2020-10-15 16:09:02 +0000

    media-libs/libsdl2: Support app-i18n/fcitx and app-i18n/ibus.
    
    Closes: https://bugs.gentoo.org/670248
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>

 media-libs/libsdl2/libsdl2-2.0.12-r2.ebuild | 16 +++++++++++++---
 media-libs/libsdl2/metadata.xml             |  2 ++
 profiles/arch/alpha/package.use.mask        |  4 ++++
 profiles/arch/arm/package.use.mask          |  4 ++++
 profiles/arch/arm64/package.use.stable.mask |  4 ++++
 profiles/arch/hppa/package.use.stable.mask  |  4 ++++
 profiles/arch/ia64/package.use.mask         |  4 ++++
 profiles/arch/sparc/package.use.mask        |  4 ++++
 8 files changed, 39 insertions(+), 3 deletions(-)