meson: add 'template-dir', 'baseconfig-dir', 'config-dir', and 'xml-dir' options

Fixes #244
This commit is contained in:
Tim-Philipp Müller 2022-07-02 19:12:09 +01:00
parent 6ae5623674
commit 0c7bb301f4
2 changed files with 34 additions and 4 deletions

View File

@ -281,11 +281,25 @@ if host_machine.system() != 'windows'
deps += [thread_dep] deps += [thread_dep]
endif endif
fc_templatedir = join_paths(prefix, get_option('datadir'), 'fontconfig/conf.avail') fc_templatedir = get_option('template-dir')
fc_baseconfigdir = join_paths(prefix, get_option('sysconfdir'), 'fonts') if fc_templatedir in ['default', 'yes', 'no']
fc_configdir = join_paths(fc_baseconfigdir, 'conf.d') fc_templatedir = prefix / get_option('datadir') / 'fontconfig/conf.avail'
fc_xmldir = join_paths(prefix, get_option('datadir'), 'xml/fontconfig') endif
fc_baseconfigdir = get_option('baseconfig-dir')
if fc_baseconfigdir in ['default', 'yes', 'no']
fc_baseconfigdir = prefix / get_option('sysconfdir') / 'fonts'
endif
fc_configdir = get_option('config-dir')
if fc_configdir in ['default', 'yes', 'no']
fc_configdir = fc_baseconfigdir / 'conf.d'
endif
fc_xmldir = get_option('xml-dir')
if fc_xmldir in ['default', 'yes', 'no']
fc_xmldir = prefix / get_option('datadir') / 'xml/fontconfig'
endif
conf.set_quoted('CONFIGDIR', fc_configdir) conf.set_quoted('CONFIGDIR', fc_configdir)
conf.set_quoted('FC_CACHEDIR', fc_cachedir) conf.set_quoted('FC_CACHEDIR', fc_cachedir)
@ -444,4 +458,8 @@ summary({
}, 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,
'Base config directory': fc_baseconfigdir,
'Config directory': fc_configdir,
'XML directory': fc_xmldir,
}, section: 'Paths', bool_yn: true, list_sep: ', ') }, section: 'Paths', bool_yn: true, list_sep: ', ')

View File

@ -27,3 +27,15 @@ option('additional-fonts-dirs', type: 'array', value: ['yes'],
# Configuration paths # Configuration paths
option('cache-dir', type: 'string', value: 'default', option('cache-dir', type: 'string', value: 'default',
description: 'Use DIR to store cache files (default=LOCALSTATEDIR/cache/fontconfig)') description: 'Use DIR to store cache files (default=LOCALSTATEDIR/cache/fontconfig)')
option('template-dir', type: 'string', value: 'default',
description: 'Use DIR to store the configuration template files (default=DATADIR/fontconfig/conf.avail)')
option('baseconfig-dir', type: 'string', value: 'default',
description: 'Use DIR to store the base configuration files (default=SYSCONFDIR/fonts)')
option('config-dir', type: 'string', value: 'default',
description: 'Use DIR to store active configuration files (default=BASECONFIGDIR/conf.d)')
option('xml-dir', type: 'string', value: 'default',
description: 'Use DIR to store XML schema files (default=DATADIR/xml/fontconfig)')