mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 01:18:53 +02:00
Merge branch 'meson-dependency-lookups' into 'main'
meson: simplify iconv/intl lookups using Meson's builtin dependency lookup See merge request GNOME/glib!2734
This commit is contained in:
@@ -386,11 +386,10 @@ freebsd-12-x86_64:
|
|||||||
- bash .gitlab-ci/show-execution-environment.sh
|
- bash .gitlab-ci/show-execution-environment.sh
|
||||||
script:
|
script:
|
||||||
# We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
|
# We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
|
||||||
# FreeBSD iconv doesn't handle transliteration, so we use (external) GNU libiconv here.
|
|
||||||
# FreeBSD supports xattr, but its API is different from Linux xattr.
|
# FreeBSD supports xattr, but its API is different from Linux xattr.
|
||||||
# FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
|
# FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
|
||||||
# localstatedir is needed for access to /var/lib/dbus/machine-id
|
# localstatedir is needed for access to /var/lib/dbus/machine-id
|
||||||
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
|
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
|
||||||
- ninja -C _build
|
- ninja -C _build
|
||||||
- bash -x ./.gitlab-ci/run-tests.sh
|
- bash -x ./.gitlab-ci/run-tests.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -417,7 +416,7 @@ freebsd-13-x86_64:
|
|||||||
before_script:
|
before_script:
|
||||||
- bash .gitlab-ci/show-execution-environment.sh
|
- bash .gitlab-ci/show-execution-environment.sh
|
||||||
script:
|
script:
|
||||||
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
|
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
|
||||||
- ninja -C _build
|
- ninja -C _build
|
||||||
- bash -x ./.gitlab-ci/run-tests.sh
|
- bash -x ./.gitlab-ci/run-tests.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
|
7
NEWS
7
NEWS
@@ -1,3 +1,10 @@
|
|||||||
|
Overview of changes in GLib 2.73.1
|
||||||
|
==================================
|
||||||
|
|
||||||
|
* Remove the `-Diconv` configure option, as GLib now uses Meson’s built-in logic for
|
||||||
|
finding which iconv implementation to use (work by Eli Schwartz) (!2734)
|
||||||
|
|
||||||
|
|
||||||
Overview of changes in GLib 2.73.0
|
Overview of changes in GLib 2.73.0
|
||||||
==================================
|
==================================
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
On FreeBSD:
|
On FreeBSD:
|
||||||
<literallayout>
|
<literallayout>
|
||||||
<userinput>env CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -Wl,--disable-new-dtags" meson -Dxattr=false -Dinstalled_tests=true -Diconv=external -Db_lundef=false _build</userinput>
|
<userinput>env CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -Wl,--disable-new-dtags" meson -Dxattr=false -Dinstalled_tests=true -Db_lundef=false _build</userinput>
|
||||||
<userinput>ninja -C _build</userinput>
|
<userinput>ninja -C _build</userinput>
|
||||||
</literallayout>
|
</literallayout>
|
||||||
</para>
|
</para>
|
||||||
@@ -98,16 +98,12 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If your system has an <function>iconv()</function> implementation but
|
If your system has an <function>iconv()</function> implementation but
|
||||||
you want to use libiconv instead, you can pass the
|
you want to use libiconv instead, make sure it is installed to the
|
||||||
<option>-Diconv=gnu</option> option to <command>meson</command>. This
|
default compiler header/library search path (for instance, in
|
||||||
forces libiconv to be used.
|
<filename>/usr/local/</filename>). The <filename>iconv.h</filename>
|
||||||
</para>
|
that libiconv installs hides the system iconv. Meson then detects
|
||||||
<para>
|
this, recognizes that the system iconv is unusable and the external
|
||||||
Note that if you have libiconv installed in your default include
|
one is mandatory, and automatically forces it to be used.
|
||||||
search path (for instance, in <filename>/usr/local/</filename>), but
|
|
||||||
don't enable it, you will get an error while compiling GLib because
|
|
||||||
the <filename>iconv.h</filename> that libiconv installs hides the
|
|
||||||
system iconv.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If you are using the native iconv implementation on Solaris
|
If you are using the native iconv implementation on Solaris
|
||||||
|
79
meson.build
79
meson.build
@@ -1976,28 +1976,12 @@ glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack)
|
|||||||
# We should never use the MinGW C library's iconv because it may not be
|
# We should never use the MinGW C library's iconv because it may not be
|
||||||
# available in the actual runtime environment. On Windows, we always use
|
# available in the actual runtime environment. On Windows, we always use
|
||||||
# the built-in implementation
|
# the built-in implementation
|
||||||
iconv_opt = get_option('iconv')
|
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
libiconv = []
|
|
||||||
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
|
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
|
||||||
# any external library for it
|
# any external library for it
|
||||||
if iconv_opt != 'auto'
|
libiconv = []
|
||||||
warning('-Diconv was set to @0@, which was ignored')
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
found_iconv = false
|
libiconv = dependency('iconv')
|
||||||
if ['auto', 'libc'].contains(iconv_opt) and cc.has_function('iconv_open')
|
|
||||||
libiconv = []
|
|
||||||
found_iconv = true
|
|
||||||
endif
|
|
||||||
if not found_iconv and ['auto', 'external'].contains(iconv_opt) and cc.has_header_symbol('iconv.h', 'iconv_open')
|
|
||||||
libiconv = [cc.find_library('iconv')]
|
|
||||||
found_iconv = true
|
|
||||||
endif
|
|
||||||
|
|
||||||
if not found_iconv
|
|
||||||
error('iconv implementation "@0@" not found'.format(iconv_opt))
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
||||||
@@ -2046,42 +2030,37 @@ libz_dep = dependency('zlib')
|
|||||||
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
|
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
|
||||||
# implementations. This could be extended if issues are found in some platforms.
|
# implementations. This could be extended if issues are found in some platforms.
|
||||||
libintl_deps = []
|
libintl_deps = []
|
||||||
if cc.has_function('ngettext')
|
libintl = dependency('intl', required: false)
|
||||||
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
|
if libintl.found()
|
||||||
else
|
# libintl supports different threading APIs, which may not
|
||||||
# First just find the bare library.
|
# require additional flags, but it defaults to using pthreads if
|
||||||
libintl = cc.find_library('intl', required : false)
|
# found. Meson's "threads" dependency does not allow you to
|
||||||
# The bare library probably won't link without help if it's static.
|
# prefer pthreads. We may not be using pthreads for glib itself
|
||||||
if libintl.found() and not cc.has_function('ngettext', dependencies : libintl)
|
# either so just link the library to satisfy libintl rather than
|
||||||
libintl_iconv = cc.find_library('iconv', required : false)
|
# also defining the macros with the -pthread flag.
|
||||||
# libintl supports different threading APIs, which may not
|
#
|
||||||
# require additional flags, but it defaults to using pthreads if
|
# Meson's builtin dependency lookup as of 0.60.0 doesn't check for
|
||||||
# found. Meson's "threads" dependency does not allow you to
|
# pthread, so we do this manually here.
|
||||||
# prefer pthreads. We may not be using pthreads for glib itself
|
if cc.has_function('ngettext', dependencies : libintl)
|
||||||
# either so just link the library to satisfy libintl rather than
|
libintl_deps += [libintl]
|
||||||
# also defining the macros with the -pthread flag.
|
|
||||||
libintl_pthread = cc.find_library('pthread', required : false)
|
|
||||||
# Try linking with just libiconv.
|
|
||||||
if libintl_iconv.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv])
|
|
||||||
libintl_deps += [libintl_iconv]
|
|
||||||
# Then also try linking with pthreads.
|
|
||||||
elif libintl_iconv.found() and libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv, libintl_pthread])
|
|
||||||
libintl_deps += [libintl_iconv, libintl_pthread]
|
|
||||||
else
|
|
||||||
libintl = disabler()
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if not libintl.found()
|
|
||||||
libintl = subproject('proxy-libintl').get_variable('intl_dep')
|
|
||||||
libintl_deps = [libintl] + libintl_deps
|
|
||||||
have_bind_textdomain_codeset = true # proxy-libintl supports it
|
|
||||||
else
|
else
|
||||||
libintl_deps = [libintl] + libintl_deps
|
libintl_pthread = cc.find_library('pthread', required : false)
|
||||||
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
|
if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread])
|
||||||
dependencies : libintl_deps)
|
libintl_deps += [libintl, libintl_pthread]
|
||||||
|
else
|
||||||
|
libintl = disabler()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if libintl.found()
|
||||||
|
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps)
|
||||||
|
else
|
||||||
|
libintl = subproject('proxy-libintl').get_variable('intl_dep')
|
||||||
|
libintl_deps = [libintl]
|
||||||
|
have_bind_textdomain_codeset = true # proxy-libintl supports it
|
||||||
|
endif
|
||||||
|
|
||||||
glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
|
glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
|
||||||
|
|
||||||
# We require gettext to always be present
|
# We require gettext to always be present
|
||||||
|
@@ -7,7 +7,7 @@ option('iconv',
|
|||||||
type : 'combo',
|
type : 'combo',
|
||||||
choices : ['auto', 'libc', 'external'],
|
choices : ['auto', 'libc', 'external'],
|
||||||
value : 'auto',
|
value : 'auto',
|
||||||
description : 'iconv implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libiconv\'; \'auto\' = \'Auto-detect which iconv is available\')')
|
deprecated: true,)
|
||||||
|
|
||||||
option('charsetalias_dir',
|
option('charsetalias_dir',
|
||||||
type : 'string',
|
type : 'string',
|
||||||
@@ -116,4 +116,4 @@ option('glib_checks',
|
|||||||
option('libelf',
|
option('libelf',
|
||||||
type : 'feature',
|
type : 'feature',
|
||||||
value : 'auto',
|
value : 'auto',
|
||||||
description : 'Enable support for listing and extracting from ELF resource files with gresource tool')
|
description : 'Enable support for listing and extracting from ELF resource files with gresource tool')
|
||||||
|
Reference in New Issue
Block a user