mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
meson: simplify iconv lookups using Meson's builtin dependency lookup
iconv is complicated to look up. That complexity now resides in Meson, since 0.60.0, via a `dependency('iconv')` lookup, so use that instead. No effort is made to support the old option for which type of iconv to use. It was a false choice, because if only one was available, then that's the only one you can use, and if both are available, the external iconv shadows the builtin one and renders the builtin one unusable, so there is still only one you can use. This meant that when configuring glib with -Diconv=libc on systems that had an external iconv, the configure check would detect a valid libc iconv, try to use it, and then fail during the build because iconv.h belongs to the external iconv and generates machine code using the external iconv ABI, but fails to link to the iconv `find_library()`. Meson handles this transparently.
This commit is contained in:
parent
ccc7006d53
commit
24ec80cfb4
@ -386,11 +386,10 @@ freebsd-12-x86_64:
|
||||
- bash .gitlab-ci/show-execution-environment.sh
|
||||
script:
|
||||
# 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.
|
||||
# FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
|
||||
# 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
|
||||
- bash -x ./.gitlab-ci/run-tests.sh
|
||||
artifacts:
|
||||
@ -417,7 +416,7 @@ freebsd-13-x86_64:
|
||||
before_script:
|
||||
- bash .gitlab-ci/show-execution-environment.sh
|
||||
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
|
||||
- bash -x ./.gitlab-ci/run-tests.sh
|
||||
artifacts:
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
On FreeBSD:
|
||||
<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>
|
||||
</literallayout>
|
||||
</para>
|
||||
@ -98,16 +98,12 @@
|
||||
</para>
|
||||
<para>
|
||||
If your system has an <function>iconv()</function> implementation but
|
||||
you want to use libiconv instead, you can pass the
|
||||
<option>-Diconv=gnu</option> option to <command>meson</command>. This
|
||||
forces libiconv to be used.
|
||||
</para>
|
||||
<para>
|
||||
Note that if you have libiconv installed in your default include
|
||||
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.
|
||||
you want to use libiconv instead, make sure it is installed to the
|
||||
default compiler header/library search path (for instance, in
|
||||
<filename>/usr/local/</filename>). The <filename>iconv.h</filename>
|
||||
that libiconv installs hides the system iconv. Meson then detects
|
||||
this, recognizes that the system iconv is unusable and the external
|
||||
one is mandatory, and automatically forces it to be used.
|
||||
</para>
|
||||
<para>
|
||||
If you are using the native iconv implementation on Solaris
|
||||
|
20
meson.build
20
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
|
||||
# available in the actual runtime environment. On Windows, we always use
|
||||
# the built-in implementation
|
||||
iconv_opt = get_option('iconv')
|
||||
if host_system == 'windows'
|
||||
libiconv = []
|
||||
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
|
||||
# any external library for it
|
||||
if iconv_opt != 'auto'
|
||||
warning('-Diconv was set to @0@, which was ignored')
|
||||
endif
|
||||
else
|
||||
found_iconv = false
|
||||
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
|
||||
else
|
||||
libiconv = dependency('iconv')
|
||||
endif
|
||||
|
||||
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
||||
|
@ -7,7 +7,7 @@ option('iconv',
|
||||
type : 'combo',
|
||||
choices : ['auto', 'libc', 'external'],
|
||||
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',
|
||||
type : 'string',
|
||||
|
Loading…
Reference in New Issue
Block a user