Meson: Extract objects from convenience libraries to link them

This avoids the convenience library being treated as though it was
an installed static library (objects not included in the dependent
static library, and convenience library being listed in the pkg-config
metadata), both of which would make static linking impossible.
This is a workaround for meson not having
https://github.com/mesonbuild/meson/pull/3939 merged yet.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1536
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2018-09-25 08:58:25 +01:00
parent b71d7e4b33
commit 62af03bda8
2 changed files with 29 additions and 3 deletions

View File

@@ -351,6 +351,12 @@ local_sources = files(
platform_deps = []
internal_deps = []
# TODO: internal_objects is a workaround for
# <https://github.com/mesonbuild/meson/issues/3934> and
# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
# on a meson version where those are fixed, revert the commit that
# introduced this workaround.
internal_objects = []
appinfo_sources = []
contenttype_sources = []
portal_sources = []
@@ -424,6 +430,7 @@ if host_system != 'windows'
subdir('xdgmime')
internal_deps += [xdgmime_lib]
internal_objects += [xdgmime_lib.extract_all_objects()]
install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
@@ -749,17 +756,20 @@ gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
subdir('inotify')
internal_deps += [ inotify_lib ]
internal_objects += [inotify_lib.extract_all_objects()]
endif
# kevent
if have_func_kqueue and have_func_kevent
subdir('kqueue')
internal_deps += [ kqueue_lib ]
internal_objects += [kqueue_lib.extract_all_objects()]
endif
if host_system == 'windows'
subdir('win32')
internal_deps += [ giowin32_lib ]
internal_objects += [giowin32_lib.extract_all_objects()]
endif
if have_bash
@@ -784,11 +794,11 @@ endif
libgio = library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
gio_dtrace_hdr, gio_dtrace_obj,
objects : internal_objects,
version : library_version,
soversion : soversion,
install : true,
include_directories : [configinc, gioinc],
link_with : internal_deps,
# '$(gio_win32_res_ldflag)',
dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,