From 545b29e2bf35794ae7c31a9b769378af38a3ef2c Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 31 Aug 2023 11:47:29 +0200 Subject: [PATCH 1/2] build: Fix generating GIR We didn't pass the generated sources to GIR making some of the types unavailable --- lib/meson.build | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index c427407..a2e7f11 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -53,6 +53,8 @@ libmks_private_sources = [ ] libmks_enums = gnome.mkenums_simple('mks-enums', + body_prefix: '#include "config.h"', + decorator: '_MKS_EXTERN', sources: libmks_enum_headers, install_header: true, install_dir: libmks_headers_dir, @@ -151,9 +153,18 @@ pkg.generate( ) if get_option('introspection').allowed() + libmks_gir_extra_args = [ + '--c-include=libmks.h', + '--quiet', + '-DMKS_COMPILATION', + ] libmks_gir = gnome.generate_gir(libmks, - sources: libmks_sources + libmks_headers, + sources: libmks_sources + + libmks_headers + + libmks_generated_sources + + libmks_generated_headers, nsversion: api_version, + link_with: libmks, namespace: 'Mks', symbol_prefix: 'mks', identifier_prefix: 'Mks', @@ -161,7 +172,8 @@ if get_option('introspection').allowed() include_directories: libmks_include_directories, includes: ['Gio-2.0', 'Gtk-4.0'], install: true, - header: 'libmks-1.h' + header: 'libmks-1.h', + extra_args: libmks_gir_extra_args, ) if get_option('vapi') From 7598cb3eac5cbe9baedf9c5ea80c64cec201acf1 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 31 Aug 2023 12:17:35 +0200 Subject: [PATCH 2/2] build: Use manual registration for gresource As that is the recommendation for libraries having their own init function --- lib/meson.build | 1 + lib/mks-init.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index a2e7f11..a8cd16b 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -97,6 +97,7 @@ libmks_gresources = gnome.compile_resources( 'mks-resources', 'mks.gresource.xml', c_name: 'mks', + extra_args: [ '--manual-register', ], ) libmks_generated_sources = [ diff --git a/lib/mks-init.c b/lib/mks-init.c index cd0db47..7466a65 100644 --- a/lib/mks-init.c +++ b/lib/mks-init.c @@ -41,8 +41,6 @@ static void mks_init_gtypes (void) { - g_resources_register (mks_get_resource ()); - /* First register GTypes for QEMU IPC */ g_type_ensure (MKS_QEMU_TYPE_AUDIO); g_type_ensure (MKS_QEMU_TYPE_AUDIO_IN_LISTENER); @@ -83,6 +81,7 @@ mks_init (void) if (g_once_init_enter (&initialized)) { + mks_register_resource (); mks_init_gtypes (); g_once_init_leave (&initialized, TRUE); }