qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] meson: Fixes for dbus modules
@ 2023-12-16  7:53 Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 1/3] Move dbus-display1 out of ui Akihiko Odaki
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Akihiko Odaki @ 2023-12-16  7:53 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann, Paolo Bonzini,
	Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
	Laurent Vivier
  Cc: qemu-devel, Akihiko Odaki

I found it was failing to build dbus modules when --enable-dbus so here
are fixes.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
Changes in v3:
- Merged dbus_display1_lib into libqemuutil.
- Added patch "audio: Do not include ui/dbus.h".
- Link to v2: https://lore.kernel.org/r/20231215-dbus-v2-0-1e2e6aa02115@daynix.com

Changes in v2:
- Updated MAINTAINERS.
- Link to v1: https://lore.kernel.org/r/20231215-dbus-v1-0-349e059ac5b2@daynix.com

---
Akihiko Odaki (3):
      Move dbus-display1 out of ui
      meson: Add dbus_display1 to util_ss and genh
      audio: Do not include ui/dbus.h

 MAINTAINERS                               |  1 +
 meson.build                               | 23 +++++++++++++++++++++++
 ui/dbus.h                                 |  2 +-
 audio/dbusaudio.c                         |  3 +--
 tests/qtest/dbus-display-test.c           |  2 +-
 audio/meson.build                         |  2 +-
 ui/dbus-display1.xml => dbus-display1.xml |  0
 tests/qtest/meson.build                   |  2 +-
 ui/meson.build                            | 20 +-------------------
 9 files changed, 30 insertions(+), 25 deletions(-)
---
base-commit: 4705fc0c8511d073bee4751c3c974aab2b10a970
change-id: 20231215-dbus-86876ecb7b09

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/3] Move dbus-display1 out of ui
  2023-12-16  7:53 [PATCH v3 0/3] meson: Fixes for dbus modules Akihiko Odaki
@ 2023-12-16  7:53 ` Akihiko Odaki
  2023-12-16 16:57   ` Philippe Mathieu-Daudé
  2023-12-16  7:53 ` [PATCH v3 2/3] meson: Add dbus_display1 to util_ss and genh Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 3/3] audio: Do not include ui/dbus.h Akihiko Odaki
  2 siblings, 1 reply; 6+ messages in thread
From: Akihiko Odaki @ 2023-12-16  7:53 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann, Paolo Bonzini,
	Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
	Laurent Vivier
  Cc: qemu-devel, Akihiko Odaki

Despite its name, dbus-display1 does not only provide DBus interfaces
for the display but also for the audio.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 MAINTAINERS                               |  1 +
 meson.build                               | 21 +++++++++++++++++++++
 ui/dbus.h                                 |  2 +-
 audio/dbusaudio.c                         |  2 +-
 tests/qtest/dbus-display-test.c           |  2 +-
 ui/dbus-display1.xml => dbus-display1.xml |  0
 ui/meson.build                            | 18 ------------------
 7 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 695e0bd34fbb..0c2630d0e264 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3389,6 +3389,7 @@ F: docs/sphinx/dbus*
 F: docs/sphinx/fakedbusdoc.py
 F: tests/qtest/dbus*
 F: scripts/xml-preprocess*
+F: dbus-display.xml
 
 Seccomp
 M: Daniel P. Berrange <berrange@redhat.com>
diff --git a/meson.build b/meson.build
index ec01f8b138aa..5e1b25a47184 100644
--- a/meson.build
+++ b/meson.build
@@ -2014,6 +2014,27 @@ dbus_display = get_option('dbus_display') \
            error_message: gdbus_codegen_error.format('-display dbus')) \
   .allowed()
 
+if dbus_display
+  env = environment()
+  env.set('TARGETOS', targetos)
+  xml = custom_target('dbus-display preprocess',
+                      input: 'dbus-display1.xml',
+                      output: 'dbus-display1.xml',
+                      env: env,
+                      command: [xml_pp, '@INPUT@', '@OUTPUT@'])
+  dbus_display1 = custom_target('dbus-display gdbus-codegen',
+                                output: ['dbus-display1.h', 'dbus-display1.c'],
+                                input: xml,
+                                command: [gdbus_codegen, '@INPUT@',
+                                          '--glib-min-required', '2.64',
+                                          '--output-directory', meson.current_build_dir(),
+                                          '--interface-prefix', 'org.qemu.',
+                                          '--c-namespace', 'QemuDBus',
+                                          '--generate-c-code', '@BASENAME@'])
+  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
+  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
+endif
+
 have_virtfs = get_option('virtfs') \
     .require(targetos == 'linux' or targetos == 'darwin',
              error_message: 'virtio-9p (virtfs) requires Linux or macOS') \
diff --git a/ui/dbus.h b/ui/dbus.h
index 1e8c24a48e32..ba9bab9f84d9 100644
--- a/ui/dbus.h
+++ b/ui/dbus.h
@@ -31,7 +31,7 @@
 #include "ui/console.h"
 #include "ui/clipboard.h"
 
-#include "ui/dbus-display1.h"
+#include "dbus-display1.h"
 
 typedef struct DBusClipboardRequest {
     GDBusMethodInvocation *invocation;
diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index 60fcf643ecf8..5222b3c68804 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -34,7 +34,7 @@
 #endif
 
 #include "ui/dbus.h"
-#include "ui/dbus-display1.h"
+#include "dbus-display1.h"
 
 #define AUDIO_CAP "dbus"
 #include "audio.h"
diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c
index 21edaa1e321f..a15e9c377b08 100644
--- a/tests/qtest/dbus-display-test.c
+++ b/tests/qtest/dbus-display-test.c
@@ -5,7 +5,7 @@
 #include <gio/gio.h>
 #include <gio/gunixfdlist.h>
 #include "libqtest.h"
-#include "ui/dbus-display1.h"
+#include "dbus-display1.h"
 
 static GDBusConnection*
 test_dbus_p2p_from_fd(int fd)
diff --git a/ui/dbus-display1.xml b/dbus-display1.xml
similarity index 100%
rename from ui/dbus-display1.xml
rename to dbus-display1.xml
diff --git a/ui/meson.build b/ui/meson.build
index 0ccb3387ee6a..bbb7c5242d55 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -75,24 +75,6 @@ endif
 
 if dbus_display
   dbus_ss = ss.source_set()
-  env = environment()
-  env.set('TARGETOS', targetos)
-  xml = custom_target('dbus-display preprocess',
-                      input: 'dbus-display1.xml',
-                      output: 'dbus-display1.xml',
-                      env: env,
-                      command: [xml_pp, '@INPUT@', '@OUTPUT@'])
-  dbus_display1 = custom_target('dbus-display gdbus-codegen',
-                                output: ['dbus-display1.h', 'dbus-display1.c'],
-                                input: xml,
-                                command: [gdbus_codegen, '@INPUT@',
-                                          '--glib-min-required', '2.64',
-                                          '--output-directory', meson.current_build_dir(),
-                                          '--interface-prefix', 'org.qemu.',
-                                          '--c-namespace', 'QemuDBus',
-                                          '--generate-c-code', '@BASENAME@'])
-  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
-  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
   dbus_ss.add(when: [gio, dbus_display1_dep],
               if_true: [files(
                 'dbus-chardev.c',

-- 
2.43.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/3] meson: Add dbus_display1 to util_ss and genh
  2023-12-16  7:53 [PATCH v3 0/3] meson: Fixes for dbus modules Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 1/3] Move dbus-display1 out of ui Akihiko Odaki
@ 2023-12-16  7:53 ` Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 3/3] audio: Do not include ui/dbus.h Akihiko Odaki
  2 siblings, 0 replies; 6+ messages in thread
From: Akihiko Odaki @ 2023-12-16  7:53 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann, Paolo Bonzini,
	Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
	Laurent Vivier
  Cc: qemu-devel, Akihiko Odaki

Adding dbus_display1 to util_ss ensures that the source will be linked
with audio/dbus. It also avoids recompilation when linking with
dbus-display-test.

Adding dbus_display1 to genh ensures that dbus-display1.h is generated
before compiling ui/dbus, audio/dbus, and dbus-display-test.

Both changes combined, it is no longer necessary for ui/dbus, audio/dbus,
and dbus-display-test to explicitly state the dependency on
dbus_display1.

Fixes: 142ca628a733 ("ui: add a D-Bus display backend")
Fixes: 739362d4205c ("audio: add "dbus" audio backend")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 meson.build             | 6 ++++--
 tests/qtest/meson.build | 2 +-
 ui/meson.build          | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 5e1b25a47184..c5808d410361 100644
--- a/meson.build
+++ b/meson.build
@@ -2014,6 +2014,7 @@ dbus_display = get_option('dbus_display') \
            error_message: gdbus_codegen_error.format('-display dbus')) \
   .allowed()
 
+dbus_display1_ss = ss.source_set()
 if dbus_display
   env = environment()
   env.set('TARGETOS', targetos)
@@ -2031,8 +2032,8 @@ if dbus_display
                                           '--interface-prefix', 'org.qemu.',
                                           '--c-namespace', 'QemuDBus',
                                           '--generate-c-code', '@BASENAME@'])
-  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
-  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
+  dbus_display1_ss.add(dbus_display1)
+  genh += dbus_display1[0]
 endif
 
 have_virtfs = get_option('virtfs') \
@@ -3433,6 +3434,7 @@ event_loop_base = declare_dependency(link_whole: event_loop_base,
 
 stub_ss = stub_ss.apply(config_all, strict: false)
 
+util_ss.add_all(dbus_display1_ss)
 util_ss.add_all(trace_ss)
 util_ss = util_ss.apply(config_all, strict: false)
 libqemuutil = static_library('qemuutil',
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 47dabf91d048..225cd35e4664 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -332,7 +332,7 @@ if vnc.found()
 endif
 
 if dbus_display
-  qtests += {'dbus-display-test': [dbus_display1, gio]}
+  qtests += {'dbus-display-test': [gio]}
 endif
 
 qtest_executables = {}
diff --git a/ui/meson.build b/ui/meson.build
index bbb7c5242d55..21d1d3b27f29 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -75,7 +75,7 @@ endif
 
 if dbus_display
   dbus_ss = ss.source_set()
-  dbus_ss.add(when: [gio, dbus_display1_dep],
+  dbus_ss.add(when: [gio],
               if_true: [files(
                 'dbus-chardev.c',
                 'dbus-clipboard.c',

-- 
2.43.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 3/3] audio: Do not include ui/dbus.h
  2023-12-16  7:53 [PATCH v3 0/3] meson: Fixes for dbus modules Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 1/3] Move dbus-display1 out of ui Akihiko Odaki
  2023-12-16  7:53 ` [PATCH v3 2/3] meson: Add dbus_display1 to util_ss and genh Akihiko Odaki
@ 2023-12-16  7:53 ` Akihiko Odaki
  2 siblings, 0 replies; 6+ messages in thread
From: Akihiko Odaki @ 2023-12-16  7:53 UTC (permalink / raw)
  To: Marc-André Lureau, Gerd Hoffmann, Paolo Bonzini,
	Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
	Laurent Vivier
  Cc: qemu-devel, Akihiko Odaki

ui/dbusaudio.c does not depend on ui/dbus.h

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 audio/dbusaudio.c | 1 -
 audio/meson.build | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index 5222b3c68804..f6cdcec80aaa 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -33,7 +33,6 @@
 #include <gio/gunixfdlist.h>
 #endif
 
-#include "ui/dbus.h"
 #include "dbus-display1.h"
 
 #define AUDIO_CAP "dbus"
diff --git a/audio/meson.build b/audio/meson.build
index c8f658611f42..8931c1697b4d 100644
--- a/audio/meson.build
+++ b/audio/meson.build
@@ -30,7 +30,7 @@ endforeach
 
 if dbus_display
     module_ss = ss.source_set()
-    module_ss.add(when: [gio, pixman], if_true: files('dbusaudio.c'))
+    module_ss.add(when: [gio], if_true: files('dbusaudio.c'))
     audio_modules += {'dbus': module_ss}
 endif
 

-- 
2.43.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/3] Move dbus-display1 out of ui
  2023-12-16  7:53 ` [PATCH v3 1/3] Move dbus-display1 out of ui Akihiko Odaki
@ 2023-12-16 16:57   ` Philippe Mathieu-Daudé
  2023-12-17  6:14     ` Akihiko Odaki
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-16 16:57 UTC (permalink / raw)
  To: Akihiko Odaki, Marc-André Lureau, Gerd Hoffmann,
	Paolo Bonzini, Daniel P. Berrangé, Thomas Huth,
	Laurent Vivier
  Cc: qemu-devel

On 16/12/23 08:53, Akihiko Odaki wrote:
> Despite its name, dbus-display1 does not only provide DBus interfaces
> for the display but also for the audio.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   MAINTAINERS                               |  1 +
>   meson.build                               | 21 +++++++++++++++++++++
>   ui/dbus.h                                 |  2 +-
>   audio/dbusaudio.c                         |  2 +-
>   tests/qtest/dbus-display-test.c           |  2 +-
>   ui/dbus-display1.xml => dbus-display1.xml |  0

What about moving it to backends/ instead? Also could be renamed.
"ui" means User Interface. Audio is still one. Suggestions:

  ui/dbus-backend, backends/dbus-... ?

>   ui/meson.build                            | 18 ------------------
>   7 files changed, 25 insertions(+), 21 deletions(-)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/3] Move dbus-display1 out of ui
  2023-12-16 16:57   ` Philippe Mathieu-Daudé
@ 2023-12-17  6:14     ` Akihiko Odaki
  0 siblings, 0 replies; 6+ messages in thread
From: Akihiko Odaki @ 2023-12-17  6:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Marc-André Lureau,
	Gerd Hoffmann, Paolo Bonzini, Daniel P. Berrangé,
	Thomas Huth, Laurent Vivier
  Cc: qemu-devel

On 2023/12/17 1:57, Philippe Mathieu-Daudé wrote:
> On 16/12/23 08:53, Akihiko Odaki wrote:
>> Despite its name, dbus-display1 does not only provide DBus interfaces
>> for the display but also for the audio.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   MAINTAINERS                               |  1 +
>>   meson.build                               | 21 +++++++++++++++++++++
>>   ui/dbus.h                                 |  2 +-
>>   audio/dbusaudio.c                         |  2 +-
>>   tests/qtest/dbus-display-test.c           |  2 +-
>>   ui/dbus-display1.xml => dbus-display1.xml |  0
> 
> What about moving it to backends/ instead? Also could be renamed.
> "ui" means User Interface. Audio is still one. Suggestions:
> 
>   ui/dbus-backend, backends/dbus-... ?

Moved to util with v4 as I'm adding it to libqemuutil for 
dbus-display-test. (And I sent v5 since I missed to update the 
documentation; sorry for sending changes so frequently.)

The file name represents the D-Bus interface name, and renaming the 
D-Bus interface name will be a breaking change so I decided not to do 
that for now.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-17  6:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-16  7:53 [PATCH v3 0/3] meson: Fixes for dbus modules Akihiko Odaki
2023-12-16  7:53 ` [PATCH v3 1/3] Move dbus-display1 out of ui Akihiko Odaki
2023-12-16 16:57   ` Philippe Mathieu-Daudé
2023-12-17  6:14     ` Akihiko Odaki
2023-12-16  7:53 ` [PATCH v3 2/3] meson: Add dbus_display1 to util_ss and genh Akihiko Odaki
2023-12-16  7:53 ` [PATCH v3 3/3] audio: Do not include ui/dbus.h Akihiko Odaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).