Files
git-mirror/meson_options.txt
Ramsay Jones 46a626c389 meson: correct path to system config/attribute files
The path to the system-wide config and attributes files are not being
set correctly in the meson build. Unless explicitly overridden on the
command line during setup, the 'gitconfig' and 'gitattributes' options
are defaulting to absolute paths in the '/etc' system directory. This
is only appropriate if the <prefix> is set specifically to '/usr'.

The directory in which these files are placed is generally referred to
as the 'system configuration directory' or 'sysconfdir' for short. When
the prefix is '/usr' then the sysconfdir is usually set to '/etc', but
any other value for prefix results in the relative directory value 'etc'
instead. (eg if prefix is '/usr/local', then the 'etc' relative value
results in a system configuration directory of '/usr/local/etc'). When
setting the 'sysconfdir' builtin option value, the meson system uses
exactly this algorithm, so we can use get_option('sysconfdir') directly
when setting the (non-overridden) build variables.

In order to allow for overriding from the command line, remove the
default values specified for the 'gitconfig' and 'gitattributes' options
in the 'meson_options.txt' file. This allows the user to specify any
pathname for those options, while being able to test for the unset
(empty) value. An absolute pathname will be used unchanged and a relative
pathname will be appended to '<prefix>/'. These values are then used to
set the 'ETC_GITCONFIG' and 'ETC_GITATTRIBUTES' build variables which are,
in turn, passed to the compiler as '-D' arguments.

When the 'gitconfig' or 'gitattributes' options are not used, then use
the built-in 'sysconfdir' and set the ETC_GITCONFIG build variable to
the string "<sysconfdir>/gitconfig". Similarly, set ETC_ATTRIBUTES to
"<sysconfdir>/gitattributes".

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-19 11:34:00 -07:00

122 lines
7.5 KiB
Meson

# Configuration for how Git behaves at runtime.
option('default_pager', type: 'string', value: 'less',
description: 'Fall-back pager.')
option('default_editor', type: 'string', value: 'vi',
description: 'Fall-back editor.')
option('gitconfig', type: 'string',
description: 'Path to the global git configuration file. (default: etc/gitconfig)')
option('gitattributes', type: 'string',
description: 'Path to the global git attributes file. (default: etc/gitattributes)')
option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
description: 'Environment used when spawning the pager')
option('perl_cpan_fallback', type: 'boolean', value: true,
description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')
option('runtime_prefix', type: 'boolean', value: false,
description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
option('sane_tool_path', type: 'array', value: [],
description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')
# Build information compiled into Git and other parts like documentation.
option('build_date', type: 'string', value: '',
description: 'Build date reported by our documentation.')
option('built_from_commit', type: 'string', value: '',
description: 'Commit that Git was built from reported by git-version(1).')
option('user_agent', type: 'string', value: '',
description: 'User agent reported to remote servers.')
option('version', type: 'string', value: '',
description: 'Version string reported by git-version(1) and other tools.')
# Features supported by Git.
option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'contacts', 'subtree' ],
description: 'Contributed features to include.')
option('credential_helpers', type: 'array', value: [ ], choices: [ 'libsecret', 'netrc', 'osxkeychain', 'wincred' ],
description: 'Contributed features to include.')
option('curl', type: 'feature', value: 'enabled',
description: 'Build helpers used to access remotes with the HTTP transport.')
option('expat', type: 'feature', value: 'enabled',
description: 'Build helpers used to push to remotes with the HTTP transport.')
option('gettext', type: 'feature', value: 'auto',
description: 'Build translation files.')
option('gitweb', type: 'feature', value: 'auto',
description: 'Build Git web interface. Requires Perl.')
option('iconv', type: 'feature', value: 'auto',
description: 'Support reencoding strings with different encodings.')
option('pcre2', type: 'feature', value: 'enabled',
description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
option('perl', type: 'feature', value: 'auto',
description: 'Build tools written in Perl.')
option('python', type: 'feature', value: 'auto',
description: 'Build tools written in Python.')
option('regex', type: 'feature', value: 'auto',
description: 'Use the system-provided regex library instead of the bundled one.')
# Backends.
option('csprng_backend', type: 'combo', value: 'auto', choices: ['auto', 'arc4random', 'arc4random_bsd', 'getrandom', 'getentropy', 'rtlgenrandom', 'openssl', 'urandom'],
description: 'The backend to use for generating cryptographically-secure pseudo-random numbers.')
option('https_backend', type: 'combo', value: 'auto', choices: ['auto', 'openssl', 'CommonCrypto', 'none'],
description: 'The HTTPS backend to use when connecting to remotes.')
option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'CommonCrypto'], value: 'sha1dc',
description: 'The backend used for hashing objects with the SHA1 object format.')
option('sha1_unsafe_backend', type: 'combo', choices: ['openssl', 'block', 'CommonCrypto', 'none'], value: 'none',
description: 'The backend used for hashing data with the SHA1 object format in case no cryptographic security is needed.')
option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block',
description: 'The backend used for hashing objects with the SHA256 object format.')
option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], value: 'auto',
description: 'The backend used for compressing objects and other data.')
# Build tweaks.
option('breaking_changes', type: 'boolean', value: false,
description: 'Enable upcoming breaking changes.')
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
# gitweb configuration.
option('gitweb_config', type: 'string', value: 'gitweb_config.perl')
option('gitweb_config_system', type: 'string', value: '/etc/gitweb.conf')
option('gitweb_config_common', type: 'string', value: '/etc/gitweb-common.conf')
option('gitweb_home_link_str', type: 'string', value: 'projects')
option('gitweb_sitename', type: 'string', value: '')
option('gitweb_projectroot', type: 'string', value: '/pub/git')
option('gitweb_project_maxdepth', type: 'string', value: '2007')
option('gitweb_export_ok', type: 'string', value: '')
option('gitweb_strict_export', type: 'string', value: '')
option('gitweb_base_url', type: 'string', value: '')
option('gitweb_list', type: 'string', value: '')
option('gitweb_hometext', type: 'string', value: 'indextext.html')
option('gitweb_css', type: 'string', value: 'static/gitweb.css')
option('gitweb_logo', type: 'string', value: 'static/git-logo.png')
option('gitweb_favicon', type: 'string', value: 'static/git-favicon.png')
option('gitweb_js', type: 'string', value: 'static/gitweb.js')
option('gitweb_site_html_head_string', type: 'string', value: '')
option('gitweb_site_header', type: 'string', value: '')
option('gitweb_site_footer', type: 'string', value: '')
option('highlight_bin', type: 'string', value: 'highlight')
# Documentation.
option('docs', type: 'array', choices: ['man', 'html'], value: [],
description: 'Which documenattion formats to build and install.')
option('default_help_format', type: 'combo', choices: ['man', 'html', 'platform'], value: 'platform',
description: 'Default format used when executing git-help(1).')
option('docs_backend', type: 'combo', choices: ['asciidoc', 'asciidoctor', 'auto'], value: 'auto',
description: 'Which backend to use to generate documentation.')
# Testing.
option('benchmarks', type: 'feature', value: 'auto',
description: 'Enable benchmarks. This requires Perl and GNU time.')
option('benchmark_repo', type: 'string', value: '',
description: 'Repository to copy for the performance tests. Should be at least the size of the Git repository.')
option('benchmark_large_repo', type: 'string', value: '',
description: 'Large repository to copy for the performance tests. Should be at least the size of the Linux repository.')
option('benchmark_repeat_count', type: 'integer', value: 3,
description: 'Number of times a test should be repeated for best-of-N measurements.')
option('coccinelle', type: 'feature', value: 'auto',
description: 'Provide a coccicheck target that generates a Coccinelle patch.')
option('tests', type: 'boolean', value: true,
description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.')
option('test_output_directory', type: 'string',
description: 'Path to the directory used to store test outputs')
option('test_utf8_locale', type: 'string',
description: 'Name of a UTF-8 locale used for testing.')
option('fuzzers', type: 'boolean', value: false,
description: 'Enable building fuzzers.')