From 172727599005c8c0ded5754a6916e901b7ef452e Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Mon, 17 Dec 2018 13:03:24 +0100 Subject: [PATCH] meson: Fix build with fallback glib When building libnice with glib fallback, its 'libgio_dep' internal dependency doesn't provide all needed include and library search paths. To avoid unresolved header files and linker errors in such case, 'libglib_dep', 'libmodule_dep' and 'libgobject_dep' from glib submodule must be pulled in as well. The problem should be fixed in GLib 2.60. --- examples/meson.build | 2 +- meson.build | 14 ++++++++++++-- nice/meson.build | 2 +- random/meson.build | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index f183b03..e0d0a00 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -3,6 +3,6 @@ examples = ['simple-example', 'threaded-example', 'sdp-example'] foreach ex : examples executable(ex, '@0@.c'.format(ex), include_directories: nice_incs, - dependencies: [libnice_dep, glib_dep, gupnp_igd_dep], + dependencies: gio_deps + [libnice_dep, gupnp_igd_dep], install: false) endforeach diff --git a/meson.build b/meson.build index 70c5b50..39afcfa 100644 --- a/meson.build +++ b/meson.build @@ -163,8 +163,18 @@ foreach w : warnings endforeach # Dependencies -glib_dep = dependency('gio-2.0', version: glib_req, +gio_dep = dependency('gio-2.0', version: glib_req, fallback: ['glib', 'libgio_dep']) +gio_deps = [gio_dep] +if gio_dep.type_name() == 'internal' + # A workaround for libgio_dep not having its dependencies correctly declared. + # Should be fixed in GLib 2.60. + gio_deps += [ + dependency('', fallback: ['glib', 'libglib_dep']), + dependency('', fallback: ['glib', 'libgmodule_dep']), + dependency('', fallback: ['glib', 'libgobject_dep']) + ] +endif gthread_dep = dependency('gthread-2.0', fallback: ['glib', 'libgthread_dep']) @@ -212,7 +222,7 @@ libm = cc.find_library('m', required: false) nice_incs = include_directories('.', 'agent', 'random', 'socket', 'stun') -nice_deps = [glib_dep, gthread_dep, crypto_dep, gupnp_igd_dep] + syslibs +nice_deps = gio_deps + [gthread_dep, crypto_dep, gupnp_igd_dep] + syslibs ignored_iface_prefix = get_option('ignored-network-interface-prefix') if ignored_iface_prefix != '' diff --git a/nice/meson.build b/nice/meson.build index dbeca64..01a6da0 100644 --- a/nice/meson.build +++ b/nice/meson.build @@ -62,7 +62,7 @@ pkg.generate(libnice, filebase: 'nice', subdirs: 'nice', description: 'ICE library', - requires: glib_dep, + requires: gio_dep, requires_private: [gthread_dep, gupnp_igd_dep, crypto_dep], libraries_private: syslibs, variables: ['upnp_enabled=@0@'.format(upnp_enabled_string)]) diff --git a/random/meson.build b/random/meson.build index 14eaaff..e3c3fa3 100644 --- a/random/meson.build +++ b/random/meson.build @@ -2,13 +2,13 @@ librandom = static_library('nice-random', 'random.c', 'random-glib.c', c_args: ['-DG_LOG_DOMAIN="libnice-random"'], include_directories: nice_incs, - dependencies: [glib_dep, gthread_dep], + dependencies: gio_deps + [gthread_dep], install: false) if not get_option('tests').disabled() test_exe = executable('nice-random-test', 'test.c', include_directories: nice_incs, - dependencies: [glib_dep, gthread_dep], + dependencies: gio_deps + [gthread_dep], link_with: librandom) test('nice-random', test_exe) -- 2.7.4