meson: add 'cache-dir' option

Fixes #244
This commit is contained in:
Tim-Philipp Müller 2022-07-02 18:48:10 +01:00
parent 66fa47c6f1
commit 6ae5623674
2 changed files with 17 additions and 4 deletions

View File

@ -266,10 +266,16 @@ endforeach
conf.set_quoted('FC_FONTPATH', escaped_xml_path)
fonts_conf.set('FC_FONTPATH', xml_path)
if host_machine.system() == 'windows'
fc_cachedir = get_option('cache-dir')
if fc_cachedir in ['yes', 'no', 'default']
if host_machine.system() == 'windows'
fc_cachedir = 'LOCAL_APPDATA_FONTCONFIG_CACHE'
else
else
fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name())
endif
endif
if host_machine.system() != 'windows'
thread_dep = dependency('threads')
conf.set('HAVE_PTHREAD', 1)
deps += [thread_dep]
@ -436,3 +442,6 @@ summary({
'Font directories': fc_fonts_paths,
'Additional font directories': fc_add_fonts,
}, section: 'Defaults', bool_yn: true, list_sep: ', ')
summary({
'Cache directory': fc_cachedir,
}, section: 'Paths', bool_yn: true, list_sep: ', ')

View File

@ -23,3 +23,7 @@ option('default-fonts-dirs', type: 'array', value: ['yes'],
option('additional-fonts-dirs', type: 'array', value: ['yes'],
description: 'Find additional fonts in DIR1,DIR2,... (set to "yes" for generic system-specific defaults)')
# Configuration paths
option('cache-dir', type: 'string', value: 'default',
description: 'Use DIR to store cache files (default=LOCALSTATEDIR/cache/fontconfig)')