script_environment.prepend('PATH', get_option('sane_tool_path'))
endif
+# The environment used by GIT-VERSION-GEN. Note that we explicitly override
+# environment variables that might be set by the user. This is by design so
+# that we always use whatever Meson has configured instead of what is present
+# in the environment.
+version_gen_environment = script_environment
+version_gen_environment.set('GIT_BUILT_FROM_COMMIT', get_option('built_from_commit'))
+version_gen_environment.set('GIT_DATE', get_option('build_date'))
+version_gen_environment.set('GIT_USER_AGENT', get_option('user_agent'))
+version_gen_environment.set('GIT_VERSION', get_option('version'))
+
compiler = meson.get_compiler('c')
libgit_sources = [
],
input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
output: 'GIT-VERSION-FILE',
+ env: version_gen_environment,
build_always_stale: true,
)
# Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
# target for the same commit.
depends: [git_version_file],
+ env: version_gen_environment,
)
# Build a separate library for "version.c" so that we do not have to rebuild
input: meson.current_source_dir() / 'git.rc.in',
output: 'git.rc',
depends: [git_version_file],
+ env: version_gen_environment,
)
common_main_sources += import('windows').compile_resources(git_rc,
option('sane_tool_path', type: 'string', value: '',
description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.')
+# 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('curl', type: 'feature', value: 'enabled',
description: 'Build helpers used to access remotes with the HTTP transport.')