[glib: 1/2] meson: fix warnings for extract_all_objects function




commit abb8e1c3a0fd86bc86bcc1f8e680e5ed4b9c9e5d
Author: Eli Schwartz <eschwartz archlinux org>
Date:   Wed Oct 6 16:56:54 2021 -0400

    meson: fix warnings for extract_all_objects function
    
    The "recursive:" kwarg is available in the targeted minimum version of
    meson, and is basically required if you want to not emit warnings and
    maybe error with --fatal-meson-warnings.
    
    There are two basic solutions to this problem:
    
    - The current default behavior is false, so explicitly opt in to that
      value. None of these internal libraries use recursive objects anyway.
    
    - Use link_with to link to the static library directly, rather than the
      extracted objects.
    
    Option 2 is what used to be done before commit
    62af03bda8a1d649b079a0e77d3687695d0ab7d3, but it only works with meson
    >=0.52 and previously had buggy behavior.
    
    Since the minimum version of meson is now 0.52, it is safe to revert
    that commit and go back to using link_with, and therefore option 2 is
    chosen.

 gio/meson.build  | 12 +-----------
 glib/meson.build |  9 +--------
 2 files changed, 2 insertions(+), 19 deletions(-)
---
diff --git a/gio/meson.build b/gio/meson.build
index ac3373f2b..29473d26b 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -341,12 +341,6 @@ 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 = []
@@ -419,7 +413,6 @@ 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')
 
@@ -758,20 +751,17 @@ gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h, glib_enumtypes_
 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
@@ -807,13 +797,13 @@ 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,
   darwin_versions : darwin_versions,
   install : true,
   include_directories : [configinc, gioinc],
   #  '$(gio_win32_res_ldflag)',
+  link_with: internal_deps,
   dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
                   libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
                   platform_deps, network_libs, libsysprof_capture_dep],
diff --git a/glib/meson.build b/glib/meson.build
index ba7929da4..f78f32969 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -20,14 +20,8 @@ libsysprof_capture_dep = dependency('sysprof-capture-4', version: '>= 3.38.0',
 )
 glib_conf.set('HAVE_SYSPROF', libsysprof_capture_dep.found())
 
-# TODO: gnulib_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.
 if use_system_printf
   gnulib_lib = []
-  gnulib_objects = []
   gnulib_libm_dependency = []
   glib_conf.set ('gl_unused', '')
   glib_conf.set ('gl_extern_inline', '')
@@ -117,7 +111,6 @@ else
   endif
 
   subdir('gnulib')
-  gnulib_objects = [gnulib_lib.extract_all_objects()]
 endif
 
 glib_headers = files(
@@ -359,7 +352,6 @@ glib_c_args = ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args
 libglib = library('glib-2.0',
   glib_dtrace_obj, glib_dtrace_hdr,
   sources : [deprecated_sources, glib_sources],
-  objects : [charset_lib.extract_all_objects()] + gnulib_objects,
   version : library_version,
   soversion : soversion,
   darwin_versions : darwin_versions,
@@ -367,6 +359,7 @@ libglib = library('glib-2.0',
   # intl.lib is not compatible with SAFESEH
   link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
   include_directories : configinc,
+  link_with: [charset_lib, gnulib_lib],
   dependencies : [pcre, thread_dep, librt] + libintl_deps + libiconv + platform_deps + 
[gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
   c_args : glib_c_args,
   objc_args : glib_c_args,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]