git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 04/13] meson.build: set default help format to html on windows

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Apr 6, 2025, 19:38 UTC
Message-ID
<34349bf98c5b01dd1b73065448b616517bb784a3.1743859985.git.ramsay@ramsayjones.plus.com>
In-Reply-To
<cover.1743859985.git.ramsay@ramsayjones.plus.com>

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 <ramsay@ramsayjones.plus.com>
---
 meson.build       | 13 ++++++++++++-
 meson_options.txt |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index efd0bd3319..8f8a258064 100644
--- a/meson.build
+++ b/meson.build
@@ -694,7 +694,6 @@ endif
 libgit_c_args = [
   '-DBINDIR="' + get_option('bindir') + '"',
   '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
-  '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
   '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
   '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
   '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
@@ -717,6 +716,18 @@ if pager_opt != '' and pager_opt != 'less'
   libgit_c_args += '-DDEFAULT_PAGER="' + pager_opt + '"'
 endif
 
+help_format_opt = get_option('default_help_format')
+if help_format_opt == 'platform'
+  if host_machine.system() == 'windows'
+    help_format_opt = 'html'
+  else
+    help_format_opt = 'man'
+  endif
+endif
+if help_format_opt != 'man'
+    libgit_c_args += '-DDEFAULT_HELP_FORMAT="' + help_format_opt + '"'
+endif
+
 libgit_include_directories = [ '.' ]
 libgit_dependencies = [ ]
 
diff --git a/meson_options.txt b/meson_options.txt
index 78d172a740..8ac30a5223 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -95,7 +95,7 @@ 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'], value: 'man',
+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.')
-- 
2.49.0
Previous: Patrick SteinhardtNext: Ramsay Jones
Message 28 of 51 in “miscellaneous build mods (part 1)”
  1. 00/12 miscellaneous build mods (part 1)Ramsay Jones, Mar 15, 2025
  2. 00/13 miscellaneous build mods (part 1)Ramsay Jones, Apr 6, 2025
  3. 06/13 config.mak.uname: add a note about NO_STRLCPY for LinuxRamsay Jones, Apr 6, 2025
  4. 07/13 config.mak.uname: only set NO_REGEX on cygwin for v1.7Ramsay Jones, Apr 6, 2025
  5. Patrick SteinhardtApr 14, 2025
  6. Ramsay JonesApr 14, 2025
  7. Patrick SteinhardtApr 15, 2025
  8. Junio C HamanoApr 15, 2025
  9. 08/13 config.mak.uname: add HAVE_GETDELIM to the cygwin sectionRamsay Jones, Apr 6, 2025
  10. 09/13 config.mak.uname: add clock_gettime() to the cygwin buildRamsay Jones, Apr 6, 2025
  11. Patrick SteinhardtApr 14, 2025
  12. Ramsay JonesApr 14, 2025
  13. 10/13 builtin/gc.c: correct RAM calculation when using sysinfoRamsay Jones, Apr 6, 2025
  14. Patrick SteinhardtApr 14, 2025
  15. Ramsay JonesApr 14, 2025
  16. 11/13 config.mak.uname: add sysinfo() configuration for cygwinRamsay Jones, Apr 6, 2025
  17. Patrick SteinhardtApr 14, 2025
  18. 12/13 config.mak.uname: add arc4random to the cygwin buildRamsay Jones, Apr 6, 2025
  19. 13/13 config.mak.uname: set CSPRNG_METHOD to getrandom on LinuxRamsay Jones, Apr 6, 2025
  20. 01/13 meson.build: remove -DCURL_DISABLE_TYPECHECKRamsay Jones, Apr 6, 2025
  21. 02/13 Makefile: only set some BASIC_CFLAGS when RUNTIME_PREFIX is setRamsay Jones, Apr 6, 2025
  22. Patrick SteinhardtApr 14, 2025
  23. 03/13 meson.build: only set build variables for non-default valuesRamsay Jones, Apr 6, 2025
  24. Ramsay JonesApr 6, 2025
  25. Patrick SteinhardtApr 14, 2025
  26. Ramsay JonesApr 14, 2025
  27. Patrick SteinhardtApr 15, 2025
  28. 04/13 meson.build: set default help format to html on windowsRamsay Jones, Apr 6, 2025
  29. Ramsay JonesApr 6, 2025
  30. Patrick SteinhardtApr 14, 2025
  31. 05/13 Makefile: remove NEEDS_LIBRT build variableRamsay Jones, Apr 6, 2025
  32. 00/13 miscellaneous build mods (part 1)Ramsay Jones, Apr 16, 2025
  33. 01/13 meson.build: remove -DCURL_DISABLE_TYPECHECKRamsay Jones, Apr 16, 2025
  34. 02/13 Makefile: only set some BASIC_CFLAGS when RUNTIME_PREFIX is setRamsay Jones, Apr 16, 2025
  35. 03/13 meson.build: only set build variables for non-default valuesRamsay Jones, Apr 16, 2025
  36. 04/13 meson.build: set default help format to html on windowsRamsay Jones, Apr 16, 2025
  37. 05/13 Makefile: remove NEEDS_LIBRT build variableRamsay Jones, Apr 16, 2025
  38. 06/13 config.mak.uname: add a note about NO_STRLCPY for LinuxRamsay Jones, Apr 16, 2025
  39. 07/13 config.mak.uname: only set NO_REGEX on cygwin for v1.7Ramsay Jones, Apr 16, 2025
  40. 08/13 config.mak.uname: add HAVE_GETDELIM to the cygwin sectionRamsay Jones, Apr 16, 2025
  41. 09/13 config.mak.uname: add clock_gettime() to the cygwin buildRamsay Jones, Apr 16, 2025
  42. 10/13 builtin/gc.c: correct RAM calculation when using sysinfoRamsay Jones, Apr 16, 2025
  43. 11/13 config.mak.uname: add sysinfo() configuration for cygwinRamsay Jones, Apr 16, 2025
  44. 12/13 config.mak.uname: add arc4random to the cygwin buildRamsay Jones, Apr 16, 2025
  45. 13/13 config.mak.uname: set CSPRNG_METHOD to getrandom on LinuxRamsay Jones, Apr 16, 2025
  46. Junio C HamanoApr 17, 2025
  47. Ramsay JonesApr 17, 2025
  48. Junio C HamanoApr 17, 2025
  49. Ramsay JonesApr 17, 2025
  50. Junio C HamanoApr 17, 2025
  51. Patrick SteinhardtApr 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.