build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags

Previously, `-Wl,--export-dynamic` was in `Libs` key of `gmodule-2.0.pc`,
even though `-Wl` is a compiler flag, rather than a linker one.
This caused issues with API reference builds in evolution-data-server,
which passes the output of `pkg-config --libs` through `--ldflags`
argument of `gtkdoc-scan`, which are forwarded unchanged to `ld`:

    ld: unrecognized option '-Wl,--export-dynamic'

Let’s move the flag to `Cflags` so that the compiler can deal with it.

https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/463
This commit is contained in:
Jan Tojnar 2023-03-31 20:17:56 +02:00
parent 7fec23ed5e
commit 004f48f4fc
3 changed files with 10 additions and 8 deletions

View File

@ -767,7 +767,7 @@ if not meson.is_cross_build()
resource_plugin += shared_module('resourceplugin',
sources: ['resourceplugin.c', plugin_resources_c],
link_args : export_dynamic_ldflags,
c_args : export_dynamic_cflags,
dependencies : common_gio_tests_deps,
install_dir : installed_tests_execdir,
install_tag : 'tests',

View File

@ -115,22 +115,24 @@ pkg.generate(libgmodule,
description : 'Dynamic module loader for GLib',
)
pkg.generate(libraries : [libgmodule, export_dynamic_ldflags],
pkg.generate(libraries : [libgmodule],
requires : ['glib-2.0'],
version : glib_version,
variables : [supported_var],
install_dir : glib_pkgconfigreldir,
filebase : 'gmodule-export-2.0',
extra_cflags : export_dynamic_cflags,
name : 'GModule',
description : 'Dynamic module loader for GLib',
)
pkg.generate(libraries : [libgmodule, export_dynamic_ldflags],
pkg.generate(libraries : [libgmodule],
requires : ['glib-2.0'],
version : glib_version,
variables : [supported_var],
install_dir : glib_pkgconfigreldir,
filebase : 'gmodule-2.0',
extra_cflags : export_dynamic_cflags,
name : 'GModule',
description : 'Dynamic module loader for GLib',
)

View File

@ -2304,15 +2304,15 @@ if host_system == 'windows'
# Autotools explicitly removed --Wl,--export-all-symbols from windows builds,
# with no explanation. Do the same here for now but this could be revisited if
# if causes issues.
export_dynamic_ldflags = []
export_dynamic_cflags = []
elif host_system == 'cygwin'
export_dynamic_ldflags = ['-Wl,--export-all-symbols']
export_dynamic_cflags = ['-Wl,--export-all-symbols']
elif host_system in ['darwin', 'ios']
export_dynamic_ldflags = []
export_dynamic_cflags = []
elif host_system == 'sunos'
export_dynamic_ldflags = []
export_dynamic_cflags = []
else
export_dynamic_ldflags = ['-Wl,--export-dynamic']
export_dynamic_cflags = ['-Wl,--export-dynamic']
endif
win32_cflags = []