!4 build: don't set glib version constraints for g-ir-scanner
From: @yezengruan Reviewed-by: @kevinzhu1 Signed-off-by: @kevinzhu1
This commit is contained in:
commit
4be5b6f1a3
139
build-don-t-set-glib-version-constraints-for-g-ir-sc.patch
Normal file
139
build-don-t-set-glib-version-constraints-for-g-ir-sc.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
From 9a34c4ea55e0246c34896e48b8ecd637bc559ac7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||||
|
Date: Mon, 27 Sep 2021 14:58:17 +0100
|
||||||
|
Subject: [PATCH] build: don't set glib version constraints for g-ir-scanner
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
add_global_arguments() sets flags that apply to all invokations of the C
|
||||||
|
compiler toolchain by meson. On the surface it sounds fine to use this
|
||||||
|
for setting
|
||||||
|
|
||||||
|
-DGLIB_VERSION_MIN_REQUIRED=VER
|
||||||
|
-DGLIB_VERSION_MAX_ALLOWED=VER
|
||||||
|
|
||||||
|
as we want all our code to be constrained by these declared glib
|
||||||
|
versions to prevent us accidentally using APIS from newer glib by
|
||||||
|
mistake.
|
||||||
|
|
||||||
|
A subtle problem was revealed with the arrival of gobject-introspection
|
||||||
|
version 1.70. The g-ir-scanner program auto-generates some glib code
|
||||||
|
for handling introspection, and this generated code uses glib APIs that
|
||||||
|
are newer than our declared version and this triggers compile failures
|
||||||
|
|
||||||
|
/root/rpmbuild/BUILD/libvirt-glib-4.0.0/redhat-linux-build/tmp-introspectkrq1wuz9/LibvirtGLib-1.0.c:251:3: error: ‘G_TYPE_FLAG_FINAL’ is deprecated: Not available before 2.70 [-Werror=deprecated-declarations]
|
||||||
|
251 | if (G_TYPE_IS_FINAL (type))
|
||||||
|
| ^~
|
||||||
|
In file included from /usr/include/glib-2.0/gobject/gobject.h:24,
|
||||||
|
from /usr/include/glib-2.0/gobject/gbinding.h:29,
|
||||||
|
from /usr/include/glib-2.0/glib-object.h:22,
|
||||||
|
from /root/rpmbuild/BUILD/libvirt-glib-4.0.0/redhat-linux-build/tmp-introspectkrq1wuz9/LibvirtGLib-1.0.c:30:
|
||||||
|
|
||||||
|
This is actually harmless, because systems with an older glib will also
|
||||||
|
have older g-ir-scanner and thus not be using these new APIs.
|
||||||
|
|
||||||
|
We need to exclude the glib version constraints from code generated by
|
||||||
|
glib tools, and thus means we have to stop using add_global_arguments()
|
||||||
|
and set cflags explicitly on each target.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
---
|
||||||
|
examples/meson.build | 2 ++
|
||||||
|
libvirt-gconfig/tests/meson.build | 3 +++
|
||||||
|
meson.build | 5 ++---
|
||||||
|
tests/meson.build | 2 ++
|
||||||
|
4 files changed, 9 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/examples/meson.build b/examples/meson.build
|
||||||
|
index 221356b..c1779e3 100644
|
||||||
|
--- a/examples/meson.build
|
||||||
|
+++ b/examples/meson.build
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
executable(
|
||||||
|
'event-test',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['event-test.c'],
|
||||||
|
dependencies: libvirt_glib_dep,
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
@@ -7,6 +8,7 @@ executable(
|
||||||
|
|
||||||
|
executable(
|
||||||
|
'conn-test',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['conn-test.c'],
|
||||||
|
dependencies: [libvirt_glib_dep, libvirt_gconfig_dep, libvirt_gobject_dep],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
diff --git a/libvirt-gconfig/tests/meson.build b/libvirt-gconfig/tests/meson.build
|
||||||
|
index 7d85f03..2a1b252 100644
|
||||||
|
--- a/libvirt-gconfig/tests/meson.build
|
||||||
|
+++ b/libvirt-gconfig/tests/meson.build
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
test_domain_create = executable(
|
||||||
|
'test-domain-create',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['test-domain-create.c'],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
dependencies: [libvirt_gconfig_dep]
|
||||||
|
@@ -7,6 +8,7 @@ test_domain_create = executable(
|
||||||
|
|
||||||
|
test_domain_parse = executable(
|
||||||
|
'test-domain-parse',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['test-domain-parse.c'],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
dependencies: [libvirt_gconfig_dep]
|
||||||
|
@@ -14,6 +16,7 @@ test_domain_parse = executable(
|
||||||
|
|
||||||
|
test_capabilities_parse = executable(
|
||||||
|
'test-capabilities-parse',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['test-capabilities-parse.c'],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
dependencies: [libvirt_gconfig_dep]
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index c4e69dd..eb1f313 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -50,9 +50,6 @@ libvirt_dep = dependency('libvirt', version: '>=' + libvirt_version)
|
||||||
|
libxml_min_version='>=2.9.1'
|
||||||
|
libxml_dep = dependency('libxml-2.0', version: libxml_min_version)
|
||||||
|
|
||||||
|
-add_global_arguments('-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_symbol), language: 'c')
|
||||||
|
-add_global_arguments('-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_symbol), language: 'c')
|
||||||
|
-
|
||||||
|
prefix = get_option('prefix')
|
||||||
|
localedir = join_paths(prefix, get_option('localedir'))
|
||||||
|
datadir = join_paths(prefix, get_option('datadir'))
|
||||||
|
@@ -520,6 +517,8 @@ common_cflags = [
|
||||||
|
'-DLOCALEDIR="@0@"'.format(localedir),
|
||||||
|
'-DDATADIR="@0@"'.format(datadir),
|
||||||
|
'-DLIBVIRT_GLIB_BUILD',
|
||||||
|
+ '-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_symbol),
|
||||||
|
+ '-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_symbol),
|
||||||
|
]
|
||||||
|
|
||||||
|
gnome = import('gnome')
|
||||||
|
diff --git a/tests/meson.build b/tests/meson.build
|
||||||
|
index df55930..444645f 100644
|
||||||
|
--- a/tests/meson.build
|
||||||
|
+++ b/tests/meson.build
|
||||||
|
@@ -4,6 +4,7 @@ testenv.append('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||||
|
|
||||||
|
test_gconfig = executable(
|
||||||
|
'test-gconfig',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['test-gconfig.c'],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
dependencies: [libvirt_gconfig_dep]
|
||||||
|
@@ -12,6 +13,7 @@ test('gconfig', test_gconfig, env: testenv)
|
||||||
|
|
||||||
|
test_events = executable(
|
||||||
|
'test-events',
|
||||||
|
+ c_args: common_cflags,
|
||||||
|
sources: ['test-events.c'],
|
||||||
|
include_directories: top_include_dir,
|
||||||
|
dependencies: [libvirt_glib_dep]
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,13 +1,14 @@
|
|||||||
Name: libvirt-glib
|
Name: libvirt-glib
|
||||||
Version: 4.0.0
|
Version: 4.0.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: libvirt glib integration for events
|
Summary: libvirt glib integration for events
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://libvirt.org/
|
URL: http://libvirt.org/
|
||||||
Source0: https://libvirt.org/sources/glib/%{name}-%{version}.tar.xz
|
Source0: https://libvirt.org/sources/glib/%{name}-%{version}.tar.xz
|
||||||
BuildRequires: glib2-devel >= 2.48.0 libvirt-devel >= 1.2.8 gobject-introspection-devel
|
BuildRequires: glib2-devel >= 2.48.0 libvirt-devel >= 1.2.8 gobject-introspection-devel
|
||||||
BuildRequires: libxml2-devel >= 2.9.1 vala gettext gtk-doc meson
|
BuildRequires: libxml2-devel >= 2.9.1 vala gettext gtk-doc meson
|
||||||
Patch0: libvirt-glib-4.0.0-cast-align.patch
|
Patch00: libvirt-glib-4.0.0-cast-align.patch
|
||||||
|
Patch01: build-don-t-set-glib-version-constraints-for-g-ir-sc.patch
|
||||||
|
|
||||||
Provides: libvirt-gconfig libvirt-gobject
|
Provides: libvirt-gconfig libvirt-gobject
|
||||||
Obsoletes: libvirt-gconfig libvirt-gobject
|
Obsoletes: libvirt-gconfig libvirt-gobject
|
||||||
@ -63,6 +64,9 @@ This package provides development header files and libraries for integration bet
|
|||||||
%{_datadir}/vala/vapi/libvirt-g*
|
%{_datadir}/vala/vapi/libvirt-g*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 13 2022 yezengruan <yezengruan@huawei.com> - 4.0.0-2
|
||||||
|
- build: don't set glib version constraints for g-ir-scanner
|
||||||
|
|
||||||
* Wed Jun 30 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 4.0.0-1
|
* Wed Jun 30 2021 weijin deng <weijin.deng@turbolinux.com.cn> - 4.0.0-1
|
||||||
- Upgrade to 4.0.0
|
- Upgrade to 4.0.0
|
||||||
- Use meson rebuild
|
- Use meson rebuild
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user