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.