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

[PATCH] meson: make GIT_HTML_PATH configurable

From
D. Ben Knoble <ben.knoble+github@gmail.com>
Date
Nov 11, 2025, 00:25 UTC
Message-ID
<d6b86ed23e28c875b48fdc77095ace3f8ff4ee5d.1762820704.git.ben.knoble+github@gmail.com>
In-Reply-To
<385992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com>

Makefile-based builds can configure Git's internal HTML_PATH by defining htmldir, which is useful for packagers that put documentation in different locations. Gentoo, for example, uses version-suffixed directories like ${prefix}/share/doc/git-2.51 and puts the HTML documentation in an 'html' subdirectory of the same.

Propagate the same configuration knob to Meson-based builds so that "git --html-path" on such systems can be configured to output the correct directory.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
---
Reorder options lexicographically for Patrick ;)
v1: https://lore.kernel.org/git/85992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com
 Documentation/howto/meson.build     |  4 ++--
 Documentation/meson.build           | 12 ++++++------
 Documentation/technical/meson.build |  4 ++--
 contrib/contacts/meson.build        |  2 +-
 contrib/subtree/meson.build         |  2 +-
 meson.build                         |  7 ++++++-
 meson_options.txt                   |  2 ++
 7 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build
index ece20244af..16b9056f24 100644
--- a/Documentation/howto/meson.build
+++ b/Documentation/howto/meson.build
@@ -35,7 +35,7 @@ doc_targets += custom_target(
   output: 'howto-index.html',
   depends: documentation_deps,
   install: true,
-  install_dir: get_option('datadir') / 'doc/git-doc',
+  install_dir: htmldir,
 )
 
 foreach howto : howto_sources
@@ -57,6 +57,6 @@ foreach howto : howto_sources
     output: fs.stem(howto_stripped.full_path()) + '.html',
     depends: documentation_deps,
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc/howto',
+    install_dir: htmldir / 'howto',
   )
 endforeach
diff --git a/Documentation/meson.build b/Documentation/meson.build
index 9d24f2da54..c00c9fe7f4 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -412,7 +412,7 @@ foreach manpage, category : manpages
       input: manpage,
       output: fs.stem(manpage) + '.html',
       install: true,
-      install_dir: get_option('datadir') / 'doc/git-doc',
+      install_dir: htmldir,
     )
   endif
 endforeach
@@ -423,7 +423,7 @@ if get_option('docs').contains('html')
     output: 'docinfo.html',
     copy: true,
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
   )
 
   configure_file(
@@ -431,11 +431,11 @@ if get_option('docs').contains('html')
     output: 'docbook-xsl.css',
     copy: true,
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
   )
 
   install_symlink('index.html',
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
     pointing_to: 'git.html',
   )
 
@@ -466,7 +466,7 @@ if get_option('docs').contains('html')
     input: 'docbook.xsl',
     output: 'user-manual.html',
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
   )
 
   articles = [
@@ -492,7 +492,7 @@ if get_option('docs').contains('html')
       output: fs.stem(article) + '.html',
       depends: documentation_deps,
       install: true,
-      install_dir: get_option('datadir') / 'doc/git-doc',
+      install_dir: htmldir,
     )
   endforeach
 
diff --git a/Documentation/technical/meson.build b/Documentation/technical/meson.build
index be698ef22a..faff3964a9 100644
--- a/Documentation/technical/meson.build
+++ b/Documentation/technical/meson.build
@@ -53,7 +53,7 @@ doc_targets += custom_target(
   output: 'api-index.html',
   depends: documentation_deps,
   install: true,
-  install_dir: get_option('datadir') / 'doc/git-doc/technical',
+  install_dir: htmldir / 'technical',
 )
 
 foreach article : api_docs + articles
@@ -63,6 +63,6 @@ foreach article : api_docs + articles
     output: fs.stem(article) + '.html',
     depends: documentation_deps,
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc/technical',
+    install_dir: htmldir / 'technical',
   )
 endforeach
diff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build
index c8fdb35ed9..4ae6b32a03 100644
--- a/contrib/contacts/meson.build
+++ b/contrib/contacts/meson.build
@@ -50,6 +50,6 @@ if get_option('docs').contains('html')
     input: 'git-contacts.adoc',
     output: 'git-contacts.html',
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
   )
 endif
diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build
index 46cdbcc30c..161435abeb 100644
--- a/contrib/subtree/meson.build
+++ b/contrib/subtree/meson.build
@@ -68,6 +68,6 @@ if get_option('docs').contains('html')
     input: 'git-subtree.adoc',
     output: 'git-subtree.html',
     install: true,
-    install_dir: get_option('datadir') / 'doc/git-doc',
+    install_dir: htmldir,
   )
 endif
diff --git a/meson.build b/meson.build
index 2b763f7c53..1f95a06edb 100644
--- a/meson.build
+++ b/meson.build
@@ -768,13 +768,18 @@ if test_output_directory == ''
   test_output_directory = meson.project_build_root() / 'test-output'
 endif
 
+htmldir = get_option('htmldir')
+if htmldir == ''
+  htmldir = get_option('datadir') / 'doc/git-doc'
+endif
+
 # These variables are used for building libgit.a.
 libgit_c_args = [
   '-DBINDIR="' + get_option('bindir') + '"',
   '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
   '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
   '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
-  '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+  '-DGIT_HTML_PATH="' + htmldir + '"',
   '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
   '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
   '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
diff --git a/meson_options.txt b/meson_options.txt
index 143dee9237..e0be260ae1 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,6 @@
 # Configuration for Git installation
+option('htmldir', type: 'string', value: '',
+  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')
 option('perllibdir', type: 'string', value: '',
   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
 

Diff-intervalle :
1:  385992f602 ! 1:  d6b86ed23e meson: make GIT_HTML_PATH configurable
    @@ meson.build: if test_output_directory == ''
      ## meson_options.txt ##
     @@
      # Configuration for Git installation
    - option('perllibdir', type: 'string', value: '',
    -   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
     +option('htmldir', type: 'string', value: '',
     +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')
    + option('perllibdir', type: 'string', value: '',
    +   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
      
    - # Configuration for how Git behaves at runtime.
    - option('default_pager', type: 'string', value: 'less',

base-commit: 7f278e958afbf9b7e0727631b4c26dcfa1c63d6e
-- 
2.52.0.rc0.71.g03eda12af0.dirty
Previous: Junio C HamanoNext: Karthik Nayak
Message 8 of 10 in “meson: make GIT_HTML_PATH configurable”
  1. meson: make GIT_HTML_PATH configurableD. Ben Knoble, Nov 4, 2025
  2. Junio C HamanoNov 4, 2025
  3. Ben KnobleNov 4, 2025
  4. Patrick SteinhardtNov 6, 2025
  5. Patrick SteinhardtNov 6, 2025
  6. Ben KnobleNov 6, 2025
  7. Junio C HamanoNov 6, 2025
  8. meson: make GIT_HTML_PATH configurableD. Ben Knoble, Nov 11, 2025
  9. Karthik NayakNov 11, 2025
  10. D. Ben KnobleNov 11, 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.