Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing keyman software in Gentoo -- systemd dependency
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
rytir
n00b
n00b


Joined: 04 Jan 2025
Posts: 2

PostPosted: Sat Jan 04, 2025 6:34 am    Post subject: Installing keyman software in Gentoo -- systemd dependency Reply with quote

Keyman is a nice piece of software designed to type in non-latin alphabets with a plenty of keyboard definitions and usable with ibus.
Originally written for Windows user, it has has been made open source and expanded to include Linux users.

https://github.com/keymanapp/keyman/blob/master/docs/linux/README.md
https://github.com/keymanapp/keyman

But the Linux support seems to be limited to Debian or other systemd-based OS.
In openrc system the source code fails to get configured, complaining of missing libsystemd.

The dependency is declared in:
Code:
/usr/bin/pkg-config --modversion libsystemd

Is it generally possible to avoid the systemd dependency, for example by using openrc?

Thank you for your suggestions.
Jaroslav, Prague

The relevant part of the log file:
Code:
Called: `/usr/bin/pkg-config --modversion libsystemd` -> 1
stderr:
Package libsystemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsystemd.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libsystemd' not found
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31440
Location: here

PostPosted: Sat Jan 04, 2025 6:50 am    Post subject: Reply with quote

If systemd is used only for start a deamon you can convert a systemd unit in a openrc service script.
In this case since it is looking for the libsystemd library I assume that some function of systemd is used in the code, so you should patch in the code not to use this library.

-- edit --
The program seems to use systemd/sd-bus.h this library is provided by sys-auth/elogind for a OpenRC system.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1797
Location: South America

PostPosted: Sat Jan 04, 2025 1:23 pm    Post subject: Reply with quote

Try this patch (for release 17.0.332)

keyman-patch
Code:
--- orig/linux/keyman-system-service/meson.build   2025-01-04 10:10:29.014297487 -0300
+++ patched/linux/keyman-system-service/meson.build   2025-01-04 10:10:48.444007927 -0300
@@ -4,7 +4,7 @@
         meson_version: '>=0.61')
 
 evdev    = dependency('libevdev', version: '>= 1.9')
-systemd  = dependency('libsystemd')
+systemd  = dependency('libelogind')
 
 subdir('resources')
 subdir('src')
--- orig/linux/ibus-keyman/meson.build      2025-01-04 10:12:47.698608133 -0300
+++ patched/linux/ibus-keyman/meson.build   2025-01-04 10:13:06.362936056 -0300
@@ -8,7 +8,7 @@
 ibus =           dependency('ibus-1.0',             version: '>= 1.2.0')
 gtk =            dependency('gtk+-3.0',             version: '>= 2.4')
 json_glib =      dependency('json-glib-1.0',        version: '>= 1.0')
-systemd  =       dependency('libsystemd')
+systemd  =       dependency('libelogind')
 icu =            dependency('icu-i18n')
 
 core_dir = meson.current_source_dir() / '../../core'
--- orig/linux/keyman-system-service/resources/com.keyman.SystemService1.service   2025-01-04 10:11:07.330446856 -0300
+++ patched/linux/keyman-system-service/resources/com.keyman.SystemService1.service   2025-01-04 10:12:21.417473536 -0300
@@ -2,6 +2,6 @@
 
 [D-BUS Service]
 Name=com.keyman.SystemService1
-Exec=/bin/false
+Exec=/usr/libexec/keyman-system-service
 User=root
-SystemdService=systemd-keyman.service
+#SystemdService=systemd-keyman.service

And install sys-auth/elogind (replacing the functionality that the package wants from systemd) in addition to the other dependencies.

Be careful to preserve TAB characters if you copy and paste from the forum post.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
rytir
n00b
n00b


Joined: 04 Jan 2025
Posts: 2

PostPosted: Tue Jan 07, 2025 6:20 am    Post subject: Installing keyman software in Gentoo -- systemd dependency Reply with quote

Thank you for your quick and helpful replies. The patch works great, I only needed to supply some packages to complete the configure and make processes.

So this is what I did:

1. Installing dependencies using Portage (binaryen is not included in Gentoo repository, but can be found in cg overlay):
Code:
...in /etc/portage/repos.conf/eselect-repo.conf
[cg]
location = /var/db/repos/cg             
sync-type = git
sync-uri = https://github.com/brothermechanic/cg.git
auto-sync = yes
...in /etc/portage/package.accept_keywords
dev-util/binaryen ~amd64
...in terminal:
sudo eix-sync
sudo eix-update
sudo emerge --oneshot -kuaq dev-util/binaryen net-libs/nodejs sys-auth/elogind
sudo emerge --oneshot -kuaq dev-python/requests-cache dev-python/dbus-python dev-python/python-magic dev-python/fonttools dev-libs/libdbusmenu app-i18n/unicode-data app-i18n/ibus


2. The last dependency needed is emscripten, which I installed from the source code:
Code:
cd ~
git clone https://github.com/emscripten-core/emsdk.git
mv emsdk .emsdk
cd ~/.emsdk
./emsdk install latest
./emsdk activate latest
...in ~/.bashrc
export EMSCRIPTEN_BASE="$HOME/.emsdk/upstream/emscripten"
export KEYMAN_USE_EMSDK=1


3. Cloning and patching keyman:
Code:
...in terminal:
git clone https://github.com/keymanapp/keyman.git
cd keyman
...in linux/keyman-system-service/meson.build
-systemd  = dependency('libsystemd')
+systemd  = dependency('libelogind')
...in keyman/linux/ibus-keyman/meson.build
-systemd = dependency('libsystemd')
+systemd = dependency('libelogind')
...in linux/keyman-system-service/resources/com.keyman.SystemService1.service
-Exec=/bin/false
+Exec=/usr/libexec/keyman-system-service
 User=root
-SystemdService=systemd-keyman.service
+#SystemdService=systemd-keyman.service


4. Configuring and building core and linux keyman:
Code:
bash core/build.sh configure
bash core/build.sh build
bash linux/build.sh configure
bash linux/build.sh build


The keyman installation can be completed by
Code:
sudo bash core/build.sh install

but at the risk of messing up the Portage tree.
A more preferable option seems to be either a user-only installation of ibus plus keyman, or a standard ebuild package.
After I get that far, I will share again.
Back to top
View user's profile Send private message
ermshiperete
n00b
n00b


Joined: 23 Jan 2025
Posts: 2

PostPosted: Thu Jan 23, 2025 8:55 am    Post subject: Reply with quote

Thanks for the patches! I created a PR (#12889 https://github.com/keymanapp/keyman/pull/12889) that includes the patches so that in the future the Keyman source should build on Gentoo.

But since I'm not a Gentoo user I would need someone to try to build with this PR on Gentoo and report back. I'd really love to include this change in the upcoming Keyman version, Keyman 18.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1797
Location: South America

PostPosted: Fri Jan 24, 2025 1:09 pm    Post subject: Reply with quote

ermshiperete wrote:
Thanks for the patches! I created a PR (#12889 https://github.com/keymanapp/keyman/pull/12889) that includes the patches so that in the future the Keyman source should build on Gentoo.

Oh, you are one of the people who can commit to upstream's Git repository, right? This was a quick and dirty patch intended to help the OP build the package with minimum effort, I wonder how you found this thread :)

If there are going to be changes upstream, I suggest two improvements:
  • Since the package only wants the D-Bus client API from libsystemd, it would be nice if the build system could fall back to using basu (sys-libs/basu on Gentoo) if neither systemd nor elogind are installed. The #include <systemd/sd-bus.h> directive would have to change to #include <basu/sd-bus.h>, though, so a small #if ... #endif block would be needed. I can post an improved patch for this.
  • I'm quite sure you don't need two versions of keyman-system-service's D-Bus .service file. dbus-daemon should process the SystemdService key and ignore the Exec key if invoked with --systemd-activation (such as when launched by systemd using its service unit file), and process Exec otherwise.

ermshiperete wrote:
But since I'm not a Gentoo user I would need someone to try to build with this PR on Gentoo and report back. I'd really love to include this change in the upcoming Keyman version, Keyman 18.

I don't use the software, but appreciate that you are willing to make this change upstream, so in a couple of days I might at least test if the package builds. I just need to set up the binary package host so that I don't have to have the package manager build all dependencies for just one test (GTK3 mostly :P)
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ermshiperete
n00b
n00b


Joined: 23 Jan 2025
Posts: 2

PostPosted: Fri Jan 24, 2025 5:10 pm    Post subject: Reply with quote

Thanks for your reply!

Quote:
Oh, you are one of the people who can commit to upstream's Git repository, right? This was a quick and dirty patch intended to help the OP build the package with minimum effort, I wonder how you found this thread :)


Yes, I'm the upstream maintainer of Keyman for Linux. The OP also asked on our support forum and added a link to this thread.

Quote:
If there are going to be changes upstream, I suggest two improvements:
  • Since the package only wants the D-Bus client API from libsystemd, it would be nice if the build system could fall back to using basu (sys-libs/basu on Gentoo) if neither systemd nor elogind are installed. The #include <systemd/sd-bus.h> directive would have to change to #include <basu/sd-bus.h>, though, so a small #if ... #endif block would be needed. I can post an improved patch for this.


That would be fantastic.

Quote:
  • I'm quite sure you don't need two versions of keyman-system-service's D-Bus .service file. dbus-daemon should process the SystemdService key and ignore the Exec key if invoked with --systemd-activation (such as when launched by systemd using its service unit file), and process Exec otherwise.


  • That's probably true, but having two versions makes it more explicit how it will be launched on a platform. Since I only occasionally deal with dbus I always forget how things work...
    Back to top
    View user's profile Send private message
    GDH-gentoo
    Veteran
    Veteran


    Joined: 20 Jul 2019
    Posts: 1797
    Location: South America

    PostPosted: Sun Jan 26, 2025 10:22 pm    Post subject: Reply with quote

    ermshiperete wrote:
    Quote:
    If there are going to be changes upstream, I suggest two improvements:
    [list][*] Since the package only wants the D-Bus client API from libsystemd, it would be nice if the build system could fall back to using basu (sys-libs/basu on Gentoo) if neither systemd nor elogind are installed. The #include <systemd/sd-bus.h> directive would have to change to #include <basu/sd-bus.h>, though, so a small #if ... #endif block would be needed. I can post an improved patch for this.


    That would be fantastic.

    I made the patch (see next post). It works for me if I apply it to version 17.0.332 and do:
    Code:
    $ linux/build.sh build:engine

    which only builds the affected part. In addition to applying the patch, I also had to remove the lines in linux/ibus-keyman/src/engine.c and linux/ibus-keyman/tests/ibusimcontext.c that print the warning about the prefilter mask patch to IBus, because with Gentoo's app-i18n/ibus package:

    Code:
    Header "ibus.h" has symbol "IBUS_CAP_PREFILTER" with dependency ibus-1.0: NO

    It looks like the intent isn't aborting the build if this happens, but for some reason the build system invokes the compiler with -Werror, which turns the warning into a fatal error. I couldn't find where this is coming from, so I can't be sure if it something in the package or in my environment, but I didn't want to spend too much time on it and this was easier.

    Anyway, results with elogind installed:

    Meson output
    Code:
    Run-time dependency libsystemd found: NO (tried pkgconfig and cmake)
    Run-time dependency libelogind found: YES 246.10
    Verifications
    Code:
    $ cat linux/build/x86_64/release/config.h
    /*
     * Autogenerated by the Meson build system.
     * Do not edit, your changes will be lost.
     */

    #pragma once

    #define HAVE_CONFIG_H 1

    #define SD_BUS_H <systemd/sd-bus.h>

    $ readelf -d linux/build/x86_64/release/src/ibus-engine-keyman | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgdk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libibus-1.0.so.5]
     0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.72]
     0x0000000000000001 (NEEDED)             Shared library: [libjson-glib-1.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libkeymancore.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/ibus-keyman-tests | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgtk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgdk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libibus-1.0.so.5]
     0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.72]
     0x0000000000000001 (NEEDED)             Shared library: [libjson-glib-1.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/km-dbus-test-server | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/stop-test-server | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ cat linux/keyman-system-service/build/x86_64/release/config.h
    /*
     * Autogenerated by the Meson build system.
     * Do not edit, your changes will be lost.
     */

    #pragma once

    #define SD_BUS_H <systemd/sd-bus.h>

    $ readelf -d linux/keyman-system-service/build/x86_64/release/src/keyman-system-service | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libevdev.so.2]
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/keyman-system-service/build/x86_64/release/tests/keyman-test-service | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libelogind.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    Everything links to libelogind.so.0.

    Results introducing a small typo in meson.build files so that the basu detection path is taken instead:

    Meson output
    Code:
    Run-time dependency libsystemd found: NO (tried pkgconfig and cmake)
    Run-time dependency libelogund found: NO (tried pkgconfig and cmake)
    Run-time dependency basu found: YES 0.2.1
    Verifications
    Code:
    $ cat linux/build/x86_64/release/config.h
    /*
     * Autogenerated by the Meson build system.
     * Do not edit, your changes will be lost.
     */

    #pragma once

    #define HAVE_CONFIG_H 1

    #define SD_BUS_H <basu/sd-bus.h>

    $ readelf -d linux/build/x86_64/release/src/ibus-engine-keyman | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgdk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libibus-1.0.so.5]
     0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.72]
     0x0000000000000001 (NEEDED)             Shared library: [libjson-glib-1.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libkeymancore.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/ibus-keyman-tests | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgtk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgdk-3.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libibus-1.0.so.5]
     0x0000000000000001 (NEEDED)             Shared library: [libicuuc.so.72]
     0x0000000000000001 (NEEDED)             Shared library: [libjson-glib-1.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/km-dbus-test-server | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/build/x86_64/release/tests/stop-test-server | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ cat linux/keyman-system-service/build/x86_64/release/config.h
    /*
     * Autogenerated by the Meson build system.
     * Do not edit, your changes will be lost.
     */

    #pragma once

    #define SD_BUS_H <basu/sd-bus.h>

    $ readelf -d linux/keyman-system-service/build/x86_64/release/src/keyman-system-service | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libevdev.so.2]
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    $ readelf -d linux/keyman-system-service/build/x86_64/release/tests/keyman-test-service | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libbasu.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

    Everything links to libbasu.so.0.
    _________________
    NeddySeagoon wrote:
    I'm not a witch, I'm a retired electronics engineer :)
    Ionen wrote:
    As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)


    Last edited by GDH-gentoo on Mon Jan 27, 2025 2:11 am; edited 4 times in total
    Back to top
    View user's profile Send private message
    GDH-gentoo
    Veteran
    Veteran


    Joined: 20 Jul 2019
    Posts: 1797
    Location: South America

    PostPosted: Sun Jan 26, 2025 10:34 pm    Post subject: Reply with quote

    Patch:

    Code:
    --- orig/linux/ibus-keyman/meson.build  2025-01-25 18:42:01.758198471 -0300
    +++ patched/linux/ibus-keyman/meson.build       2025-01-25 18:45:48.325209275 -0300
    @@ -8,9 +8,16 @@
     ibus =           dependency('ibus-1.0',             version: '>= 1.2.0')
     gtk =            dependency('gtk+-3.0',             version: '>= 2.4')
     json_glib =      dependency('json-glib-1.0',        version: '>= 1.0')
    -systemd  =       dependency('libsystemd')
    +systemd  =       dependency('libsystemd', 'libelogind', required: false)
     icu =            dependency('icu-i18n')
     
    +if systemd.found()
    +  conf.set('SD_BUS_H', '<systemd/sd-bus.h>')
    +else
    +  systemd = dependency('basu')
    +  conf.set('SD_BUS_H', '<basu/sd-bus.h>')
    +endif
    +
     core_dir = meson.current_source_dir() / '../../core'
     common_dir = meson.current_source_dir() / '../../common'
     
    --- orig/linux/ibus-keyman/src/KeymanSystemServiceClient.cpp    2025-01-25 18:47:38.072214508 -0300
    +++ patched/linux/ibus-keyman/src/KeymanSystemServiceClient.cpp 2025-01-25 18:48:36.655217301 -0300
    @@ -1,5 +1,6 @@
    +#include "config.h"
     #include <cassert>
    -#include <systemd/sd-bus.h>
    +#include SD_BUS_H
     #include "KeymanSystemServiceClient.h"
     
     #define KEYMAN_BUS_NAME "com.keyman.SystemService1"
    --- orig/linux/ibus-keyman/tests/meson.build    2025-01-25 20:10:15.491618558 -0300
    +++ patched/linux/ibus-keyman/tests/meson.build 2025-01-25 20:14:15.782715510 -0300
    @@ -38,6 +38,7 @@
       'km-dbus-test-server',
       'KmDbusTestServer.cpp',
       dependencies: dbus_deps,
    +  include_directories: [ '..' ],
       cpp_args: [
       '-DKEYMAN_TEST_SERVICE_PATH="' + system_service_dir + '"'
      ]
    @@ -47,6 +48,7 @@
       'stop-test-server',
       'StopTestServer.cpp',
       dependencies: dbus_deps,
    +  include_directories: [ '..' ]
     )
     
     env_file = '/tmp/env.txt'
    --- orig/linux/ibus-keyman/tests/KmDbusTestServer.cpp   2025-01-25 18:51:14.626224834 -0300
    +++ patched/linux/ibus-keyman/tests/KmDbusTestServer.cpp        2025-01-25 18:51:37.504225925 -0300
    @@ -1,9 +1,10 @@
     // DBus test server. The server will start and listen on a non-standard DBus.
     // It runs until the DBus Exit method gets called.
    +#include "config.h"
     #include <fstream>
     #include <gio/gio.h>
     #include <iostream>
    -#include <systemd/sd-bus.h>
    +#include SD_BUS_H
     
     #ifndef KEYMAN_TEST_SERVICE_PATH
     #warning KEYMAN_TEST_SERVICE_PATH is undefined
    --- orig/linux/ibus-keyman/tests/StopTestServer.cpp     2025-01-25 18:51:55.108226764 -0300
    +++ patched/linux/ibus-keyman/tests/StopTestServer.cpp  2025-01-25 18:52:15.131227719 -0300
    @@ -1,8 +1,9 @@
     // Call the Exit method on the km-dbus-test-server. Remember to source
     // `/tmp/km-test-server.env` prior to running stop-test-server in order
     // to run on our non-standard DBus.
    +#include "config.h"
     #include <iostream>
    -#include <systemd/sd-bus.h>
    +#include SD_BUS_H
     
     using namespace std;
     
    --- orig/linux/keyman-system-service/meson.build        2025-01-25 18:54:06.982233052 -0300
    +++ patched/linux/keyman-system-service/meson.build     2025-01-25 19:02:43.650257689 -0300
    @@ -4,7 +4,17 @@
             meson_version: '>=0.61')
     
     evdev    = dependency('libevdev', version: '>= 1.9')
    -systemd  = dependency('libsystemd')
    +systemd  = dependency('libsystemd', 'libelogind', required: false)
    +
    +conf = configuration_data()
    +if systemd.found()
    +  conf.set('SD_BUS_H', '<systemd/sd-bus.h>')
    +else
    +  systemd = dependency('basu')
    +  conf.set('SD_BUS_H', '<basu/sd-bus.h>')
    +endif
    +configure_file(output : 'config.h',
    +               configuration : conf)
     
     subdir('resources')
     subdir('src')
    --- orig/linux/keyman-system-service/src/meson.build    2025-01-25 18:57:22.790242389 -0300
    +++ patched/linux/keyman-system-service/src/meson.build 2025-01-25 20:07:11.392606279 -0300
    @@ -10,6 +10,7 @@
       'keyman-system-service',
       sources: [service_files],
       dependencies: deps,
    +  include_directories: [ '..' ],
       install: true,
       install_dir: get_option('libexecdir'),
     )
    --- orig/linux/keyman-system-service/src/KeymanSystemService.h  2025-01-26 11:53:15.005420030 -0300
    +++ patched/linux/keyman-system-service/src/KeymanSystemService.h       2025-01-26 11:53:36.234030043 -0300
    @@ -1,8 +1,9 @@
     #ifndef __KEYMANSYSTEMSERVICE_H__
     #define __KEYMANSYSTEMSERVICE_H__
     
    +#include "config.h"
     #include <list>
    -#include <systemd/sd-bus.h>
    +#include SD_BUS_H
     #include "KeyboardDevice.h"
     
     using namespace std;
    --- orig/linux/keyman-system-service/src/KeymanSystemService.cpp        2025-01-25 19:01:04.200252947 -0300
    +++ patched/linux/keyman-system-service/src/KeymanSystemService.cpp     2025-01-25 19:01:29.670254161 -0300
    @@ -2,6 +2,7 @@
     // based on the sd-bus library, see
     // https://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html
     
    +#include "config.h"
     #include <cstdint>
     #include <dirent.h>
     #include <errno.h>
    @@ -11,7 +12,7 @@
     #include <string.h>
     #include <sys/types.h>
     #include <syslog.h>
    -#include <systemd/sd-bus.h>
    +#include SD_BUS_H
     #include "KeymanSystemService.h"
     #include "KeyboardDevice.h"
     
    --- orig/linux/keyman-system-service/tests/meson.build  2025-01-25 19:10:07.657278861 -0300
    +++ patched/linux/keyman-system-service/tests/meson.build       2025-01-25 20:09:17.909839310 -0300
    @@ -17,7 +17,7 @@
       c_args: test_c_args,
       cpp_args: test_c_args,
       dependencies: deps,
    -  include_directories: [ '../src' ]
    +  include_directories: [ '..', '../src' ]
     )
     
     # we currently don't have any unit tests for keyman-system-service.
    --- orig/linux/ibus-keyman/tests/KmDbusTestServer.cpp   2025-01-26 12:10:12.365894542 -0300
    +++ patched/linux/ibus-keyman/tests/KmDbusTestServer.cpp        2025-01-26 12:11:12.849123929 -0300
    @@ -74,7 +74,10 @@
     {
       if (bus)  sd_bus_release_name(bus, KEYMAN_TESTSVC_BUS_NAME);
       if (slot) sd_bus_slot_unref(slot);
    -  if (bus)  sd_bus_close_unref(bus);
    +  if (bus) {
    +     sd_bus_close(bus);
    +     sd_bus_unref(bus);
    +  }
     
       g_test_dbus_down(dbus);
       g_object_unref(dbus);

    The change in linux/ibus-keyman/tests/KmDbusTestServer.cpp deserves an explanation. Currently, the basu package doesn't implement (extract?) anything added to systemd after version 240, and this includes sd_bus_close_unref() (introduced in version 241). However, sd_bus_close_unref() only calls sd_bus_close() and then sd_bus_unref().

    I also didn't do anything with the changes to the D-Bus .service file, since, after applying this patch, systemd.name() can now have a third value.
    _________________
    NeddySeagoon wrote:
    I'm not a witch, I'm a retired electronics engineer :)
    Ionen wrote:
    As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
    Page 1 of 1

     
    Jump to:  
    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot vote in polls in this forum