Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Installing keyman software in Gentoo -- systemd dependency

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
11 posts • Page 1 of 1
Author
Message
rytir
n00b
n00b
Posts: 2
Joined: Sat Jan 04, 2025 5:49 am

Installing keyman software in Gentoo -- systemd dependency

  • Quote

Post by rytir » Sat Jan 04, 2025 6:34 am

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/blo ... /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: Select all

/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: Select all

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
Top
fedeliallalinea
Administrator
Administrator
User avatar
Posts: 31985
Joined: Sat Mar 08, 2003 11:15 pm
Location: here
Contact:
Contact fedeliallalinea
Website

  • Quote

Post by fedeliallalinea » Sat Jan 04, 2025 6:50 am

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.

"Those who would give up essential liberty to purchase a little temporary safety,
deserve neither liberty nor safety."
- Ben Franklin
https://www.news.admin.ch/it/nsb?id=103968
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Sat Jan 04, 2025 1:23 pm

Try this patch (for release 17.0.332)

keyman-patch

Code: Select all

--- 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.
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
rytir
n00b
n00b
Posts: 2
Joined: Sat Jan 04, 2025 5:49 am

Installing keyman software in Gentoo -- systemd dependency

  • Quote

Post by rytir » Tue Jan 07, 2025 6:20 am

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: Select all

...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: Select all

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: Select all

...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: Select all

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: Select all

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.
Top
ermshiperete
n00b
n00b
Posts: 3
Joined: Thu Jan 23, 2025 8:48 am
Contact:
Contact ermshiperete
Website

  • Quote

Post by ermshiperete » Thu Jan 23, 2025 8:55 am

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.
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Fri Jan 24, 2025 1:09 pm

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)
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
ermshiperete
n00b
n00b
Posts: 3
Joined: Thu Jan 23, 2025 8:48 am
Contact:
Contact ermshiperete
Website

  • Quote

Post by ermshiperete » Fri Jan 24, 2025 5:10 pm

Thanks for your reply!
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.
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.
[*] 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.[/list]
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...
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Sun Jan 26, 2025 10:22 pm

ermshiperete wrote:
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.
I made the patch (see next post). It works for me if I apply it to version 17.0.332 and do:

Code: Select all

$ 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: Select all

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: Select all

Run-time dependency libsystemd found: NO (tried pkgconfig and cmake)
Run-time dependency libelogind found: YES 246.10
Verifications

Code: Select all

$ 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: Select all

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: Select all

$ 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.
Last edited by GDH-gentoo on Mon Jan 27, 2025 2:11 am, edited 4 times in total.
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Sun Jan 26, 2025 10:34 pm

Patch:

Code: Select all

--- 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.
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
ermshiperete
n00b
n00b
Posts: 3
Joined: Thu Jan 23, 2025 8:48 am
Contact:
Contact ermshiperete
Website

  • Quote

Post by ermshiperete » Tue Jan 28, 2025 4:06 pm

Thanks for the patch! I applied a slightly modified version.
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Tue Jan 28, 2025 7:05 pm

ermshiperete wrote:Thanks for the patch! I applied a slightly modified version.
Thank you as well.
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
Post Reply

11 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic