2d40367415
Signed-off-by: Cole Robinson <crobinso@redhat.com>
121 lines
4.2 KiB
Diff
121 lines
4.2 KiB
Diff
From d5807a0f458b310112c0794e7ea43ccd55a8bba5 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 15:21:52 +0100
|
||
Subject: [PATCH libosinfo] 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_project_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
|
||
|
||
tmp-introspectg6xadxkr/Libosinfo-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 tmp-introspectg6xadxkr/Libosinfo-1.0.c:30:
|
||
/usr/include/glib-2.0/gobject/gtype.h:1050:3: note: declared here
|
||
1050 | G_TYPE_FLAG_FINAL GLIB_AVAILABLE_ENUMERATOR_IN_2_70 = (1 << 6)
|
||
| ^~~~~~~~~~~~~~~~~
|
||
tmp-introspectg6xadxkr/Libosinfo-1.0.c:251:13: error: Not available before 2.70 [-Werror]
|
||
251 | if (G_TYPE_IS_FINAL (type))
|
||
| ^~~~~~~~~~~~~~~~~
|
||
|
||
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_project_arguments()
|
||
and set cflags explicitly on each target.
|
||
|
||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||
---
|
||
meson.build | 2 --
|
||
osinfo/meson.build | 1 +
|
||
tests/meson.build | 2 +-
|
||
tools/meson.build | 3 +++
|
||
4 files changed, 5 insertions(+), 3 deletions(-)
|
||
|
||
diff --git a/meson.build b/meson.build
|
||
index 0cbdb50..18dd26c 100644
|
||
--- a/meson.build
|
||
+++ b/meson.build
|
||
@@ -331,8 +331,6 @@ if usb_ids_path != ''
|
||
message('Location of usb.ids: "@0@"'.format(usb_ids_path))
|
||
endif
|
||
|
||
-add_project_arguments(libosinfo_cflags, language: 'c')
|
||
-
|
||
libosinfo_version = meson.project_version()
|
||
libosinfo_major_version = libosinfo_version.split('.')[0].to_int()
|
||
libosinfo_minor_version = libosinfo_version.split('.')[1].to_int()
|
||
diff --git a/osinfo/meson.build b/osinfo/meson.build
|
||
index d127143..cdd150a 100644
|
||
--- a/osinfo/meson.build
|
||
+++ b/osinfo/meson.build
|
||
@@ -149,6 +149,7 @@ libosinfo = library(
|
||
libosinfo_sources,
|
||
libosinfo_enum_types,
|
||
],
|
||
+ c_args: libosinfo_cflags,
|
||
dependencies: libosinfo_dependencies,
|
||
include_directories: libosinfo_include,
|
||
link_args: libosinfo_link_args,
|
||
diff --git a/tests/meson.build b/tests/meson.build
|
||
index 3e631dd..2716ef9 100644
|
||
--- a/tests/meson.build
|
||
+++ b/tests/meson.build
|
||
@@ -51,7 +51,7 @@ foreach src: tests_sources
|
||
exe = executable(name,
|
||
sources: src,
|
||
dependencies: libosinfo_dep,
|
||
- c_args: [
|
||
+ c_args: libosinfo_cflags + [
|
||
'-DSRCDIR="@0@"'.format(meson.source_root()),
|
||
'-DBUILDDIR="@0@"'.format(meson.build_root()),
|
||
],
|
||
diff --git a/tools/meson.build b/tools/meson.build
|
||
index 0a95664..248b1e9 100644
|
||
--- a/tools/meson.build
|
||
+++ b/tools/meson.build
|
||
@@ -1,6 +1,7 @@
|
||
# osinfo-detect
|
||
executable(
|
||
'osinfo-detect',
|
||
+ c_args: libosinfo_cflags,
|
||
sources: 'osinfo-detect.c',
|
||
dependencies: [
|
||
glib_dep,
|
||
@@ -15,6 +16,7 @@ executable(
|
||
# osinfo-install-script
|
||
executable(
|
||
'osinfo-install-script',
|
||
+ c_args: libosinfo_cflags,
|
||
sources: 'osinfo-install-script.c',
|
||
dependencies: [
|
||
glib_dep,
|
||
@@ -28,6 +30,7 @@ executable(
|
||
# osinfo-query
|
||
executable(
|
||
'osinfo-query',
|
||
+ c_args: libosinfo_cflags,
|
||
sources: 'osinfo-query.c',
|
||
dependencies: [
|
||
glib_dep,
|