mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Meson: Override every dependency glib provides
Meson 0.54.0 added a new method meson.override_dependency() that must be used to ensure dependency consistency. This patch ensures a project that depends on glib will never link to a mix of system and subproject libraries. It would happen in such cases: The system has glib 2.40 installed, and a project does: dependency('glib-2.0', version: '>=2.60', fallback: ['glib', 'glib_dep']) dependency('gobject-2.0') The first call will configure glib subproject because the system libglib is too old, but the 2nd call will return system libgobject. By overriding 'gobject-2.0' dependency while configuring glib subproject during the first call, meson knows that on the 2nd call it must return the subproject dependency instead of system dependency. This also has the nice side effect that with Meson >0.54.0 an application depending on glib can declare the fallback without knowing the dependency variable name: dependency('glib-2.0', fallback: 'glib').
This commit is contained in:
parent
1a3a1865eb
commit
10280deebd
@ -813,6 +813,10 @@ endif
|
||||
|
||||
schemas_subdir = join_paths('glib-2.0', 'schemas')
|
||||
|
||||
libgio_dep = declare_dependency(link_with : libgio,
|
||||
dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
|
||||
include_directories : [gioinc])
|
||||
|
||||
pkg.generate(libgio,
|
||||
libraries_private : [osx_ldflags],
|
||||
requires : ['glib-2.0', 'gobject-2.0'],
|
||||
@ -835,6 +839,11 @@ pkg.generate(libgio,
|
||||
description : 'glib I/O library',
|
||||
)
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gio-2.0', libgio_dep)
|
||||
endif
|
||||
|
||||
|
||||
if host_system == 'windows'
|
||||
pkg.generate(requires : ['gobject-2.0', 'gmodule-no-export-2.0', 'gio-2.0'],
|
||||
subdirs : ['gio-win32-2.0'],
|
||||
@ -844,6 +853,9 @@ if host_system == 'windows'
|
||||
name : 'GIO Windows specific APIs',
|
||||
description : 'Windows specific headers for glib I/O library',
|
||||
)
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gio-win32-2.0', libgio_dep)
|
||||
endif
|
||||
else
|
||||
pkg.generate(requires : ['gobject-2.0', 'gio-2.0'],
|
||||
subdirs : ['gio-unix-2.0'],
|
||||
@ -853,12 +865,11 @@ else
|
||||
name : 'GIO unix specific APIs',
|
||||
description : 'unix specific headers for glib I/O library',
|
||||
)
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gio-unix-2.0', libgio_dep)
|
||||
endif
|
||||
endif
|
||||
|
||||
libgio_dep = declare_dependency(link_with : libgio,
|
||||
dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
|
||||
include_directories : [gioinc])
|
||||
|
||||
if host_system == 'windows'
|
||||
# Hack till https://github.com/mesonbuild/meson/issues/2324 is fixed
|
||||
libgiounix_dep = dependency('', required : false)
|
||||
|
@ -385,6 +385,10 @@ pkg.generate(libglib,
|
||||
description : 'C Utility Library',
|
||||
)
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('glib-2.0', libglib_dep)
|
||||
endif
|
||||
|
||||
# On Windows, glib needs a spawn helper for g_spawn* API
|
||||
if host_system == 'windows'
|
||||
if host_machine.cpu_family() == 'x86'
|
||||
|
@ -120,3 +120,9 @@ pkg.generate(libraries : [libgmodule, export_dynamic_ldflags],
|
||||
libgmodule_dep = declare_dependency(link_with : libgmodule,
|
||||
include_directories : [gmoduleinc],
|
||||
dependencies : [libglib_dep])
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gmodule-no-export-2.0', libgmodule_dep)
|
||||
meson.override_dependency('gmodule-export-2.0', libgmodule_dep)
|
||||
meson.override_dependency('gmodule-2.0', libgmodule_dep)
|
||||
endif
|
||||
|
@ -143,6 +143,10 @@ libgobject_dep = declare_dependency(link_with : libgobject,
|
||||
include_directories : [gobjectinc],
|
||||
dependencies : [libglib_dep, glib_enumtypes_dep])
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gobject-2.0', libgobject_dep)
|
||||
endif
|
||||
|
||||
executable('gobject-query', 'gobject-query.c',
|
||||
install : true,
|
||||
dependencies : [libglib_dep, libgobject_dep])
|
||||
|
@ -34,3 +34,7 @@ pkg.generate(libgthread,
|
||||
)
|
||||
|
||||
libgthread_dep = declare_dependency(link_with : libgthread)
|
||||
|
||||
if meson.version().version_compare('>=0.54.0')
|
||||
meson.override_dependency('gthread-2.0', libgthread_dep)
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user