mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against MSVC and contains no i18n machinery at all. The dependencies added indirectly use the libintl.h header, and when built as a subproject, the header won't be in a path known the pre-processor.
This commit is contained in:
parent
fb1f52e32f
commit
ee94ad776e
@ -755,7 +755,7 @@ executable('gio', gio_tool_sources,
|
|||||||
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
|
c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args,
|
||||||
# intl.lib is not compatible with SAFESEH
|
# intl.lib is not compatible with SAFESEH
|
||||||
link_args : noseh_link_args,
|
link_args : noseh_link_args,
|
||||||
dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
|
dependencies : [libintl, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
|
||||||
|
|
||||||
executable('gresource', 'gresource-tool.c',
|
executable('gresource', 'gresource-tool.c',
|
||||||
install : true,
|
install : true,
|
||||||
|
@ -10,5 +10,6 @@ giowin32_sources = [
|
|||||||
giowin32_lib = static_library('giowin32',
|
giowin32_lib = static_library('giowin32',
|
||||||
sources : [giowin32_sources, gioenumtypes_h],
|
sources : [giowin32_sources, gioenumtypes_h],
|
||||||
include_directories : [configinc, glibinc, gioinc, gmoduleinc],
|
include_directories : [configinc, glibinc, gioinc, gmoduleinc],
|
||||||
|
dependencies : [libintl],
|
||||||
pic : true,
|
pic : true,
|
||||||
c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
|
c_args : [ '-DHAVE_CONFIG_H', '-DG_DISABLE_DEPRECATED' ] + gio_c_args)
|
||||||
|
@ -233,24 +233,24 @@ if host_system == 'windows'
|
|||||||
gui_app : true,
|
gui_app : true,
|
||||||
c_args : ['-DHAVE_CONFIG_H=1'],
|
c_args : ['-DHAVE_CONFIG_H=1'],
|
||||||
include_directories : configinc,
|
include_directories : configinc,
|
||||||
dependencies : [libglib_dep])
|
dependencies : [libintl, libglib_dep])
|
||||||
executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
|
executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
|
||||||
install : true,
|
install : true,
|
||||||
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
|
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
|
||||||
include_directories : configinc,
|
include_directories : configinc,
|
||||||
dependencies : [libglib_dep])
|
dependencies : [libintl, libglib_dep])
|
||||||
else
|
else
|
||||||
executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
|
executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
|
||||||
install : true,
|
install : true,
|
||||||
gui_app : true,
|
gui_app : true,
|
||||||
c_args : ['-DHAVE_CONFIG_H=1'],
|
c_args : ['-DHAVE_CONFIG_H=1'],
|
||||||
include_directories : configinc,
|
include_directories : configinc,
|
||||||
dependencies : [libglib_dep])
|
dependencies : [libintl, libglib_dep])
|
||||||
executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
|
executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
|
||||||
install : true,
|
install : true,
|
||||||
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
|
c_args : ['-DHAVE_CONFIG_H=1', '-DHELPER_CONSOLE'],
|
||||||
include_directories : configinc,
|
include_directories : configinc,
|
||||||
dependencies : [libglib_dep])
|
dependencies : [libintl, libglib_dep])
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
gtester = executable('gtester', 'gtester.c',
|
gtester = executable('gtester', 'gtester.c',
|
||||||
|
@ -60,7 +60,7 @@ libgobject = shared_library('gobject-2.0',
|
|||||||
soversion : soversion,
|
soversion : soversion,
|
||||||
install : true,
|
install : true,
|
||||||
include_directories : [configinc],
|
include_directories : [configinc],
|
||||||
dependencies : [libffi_dep, libglib_dep],
|
dependencies : [libintl, libffi_dep, libglib_dep],
|
||||||
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args)
|
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args)
|
||||||
|
|
||||||
libgobject_dep = declare_dependency(link_with : libgobject,
|
libgobject_dep = declare_dependency(link_with : libgobject,
|
||||||
|
23
meson.build
23
meson.build
@ -115,12 +115,6 @@ if get_option('default_library') != 'static'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if run_command('xgettext', '--help').returncode() != 0
|
|
||||||
error('GNU Gettext required currently.')
|
|
||||||
endif
|
|
||||||
glib_conf.set('HAVE_GETTEXT', 1)
|
|
||||||
glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale'))
|
|
||||||
|
|
||||||
# FIXME: what about Cygwin (G_WITH_CYGWIN)
|
# FIXME: what about Cygwin (G_WITH_CYGWIN)
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
glib_os = '''#define G_OS_WIN32
|
glib_os = '''#define G_OS_WIN32
|
||||||
@ -603,8 +597,6 @@ endif
|
|||||||
# AC_FUNC_PRINTF_UNIX98
|
# AC_FUNC_PRINTF_UNIX98
|
||||||
# Nothing uses HAVE_UNIX98_PRINTF
|
# Nothing uses HAVE_UNIX98_PRINTF
|
||||||
|
|
||||||
glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext'))
|
|
||||||
|
|
||||||
# Check for nl_langinfo and CODESET
|
# Check for nl_langinfo and CODESET
|
||||||
# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
|
# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
|
||||||
if cc.links('''#include <langinfo.h>
|
if cc.links('''#include <langinfo.h>
|
||||||
@ -1276,8 +1268,21 @@ glib_conf.set('USE_SYSTEM_PCRE', pcre.found())
|
|||||||
libm = cc.find_library('m', required : false)
|
libm = cc.find_library('m', required : false)
|
||||||
libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
|
libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'ffi_dep'])
|
||||||
libz_dep = dependency('zlib', fallback : ['zlib', 'zlib_dep'])
|
libz_dep = dependency('zlib', fallback : ['zlib', 'zlib_dep'])
|
||||||
|
|
||||||
# Only used on non-glibc targets
|
# Only used on non-glibc targets
|
||||||
libintl = cc.find_library('intl', required : false)
|
libintl = cc.find_library('intl', required : false)
|
||||||
|
if host_system == 'windows' and not libintl.found()
|
||||||
|
# Used only when the gettext library is not available (MSVC, not MinGW)
|
||||||
|
libintl = subproject('proxy-libintl').get_variable('intl_dep')
|
||||||
|
glib_conf.set('HAVE_DCGETTEXT', 1)
|
||||||
|
else
|
||||||
|
glib_conf.set('HAVE_DCGETTEXT', cc.has_header_symbol('libintl.h', 'dcgettext'))
|
||||||
|
endif
|
||||||
|
# We require gettext to always be present
|
||||||
|
glib_conf.set('HAVE_GETTEXT', 1)
|
||||||
|
glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale'))
|
||||||
|
# xgettext is optional (on Windows for instance)
|
||||||
|
xgettext = find_program('xgettext', required : false)
|
||||||
|
|
||||||
# libmount is only used by gio, but we need to fetch the libs to generate the
|
# libmount is only used by gio, but we need to fetch the libs to generate the
|
||||||
# pkg-config file below
|
# pkg-config file below
|
||||||
@ -1382,7 +1387,9 @@ subdir('gobject')
|
|||||||
subdir('gthread')
|
subdir('gthread')
|
||||||
subdir('gmodule')
|
subdir('gmodule')
|
||||||
subdir('gio')
|
subdir('gio')
|
||||||
|
if xgettext.found()
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
endif
|
||||||
|
|
||||||
# Configure and install pkg-config files
|
# Configure and install pkg-config files
|
||||||
pc_files = [
|
pc_files = [
|
||||||
|
Loading…
Reference in New Issue
Block a user