diff --git a/meson.build b/meson.build index 1c01b63..ac02568 100644 --- a/meson.build +++ b/meson.build @@ -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 = 'LOCAL_APPDATA_FONTCONFIG_CACHE' -else - fc_cachedir = join_paths(prefix, get_option('localstatedir'), 'cache', meson.project_name()) +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 + 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: ', ') diff --git a/meson_options.txt b/meson_options.txt index 0e05e8b..6c7013e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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)')