Add iconv detection for meson build

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/394
This commit is contained in:
Akira TAGOH 2023-11-20 16:45:18 +09:00
parent a264a2c0ca
commit c53079fcc1
2 changed files with 49 additions and 33 deletions

View File

@ -1,6 +1,6 @@
project('fontconfig', 'c', project('fontconfig', 'c',
version: '2.14.2', version: '2.14.2',
meson_version : '>= 0.57.0', meson_version : '>= 0.60.0',
default_options: [ 'buildtype=debugoptimized'], default_options: [ 'buildtype=debugoptimized'],
) )
@ -209,6 +209,20 @@ if cc.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris
endif endif
# Check iconv support
iconv_dep = []
found_iconv = 0
if host_machine.system() != 'windows'
iconv_dep = dependency('iconv', required: get_option('iconv'))
found_iconv = iconv_dep.found().to_int()
else
if get_option('iconv').enabled()
warning('-Diconv was set but this is not functional on Windows.')
endif
endif
conf.set('USE_ICONV', found_iconv)
deps += [iconv_dep]
prefix = get_option('prefix') prefix = get_option('prefix')
fonts_conf = configuration_data() fonts_conf = configuration_data()
@ -288,7 +302,7 @@ endif
fc_baseconfigdir = get_option('baseconfig-dir') fc_baseconfigdir = get_option('baseconfig-dir')
if fc_baseconfigdir in ['default', 'yes', 'no'] if fc_baseconfigdir in ['default', 'yes', 'no']
fc_baseconfigdir = prefix / get_option('sysconfdir') / 'fonts' fc_baseconfigdir = prefix / get_option('sysconfdir') / 'fonts'
endif endif
fc_configdir = get_option('config-dir') fc_configdir = get_option('config-dir')
@ -373,13 +387,13 @@ alias_headers = custom_target('alias_headers',
output: ['fcalias.h', 'fcaliastail.h'], output: ['fcalias.h', 'fcaliastail.h'],
input: ['fontconfig/fontconfig.h', 'src/fcdeprecate.h', 'fontconfig/fcprivate.h'], input: ['fontconfig/fontconfig.h', 'src/fcdeprecate.h', 'fontconfig/fcprivate.h'],
command: [python3, makealias, join_paths(meson.current_source_dir(), 'src'), '@OUTPUT@', '@INPUT@'], command: [python3, makealias, join_paths(meson.current_source_dir(), 'src'), '@OUTPUT@', '@INPUT@'],
) )
ft_alias_headers = custom_target('ft_alias_headers', ft_alias_headers = custom_target('ft_alias_headers',
output: ['fcftalias.h', 'fcftaliastail.h'], output: ['fcftalias.h', 'fcftaliastail.h'],
input: ['fontconfig/fcfreetype.h'], input: ['fontconfig/fcfreetype.h'],
command: [python3, makealias, join_paths(meson.current_source_dir(), 'src'), '@OUTPUT@', '@INPUT@'] command: [python3, makealias, join_paths(meson.current_source_dir(), 'src'), '@OUTPUT@', '@INPUT@']
) )
tools_man_pages = [] tools_man_pages = []
@ -427,7 +441,7 @@ configure_file(output: 'fonts.conf',
install_data('fonts.dtd', install_data('fonts.dtd',
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'xml/fontconfig') install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'xml/fontconfig')
) )
fc_headers = [ fc_headers = [
'fontconfig/fontconfig.h', 'fontconfig/fontconfig.h',
@ -445,16 +459,17 @@ summary({
'NLS': not get_option('nls').disabled(), 'NLS': not get_option('nls').disabled(),
'Tests': not get_option('tests').disabled(), 'Tests': not get_option('tests').disabled(),
'Tools': not get_option('tools').disabled(), 'Tools': not get_option('tools').disabled(),
}, section: 'General', bool_yn: true, list_sep: ', ') 'iconv': found_iconv == 1,
}, section: 'General', bool_yn: true, list_sep: ', ')
summary({ summary({
'Hinting': preferred_hinting, 'Hinting': preferred_hinting,
'Font directories': fc_fonts_paths, 'Font directories': fc_fonts_paths,
'Additional font directories': fc_add_fonts, 'Additional font directories': fc_add_fonts,
}, section: 'Defaults', bool_yn: true, list_sep: ', ') }, section: 'Defaults', bool_yn: true, list_sep: ', ')
summary({ summary({
'Cache directory': fc_cachedir, 'Cache directory': fc_cachedir,
'Template directory': fc_templatedir, 'Template directory': fc_templatedir,
'Base config directory': fc_baseconfigdir, 'Base config directory': fc_baseconfigdir,
'Config directory': fc_configdir, 'Config directory': fc_configdir,
'XML directory': fc_xmldir, 'XML directory': fc_xmldir,
}, section: 'Paths', bool_yn: true, list_sep: ', ') }, section: 'Paths', bool_yn: true, list_sep: ', ')

View File

@ -13,6 +13,7 @@ option('tools', type : 'feature', value : 'auto', yield : true,
description: 'Build command-line tools (fc-list, fc-query, etc.)') description: 'Build command-line tools (fc-list, fc-query, etc.)')
option('cache-build', type : 'feature', value : 'enabled', option('cache-build', type : 'feature', value : 'enabled',
description: 'Run fc-cache on install') description: 'Run fc-cache on install')
option('iconv', type: 'feature', value: 'disabled')
# Defaults # Defaults
option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight', option('default-hinting', type: 'combo', choices: ['none', 'slight', 'medium', 'full'], value: 'slight',