mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-08 10:26:16 +01:00
10280deebd
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').
175 lines
4.6 KiB
Meson
175 lines
4.6 KiB
Meson
gobject_install_headers = files(
|
|
'gobject-autocleanups.h',
|
|
'glib-types.h',
|
|
'gbinding.h',
|
|
'gboxed.h',
|
|
'gclosure.h',
|
|
'genums.h',
|
|
'gmarshal.h',
|
|
'gobject.h',
|
|
'gparam.h',
|
|
'gparamspecs.h',
|
|
'gsignal.h',
|
|
'gsourceclosure.h',
|
|
'gtype.h',
|
|
'gtypemodule.h',
|
|
'gtypeplugin.h',
|
|
'gvalue.h',
|
|
'gvaluearray.h',
|
|
'gvaluecollector.h',
|
|
'gvaluetypes.h',
|
|
'gobjectnotifyqueue.c', # sic
|
|
)
|
|
install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject')
|
|
|
|
gobject_sources = files(
|
|
'gatomicarray.c',
|
|
'gbinding.c',
|
|
'gboxed.c',
|
|
'gclosure.c',
|
|
'genums.c',
|
|
'gmarshal.c',
|
|
'gobject.c',
|
|
'gparam.c',
|
|
'gparamspecs.c',
|
|
'gsignal.c',
|
|
'gsourceclosure.c',
|
|
'gtype.c',
|
|
'gtypemodule.c',
|
|
'gtypeplugin.c',
|
|
'gvalue.c',
|
|
'gvaluearray.c',
|
|
'gvaluetransform.c',
|
|
'gvaluetypes.c',
|
|
)
|
|
|
|
if host_system == 'windows'
|
|
gobject_win_rc = configure_file(
|
|
input: 'gobject.rc.in',
|
|
output: 'gobject.rc',
|
|
configuration: glibconfig_conf,
|
|
)
|
|
gobject_win_res = windows.compile_resources(gobject_win_rc)
|
|
gobject_sources += [gobject_win_res]
|
|
endif
|
|
|
|
if enable_dtrace
|
|
gobject_dtrace_obj = dtrace_obj_gen.process('gobject_probes.d')
|
|
gobject_dtrace_hdr = dtrace_hdr_gen.process('gobject_probes.d')
|
|
else
|
|
gobject_dtrace_obj = []
|
|
gobject_dtrace_hdr = []
|
|
endif
|
|
|
|
python_tools = [
|
|
'glib-genmarshal',
|
|
'glib-mkenums',
|
|
]
|
|
|
|
python_tools_conf = configuration_data()
|
|
python_tools_conf.set('VERSION', glib_version)
|
|
python_tools_conf.set('PYTHON', python_name)
|
|
|
|
foreach tool: python_tools
|
|
tool_bin = configure_file(
|
|
input : tool + '.in',
|
|
output : tool,
|
|
configuration : python_tools_conf,
|
|
install_dir : glib_bindir,
|
|
)
|
|
|
|
# Set variables for later use
|
|
set_variable(tool.underscorify(), tool_bin)
|
|
# Provide tools for others when we're a subproject and they use the Meson GNOME module
|
|
meson.override_find_program(tool, tool_bin)
|
|
endforeach
|
|
|
|
# Generate a header file containing the GObject enum types for the enums defined
|
|
# in libglib.
|
|
#
|
|
# For now, we only include gunicode.h here, since GScriptType is needed for
|
|
# Pango. More headers can be added as needed in future.
|
|
#
|
|
# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
|
|
# in PATH, which means you can't bootstrap glib with its own glib-mkenums.
|
|
glib_enumtypes_input_headers = files(
|
|
'../glib/gunicode.h',
|
|
)
|
|
|
|
glib_enumtypes_h = custom_target('glib_enumtypes_h',
|
|
output : 'glib-enumtypes.h',
|
|
capture : true,
|
|
input : glib_enumtypes_input_headers,
|
|
install : true,
|
|
install_dir : join_paths(get_option('includedir'), 'glib-2.0/gobject'),
|
|
command : [python, glib_mkenums,
|
|
'--template', files('glib-enumtypes.h.template'),
|
|
'@INPUT@'])
|
|
|
|
glib_enumtypes_c = custom_target('glib_enumtypes_c',
|
|
output : 'glib-enumtypes.c',
|
|
capture : true,
|
|
input : glib_enumtypes_input_headers,
|
|
depends : [glib_enumtypes_h],
|
|
command : [python, glib_mkenums,
|
|
'--template', files('glib-enumtypes.c.template'),
|
|
'@INPUT@'])
|
|
|
|
glib_enumtypes_dep = declare_dependency(sources : [glib_enumtypes_h])
|
|
|
|
libgobject = library('gobject-2.0',
|
|
gobject_dtrace_obj, gobject_dtrace_hdr, glib_enumtypes_h, glib_enumtypes_c,
|
|
sources : gobject_sources,
|
|
version : library_version,
|
|
soversion : soversion,
|
|
darwin_versions : darwin_versions,
|
|
install : true,
|
|
include_directories : [configinc],
|
|
dependencies : [libffi_dep, libglib_dep],
|
|
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args,
|
|
link_args : glib_link_flags,
|
|
)
|
|
|
|
pkg.generate(libgobject,
|
|
requires : ['glib-2.0'],
|
|
version : glib_version,
|
|
install_dir : glib_pkgconfigreldir,
|
|
filebase : 'gobject-2.0',
|
|
name : 'GObject',
|
|
description : 'GLib Type, Object, Parameter and Signal Library',
|
|
)
|
|
|
|
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])
|
|
|
|
install_data('gobject_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
|
|
gdb_conf = configuration_data()
|
|
gdb_conf.set('datadir', glib_datadir)
|
|
configure_file(
|
|
input: 'libgobject-gdb.py.in',
|
|
output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version),
|
|
configuration: gdb_conf,
|
|
install_dir: gdb_install_dir,
|
|
)
|
|
|
|
if enable_systemtap
|
|
gobject_stp = configure_file(input : 'gobject.stp.in',
|
|
output : '@0@.stp'.format(libgobject.full_path().split('/').get(-1)),
|
|
configuration : stp_cdata,
|
|
install_dir : tapset_install_dir,
|
|
)
|
|
endif
|
|
|
|
if build_tests
|
|
subdir('tests')
|
|
endif
|