Skip to content

Commit 214e2c6

Browse files
ramsay-jonesgitster
authored andcommitted
meson.build: set default help format to html on windows
The build variable DEFAULT_HELP_FORMAT has an appropriate default ('man') set in the code, so there is no need to pass the -Define on the compiler command-line, unless the build requires a non-standard value. In addition, on windows the make build overrides the default help format to 'html', rather than 'man', in the 'config.mak.uname' file. In order to suppress the -Define on the C compiler command-line, only add the -Define to the 'libgit_c_args' variable when the requested value is not the standard 'man'. In order to override the default value on windows, add a 'platform' value to the 'default_help_format' combo option and set it as the default choice. When this option is set to 'platform', use the 'host_machine.system()' method call to determine the appropriate default value for the host system. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 65e3757 commit 214e2c6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

meson.build

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ endif
694694
libgit_c_args = [
695695
'-DBINDIR="' + get_option('bindir') + '"',
696696
'-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
697-
'-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
698697
'-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
699698
'-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
700699
'-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
@@ -717,6 +716,18 @@ if pager_opt != '' and pager_opt != 'less'
717716
libgit_c_args += '-DDEFAULT_PAGER="' + pager_opt + '"'
718717
endif
719718

719+
help_format_opt = get_option('default_help_format')
720+
if help_format_opt == 'platform'
721+
if host_machine.system() == 'windows'
722+
help_format_opt = 'html'
723+
else
724+
help_format_opt = 'man'
725+
endif
726+
endif
727+
if help_format_opt != 'man'
728+
libgit_c_args += '-DDEFAULT_HELP_FORMAT="' + help_format_opt + '"'
729+
endif
730+
720731
libgit_include_directories = [ '.' ]
721732
libgit_dependencies = [ ]
722733

meson_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ option('highlight_bin', type: 'string', value: 'highlight')
9595
# Documentation.
9696
option('docs', type: 'array', choices: ['man', 'html'], value: [],
9797
description: 'Which documenattion formats to build and install.')
98-
option('default_help_format', type: 'combo', choices: ['man', 'html'], value: 'man',
98+
option('default_help_format', type: 'combo', choices: ['man', 'html', 'platform'], value: 'platform',
9999
description: 'Default format used when executing git-help(1).')
100100
option('docs_backend', type: 'combo', choices: ['asciidoc', 'asciidoctor', 'auto'], value: 'auto',
101101
description: 'Which backend to use to generate documentation.')

0 commit comments

Comments
 (0)