{"thread":{"id":"64434","subject":"[PATCH] meson: make GIT_HTML_PATH configurable","startedAt":"2025-11-04T14:01:23Z","lastAt":"2025-11-11T18:52:40Z","messageCount":10,"participants":["D. Ben Knoble","Junio C Hamano","Ben Knoble","Patrick Steinhardt","Karthik Nayak"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"530190","messageId":"385992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com","threadId":"64434","inReplyTo":null,"subject":"[PATCH] meson: make GIT_HTML_PATH configurable","fromName":"D. Ben Knoble","fromEmail":"ben.knoble+github@gmail.com","sentAt":"2025-11-04T13:58:29Z","receivedAt":"2025-11-04T14:01:23Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"Makefile-based builds can configure Git's internal HTML_PATH by defining\nhtmldir, which is useful for packagers that put documentation in\ndifferent locations. Gentoo, for example, uses version-suffixed\ndirectories like ${prefix}/share/doc/git-2.51 and puts the HTML\ndocumentation in an 'html' subdirectory of the same.\n\nPropagate the same configuration knob to Meson-based builds so that\n\"git --html-path\" on such systems can be configured to output the\ncorrect directory.\n\nSigned-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n---\n\nI've tested this with a modified live Gentoo ebuild [1] and had good results.\n\n[1]: https://github.com/benknoble/gentoo-repo/commit/f2e6bbc8ec5e061a7f8151e56fa91a9d31b5b30b\n\n Documentation/howto/meson.build     |  4 ++--\n Documentation/meson.build           | 12 ++++++------\n Documentation/technical/meson.build |  4 ++--\n contrib/contacts/meson.build        |  2 +-\n contrib/subtree/meson.build         |  2 +-\n meson.build                         |  7 ++++++-\n meson_options.txt                   |  2 ++\n 7 files changed, 20 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build\nindex ece20244af..16b9056f24 100644\n--- a/Documentation/howto/meson.build\n+++ b/Documentation/howto/meson.build\n@@ -35,7 +35,7 @@ doc_targets += custom_target(\n   output: 'howto-index.html',\n   depends: documentation_deps,\n   install: true,\n-  install_dir: get_option('datadir') / 'doc/git-doc',\n+  install_dir: htmldir,\n )\n \n foreach howto : howto_sources\n@@ -57,6 +57,6 @@ foreach howto : howto_sources\n     output: fs.stem(howto_stripped.full_path()) + '.html',\n     depends: documentation_deps,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc/howto',\n+    install_dir: htmldir / 'howto',\n   )\n endforeach\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 9d24f2da54..c00c9fe7f4 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -412,7 +412,7 @@ foreach manpage, category : manpages\n       input: manpage,\n       output: fs.stem(manpage) + '.html',\n       install: true,\n-      install_dir: get_option('datadir') / 'doc/git-doc',\n+      install_dir: htmldir,\n     )\n   endif\n endforeach\n@@ -423,7 +423,7 @@ if get_option('docs').contains('html')\n     output: 'docinfo.html',\n     copy: true,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   configure_file(\n@@ -431,11 +431,11 @@ if get_option('docs').contains('html')\n     output: 'docbook-xsl.css',\n     copy: true,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   install_symlink('index.html',\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n     pointing_to: 'git.html',\n   )\n \n@@ -466,7 +466,7 @@ if get_option('docs').contains('html')\n     input: 'docbook.xsl',\n     output: 'user-manual.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   articles = [\n@@ -492,7 +492,7 @@ if get_option('docs').contains('html')\n       output: fs.stem(article) + '.html',\n       depends: documentation_deps,\n       install: true,\n-      install_dir: get_option('datadir') / 'doc/git-doc',\n+      install_dir: htmldir,\n     )\n   endforeach\n \ndiff --git a/Documentation/technical/meson.build b/Documentation/technical/meson.build\nindex be698ef22a..faff3964a9 100644\n--- a/Documentation/technical/meson.build\n+++ b/Documentation/technical/meson.build\n@@ -53,7 +53,7 @@ doc_targets += custom_target(\n   output: 'api-index.html',\n   depends: documentation_deps,\n   install: true,\n-  install_dir: get_option('datadir') / 'doc/git-doc/technical',\n+  install_dir: htmldir / 'technical',\n )\n \n foreach article : api_docs + articles\n@@ -63,6 +63,6 @@ foreach article : api_docs + articles\n     output: fs.stem(article) + '.html',\n     depends: documentation_deps,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc/technical',\n+    install_dir: htmldir / 'technical',\n   )\n endforeach\ndiff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build\nindex c8fdb35ed9..4ae6b32a03 100644\n--- a/contrib/contacts/meson.build\n+++ b/contrib/contacts/meson.build\n@@ -50,6 +50,6 @@ if get_option('docs').contains('html')\n     input: 'git-contacts.adoc',\n     output: 'git-contacts.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n endif\ndiff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build\nindex 46cdbcc30c..161435abeb 100644\n--- a/contrib/subtree/meson.build\n+++ b/contrib/subtree/meson.build\n@@ -68,6 +68,6 @@ if get_option('docs').contains('html')\n     input: 'git-subtree.adoc',\n     output: 'git-subtree.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n endif\ndiff --git a/meson.build b/meson.build\nindex 2b763f7c53..1f95a06edb 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -768,13 +768,18 @@ if test_output_directory == ''\n   test_output_directory = meson.project_build_root() / 'test-output'\n endif\n \n+htmldir = get_option('htmldir')\n+if htmldir == ''\n+  htmldir = get_option('datadir') / 'doc/git-doc'\n+endif\n+\n # These variables are used for building libgit.a.\n libgit_c_args = [\n   '-DBINDIR=\"' + get_option('bindir') + '\"',\n   '-DDEFAULT_GIT_TEMPLATE_DIR=\"' + get_option('datadir') / 'git-core/templates' + '\"',\n   '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n   '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n-  '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n+  '-DGIT_HTML_PATH=\"' + htmldir + '\"',\n   '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n   '-DGIT_LOCALE_PATH=\"' + get_option('localedir') + '\"',\n   '-DGIT_MAN_PATH=\"' + get_option('mandir') + '\"',\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 143dee9237..13d421c067 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -1,6 +1,8 @@\n # Configuration for Git installation\n option('perllibdir', type: 'string', value: '',\n   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n+option('htmldir', type: 'string', value: '',\n+  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n \n # Configuration for how Git behaves at runtime.\n option('default_pager', type: 'string', value: 'less',\n\nbase-commit: 7f278e958afbf9b7e0727631b4c26dcfa1c63d6e\n-- \n2.48.1\n\n"},{"id":"530193","messageId":"xmqqms51rhbx.fsf@gitster.g","threadId":"64434","inReplyTo":"385992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-11-04T14:41:06Z","receivedAt":"2025-11-04T14:41:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n\n> Makefile-based builds can configure Git's internal HTML_PATH by defining\n> htmldir, which is useful for packagers that put documentation in\n> different locations. Gentoo, for example, uses version-suffixed\n> directories like ${prefix}/share/doc/git-2.51 and puts the HTML\n> documentation in an 'html' subdirectory of the same.\n>\n> Propagate the same configuration knob to Meson-based builds so that\n> \"git --html-path\" on such systems can be configured to output the\n> correct directory.\n>\n> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n> ---\n\nMakes sense (a more meson-minded person needs to double check my\nknee-jerk reaction, though).  It is surprising that \n\n    $ git grep \"dir', \" meson_options.txt\n    meson_options.txt:option('perllibdir', type: 'string', value: '',\n\nhas only a single hit (now two), though.  I thought we have a lot\nmore flexibility in our build process.\n\nI am also a bit surprised that these things are of type 'string'; I\nsomehow was expecting that more modern build system would offer\nricher (relative to Makefile, that is) types like 'filename' or\n'path'.\n\n> I've tested this with a modified live Gentoo ebuild [1] and had good results.\n\nThanks.  Will queue and wait for others to chime in.\n\n>\n> [1]: https://github.com/benknoble/gentoo-repo/commit/f2e6bbc8ec5e061a7f8151e56fa91a9d31b5b30b\n\n\n\n>\n>  Documentation/howto/meson.build     |  4 ++--\n>  Documentation/meson.build           | 12 ++++++------\n>  Documentation/technical/meson.build |  4 ++--\n>  contrib/contacts/meson.build        |  2 +-\n>  contrib/subtree/meson.build         |  2 +-\n>  meson.build                         |  7 ++++++-\n>  meson_options.txt                   |  2 ++\n>  7 files changed, 20 insertions(+), 13 deletions(-)\n>\n> diff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build\n> index ece20244af..16b9056f24 100644\n> --- a/Documentation/howto/meson.build\n> +++ b/Documentation/howto/meson.build\n> @@ -35,7 +35,7 @@ doc_targets += custom_target(\n>    output: 'howto-index.html',\n>    depends: documentation_deps,\n>    install: true,\n> -  install_dir: get_option('datadir') / 'doc/git-doc',\n> +  install_dir: htmldir,\n>  )\n>  \n>  foreach howto : howto_sources\n> @@ -57,6 +57,6 @@ foreach howto : howto_sources\n>      output: fs.stem(howto_stripped.full_path()) + '.html',\n>      depends: documentation_deps,\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc/howto',\n> +    install_dir: htmldir / 'howto',\n>    )\n>  endforeach\n> diff --git a/Documentation/meson.build b/Documentation/meson.build\n> index 9d24f2da54..c00c9fe7f4 100644\n> --- a/Documentation/meson.build\n> +++ b/Documentation/meson.build\n> @@ -412,7 +412,7 @@ foreach manpage, category : manpages\n>        input: manpage,\n>        output: fs.stem(manpage) + '.html',\n>        install: true,\n> -      install_dir: get_option('datadir') / 'doc/git-doc',\n> +      install_dir: htmldir,\n>      )\n>    endif\n>  endforeach\n> @@ -423,7 +423,7 @@ if get_option('docs').contains('html')\n>      output: 'docinfo.html',\n>      copy: true,\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>    )\n>  \n>    configure_file(\n> @@ -431,11 +431,11 @@ if get_option('docs').contains('html')\n>      output: 'docbook-xsl.css',\n>      copy: true,\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>    )\n>  \n>    install_symlink('index.html',\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>      pointing_to: 'git.html',\n>    )\n>  \n> @@ -466,7 +466,7 @@ if get_option('docs').contains('html')\n>      input: 'docbook.xsl',\n>      output: 'user-manual.html',\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>    )\n>  \n>    articles = [\n> @@ -492,7 +492,7 @@ if get_option('docs').contains('html')\n>        output: fs.stem(article) + '.html',\n>        depends: documentation_deps,\n>        install: true,\n> -      install_dir: get_option('datadir') / 'doc/git-doc',\n> +      install_dir: htmldir,\n>      )\n>    endforeach\n>  \n> diff --git a/Documentation/technical/meson.build b/Documentation/technical/meson.build\n> index be698ef22a..faff3964a9 100644\n> --- a/Documentation/technical/meson.build\n> +++ b/Documentation/technical/meson.build\n> @@ -53,7 +53,7 @@ doc_targets += custom_target(\n>    output: 'api-index.html',\n>    depends: documentation_deps,\n>    install: true,\n> -  install_dir: get_option('datadir') / 'doc/git-doc/technical',\n> +  install_dir: htmldir / 'technical',\n>  )\n>  \n>  foreach article : api_docs + articles\n> @@ -63,6 +63,6 @@ foreach article : api_docs + articles\n>      output: fs.stem(article) + '.html',\n>      depends: documentation_deps,\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc/technical',\n> +    install_dir: htmldir / 'technical',\n>    )\n>  endforeach\n> diff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build\n> index c8fdb35ed9..4ae6b32a03 100644\n> --- a/contrib/contacts/meson.build\n> +++ b/contrib/contacts/meson.build\n> @@ -50,6 +50,6 @@ if get_option('docs').contains('html')\n>      input: 'git-contacts.adoc',\n>      output: 'git-contacts.html',\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>    )\n>  endif\n> diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build\n> index 46cdbcc30c..161435abeb 100644\n> --- a/contrib/subtree/meson.build\n> +++ b/contrib/subtree/meson.build\n> @@ -68,6 +68,6 @@ if get_option('docs').contains('html')\n>      input: 'git-subtree.adoc',\n>      output: 'git-subtree.html',\n>      install: true,\n> -    install_dir: get_option('datadir') / 'doc/git-doc',\n> +    install_dir: htmldir,\n>    )\n>  endif\n> diff --git a/meson.build b/meson.build\n> index 2b763f7c53..1f95a06edb 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -768,13 +768,18 @@ if test_output_directory == ''\n>    test_output_directory = meson.project_build_root() / 'test-output'\n>  endif\n>  \n> +htmldir = get_option('htmldir')\n> +if htmldir == ''\n> +  htmldir = get_option('datadir') / 'doc/git-doc'\n> +endif\n> +\n>  # These variables are used for building libgit.a.\n>  libgit_c_args = [\n>    '-DBINDIR=\"' + get_option('bindir') + '\"',\n>    '-DDEFAULT_GIT_TEMPLATE_DIR=\"' + get_option('datadir') / 'git-core/templates' + '\"',\n>    '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n>    '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n> -  '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n> +  '-DGIT_HTML_PATH=\"' + htmldir + '\"',\n>    '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n>    '-DGIT_LOCALE_PATH=\"' + get_option('localedir') + '\"',\n>    '-DGIT_MAN_PATH=\"' + get_option('mandir') + '\"',\n> diff --git a/meson_options.txt b/meson_options.txt\n> index 143dee9237..13d421c067 100644\n> --- a/meson_options.txt\n> +++ b/meson_options.txt\n> @@ -1,6 +1,8 @@\n>  # Configuration for Git installation\n>  option('perllibdir', type: 'string', value: '',\n>    description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n> +option('htmldir', type: 'string', value: '',\n> +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n>  \n>  # Configuration for how Git behaves at runtime.\n>  option('default_pager', type: 'string', value: 'less',\n>\n> base-commit: 7f278e958afbf9b7e0727631b4c26dcfa1c63d6e\n"},{"id":"530205","messageId":"0423F0C4-D0AD-471D-9315-FB208A8171B4@gmail.com","threadId":"64434","inReplyTo":"xmqqms51rhbx.fsf@gitster.g","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-11-04T16:47:49Z","receivedAt":"2025-11-04T16:48:02Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n\n> Le 4 nov. 2025 à 09:41, Junio C Hamano <gitster@pobox.com> a écrit :\n> \n> ﻿\"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n> \n>> Makefile-based builds can configure Git's internal HTML_PATH by defining\n>> htmldir, which is useful for packagers that put documentation in\n>> different locations. Gentoo, for example, uses version-suffixed\n>> directories like ${prefix}/share/doc/git-2.51 and puts the HTML\n>> documentation in an 'html' subdirectory of the same.\n>> \n>> Propagate the same configuration knob to Meson-based builds so that\n>> \"git --html-path\" on such systems can be configured to output the\n>> correct directory.\n>> \n>> Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n>> ---\n> \n> Makes sense (a more meson-minded person needs to double check my\n> knee-jerk reaction, though).  It is surprising that\n> \n>    $ git grep \"dir', \" meson_options.txt\n>    meson_options.txt:option('perllibdir', type: 'string', value: '',\n> \n> has only a single hit (now two), though.  I thought we have a lot\n> more flexibility in our build process.\n\nI learned just enough Meson to write this; many of the other “dir” options are builtin for it. Try “meson configure”\n\n> \n> I am also a bit surprised that these things are of type 'string'; I\n> somehow was expecting that more modern build system would offer\n> richer (relative to Makefile, that is) types like 'filename' or\n> 'path'.\n\nYea. At least there is a / operator to concatenate paths, but it looks like they are just strings on either side.  \n\n> \n>> I've tested this with a modified live Gentoo ebuild [1] and had good results.\n> \n> Thanks.  Will queue and wait for others to chime in.\n\nLooking forward to it. \n"},{"id":"530291","messageId":"aQxTZNYKKAsmL9Sg@pks.im","threadId":"64434","inReplyTo":"385992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-11-06T07:51:00Z","receivedAt":"2025-11-06T07:51:07Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Nov 04, 2025 at 08:58:29AM -0500, D. Ben Knoble wrote:\n> Makefile-based builds can configure Git's internal HTML_PATH by defining\n> htmldir, which is useful for packagers that put documentation in\n> different locations. Gentoo, for example, uses version-suffixed\n> directories like ${prefix}/share/doc/git-2.51 and puts the HTML\n> documentation in an 'html' subdirectory of the same.\n> \n> Propagate the same configuration knob to Meson-based builds so that\n> \"git --html-path\" on such systems can be configured to output the\n> correct directory.\n\nMakes sense.\n\n> diff --git a/Documentation/meson.build b/Documentation/meson.build\n> index 9d24f2da54..c00c9fe7f4 100644\n> --- a/Documentation/meson.build\n> +++ b/Documentation/meson.build\n\nAll of the conversions look sensible to me.\n\n> diff --git a/meson.build b/meson.build\n> index 2b763f7c53..1f95a06edb 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -768,13 +768,18 @@ if test_output_directory == ''\n>    test_output_directory = meson.project_build_root() / 'test-output'\n>  endif\n>  \n> +htmldir = get_option('htmldir')\n> +if htmldir == ''\n> +  htmldir = get_option('datadir') / 'doc/git-doc'\n> +endif\n\nThis retains the status quo, good.\n\n> diff --git a/meson_options.txt b/meson_options.txt\n> index 143dee9237..13d421c067 100644\n> --- a/meson_options.txt\n> +++ b/meson_options.txt\n> @@ -1,6 +1,8 @@\n>  # Configuration for Git installation\n>  option('perllibdir', type: 'string', value: '',\n>    description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n> +option('htmldir', type: 'string', value: '',\n> +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n\nTiny nit: let's keep these options ordered lexicographically.\n\nOther than that the patch looks good to me, thanks!\n\nPatrick\n"},{"id":"530292","messageId":"aQxTatYlnSJwNjta@pks.im","threadId":"64434","inReplyTo":"xmqqms51rhbx.fsf@gitster.g","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-11-06T07:51:06Z","receivedAt":"2025-11-06T07:51:12Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Nov 04, 2025 at 06:41:06AM -0800, Junio C Hamano wrote:\n> \"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n> \n> > Makefile-based builds can configure Git's internal HTML_PATH by defining\n> > htmldir, which is useful for packagers that put documentation in\n> > different locations. Gentoo, for example, uses version-suffixed\n> > directories like ${prefix}/share/doc/git-2.51 and puts the HTML\n> > documentation in an 'html' subdirectory of the same.\n> >\n> > Propagate the same configuration knob to Meson-based builds so that\n> > \"git --html-path\" on such systems can be configured to output the\n> > correct directory.\n> >\n> > Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n> > ---\n> \n> Makes sense (a more meson-minded person needs to double check my\n> knee-jerk reaction, though).  It is surprising that \n> \n>     $ git grep \"dir', \" meson_options.txt\n>     meson_options.txt:option('perllibdir', type: 'string', value: '',\n> \n> has only a single hit (now two), though.  I thought we have a lot\n> more flexibility in our build process.\n\nThat was a concious decision when I introduced Meson. The discussion\nback then was whether most of the build options that we have are even\nused anywhere, so we eventually agreed to only add options on an\nas-needed basis.\n\n> I am also a bit surprised that these things are of type 'string'; I\n> somehow was expecting that more modern build system would offer\n> richer (relative to Makefile, that is) types like 'filename' or\n> 'path'.\n\nMeson provides tools to handle paths nicely [1], but it ultimately ends\nup using strings indeed.\n\n[1]: https://mesonbuild.com/Fs-module.html\n\nPatrick\n"},{"id":"530317","messageId":"0930DCB8-D545-4043-87F9-4359EA5351D9@gmail.com","threadId":"64434","inReplyTo":"aQxTZNYKKAsmL9Sg@pks.im","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-11-06T14:08:10Z","receivedAt":"2025-11-06T14:08:21Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> \n> Le 6 nov. 2025 à 02:51, Patrick Steinhardt <ps@pks.im> a écrit :\n> \n> ﻿On Tue, Nov 04, 2025 at 08:58:29AM -0500, D. Ben Knoble wrote:\n>> Makefile-based builds can configure Git's internal HTML_PATH by defining\n>> htmldir, which is useful for packagers that put documentation in\n>> different locations. Gentoo, for example, uses version-suffixed\n>> directories like ${prefix}/share/doc/git-2.51 and puts the HTML\n>> documentation in an 'html' subdirectory of the same.\n>> \n>> Propagate the same configuration knob to Meson-based builds so that\n>> \"git --html-path\" on such systems can be configured to output the\n>> correct directory.\n> \n> Makes sense.\n> \n>> diff --git a/Documentation/meson.build b/Documentation/meson.build\n>> index 9d24f2da54..c00c9fe7f4 100644\n>> --- a/Documentation/meson.build\n>> +++ b/Documentation/meson.build\n> \n> All of the conversions look sensible to me.\n> \n>> diff --git a/meson.build b/meson.build\n>> index 2b763f7c53..1f95a06edb 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -768,13 +768,18 @@ if test_output_directory == ''\n>>   test_output_directory = meson.project_build_root() / 'test-output'\n>> endif\n>> \n>> +htmldir = get_option('htmldir')\n>> +if htmldir == ''\n>> +  htmldir = get_option('datadir') / 'doc/git-doc'\n>> +endif\n> \n> This retains the status quo, good.\n> \n>> diff --git a/meson_options.txt b/meson_options.txt\n>> index 143dee9237..13d421c067 100644\n>> --- a/meson_options.txt\n>> +++ b/meson_options.txt\n>> @@ -1,6 +1,8 @@\n>> # Configuration for Git installation\n>> option('perllibdir', type: 'string', value: '',\n>>   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n>> +option('htmldir', type: 'string', value: '',\n>> +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n> \n> Tiny nit: let's keep these options ordered lexicographically.\n\nCan do. Shall I send v2, Junio?\n\n> \n> Other than that the patch looks good to me, thanks!\n> \n> Patrick\n\nThank you!"},{"id":"530323","messageId":"xmqqecqbji1z.fsf@gitster.g","threadId":"64434","inReplyTo":"0930DCB8-D545-4043-87F9-4359EA5351D9@gmail.com","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-11-06T15:29:28Z","receivedAt":"2025-11-06T15:29:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ben Knoble <ben.knoble@gmail.com> writes:\n\n>> Tiny nit: let's keep these options ordered lexicographically.\n>\n> Can do. Shall I send v2, Junio?\n\nWe would soon be in pre-release freeze starting with -rc1 that would\nhappen in a few hours, so there is no need to hurry.  v2 after the\nfinal release is good enough.\n\n"},{"id":"530496","messageId":"d6b86ed23e28c875b48fdc77095ace3f8ff4ee5d.1762820704.git.ben.knoble+github@gmail.com","threadId":"64434","inReplyTo":"385992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com","subject":"[PATCH] meson: make GIT_HTML_PATH configurable","fromName":"D. Ben Knoble","fromEmail":"ben.knoble+github@gmail.com","sentAt":"2025-11-11T00:25:04Z","receivedAt":"2025-11-11T00:26:22Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"Makefile-based builds can configure Git's internal HTML_PATH by defining\nhtmldir, which is useful for packagers that put documentation in\ndifferent locations. Gentoo, for example, uses version-suffixed\ndirectories like ${prefix}/share/doc/git-2.51 and puts the HTML\ndocumentation in an 'html' subdirectory of the same.\n\nPropagate the same configuration knob to Meson-based builds so that\n\"git --html-path\" on such systems can be configured to output the\ncorrect directory.\n\nSigned-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>\n---\n\nReorder options lexicographically for Patrick ;)\n\nv1: https://lore.kernel.org/git/85992f6020703558f0ba75a1be6c4f9dae08b83.1762264709.git.ben.knoble+github@gmail.com\n\n Documentation/howto/meson.build     |  4 ++--\n Documentation/meson.build           | 12 ++++++------\n Documentation/technical/meson.build |  4 ++--\n contrib/contacts/meson.build        |  2 +-\n contrib/subtree/meson.build         |  2 +-\n meson.build                         |  7 ++++++-\n meson_options.txt                   |  2 ++\n 7 files changed, 20 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build\nindex ece20244af..16b9056f24 100644\n--- a/Documentation/howto/meson.build\n+++ b/Documentation/howto/meson.build\n@@ -35,7 +35,7 @@ doc_targets += custom_target(\n   output: 'howto-index.html',\n   depends: documentation_deps,\n   install: true,\n-  install_dir: get_option('datadir') / 'doc/git-doc',\n+  install_dir: htmldir,\n )\n \n foreach howto : howto_sources\n@@ -57,6 +57,6 @@ foreach howto : howto_sources\n     output: fs.stem(howto_stripped.full_path()) + '.html',\n     depends: documentation_deps,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc/howto',\n+    install_dir: htmldir / 'howto',\n   )\n endforeach\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 9d24f2da54..c00c9fe7f4 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -412,7 +412,7 @@ foreach manpage, category : manpages\n       input: manpage,\n       output: fs.stem(manpage) + '.html',\n       install: true,\n-      install_dir: get_option('datadir') / 'doc/git-doc',\n+      install_dir: htmldir,\n     )\n   endif\n endforeach\n@@ -423,7 +423,7 @@ if get_option('docs').contains('html')\n     output: 'docinfo.html',\n     copy: true,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   configure_file(\n@@ -431,11 +431,11 @@ if get_option('docs').contains('html')\n     output: 'docbook-xsl.css',\n     copy: true,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   install_symlink('index.html',\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n     pointing_to: 'git.html',\n   )\n \n@@ -466,7 +466,7 @@ if get_option('docs').contains('html')\n     input: 'docbook.xsl',\n     output: 'user-manual.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n \n   articles = [\n@@ -492,7 +492,7 @@ if get_option('docs').contains('html')\n       output: fs.stem(article) + '.html',\n       depends: documentation_deps,\n       install: true,\n-      install_dir: get_option('datadir') / 'doc/git-doc',\n+      install_dir: htmldir,\n     )\n   endforeach\n \ndiff --git a/Documentation/technical/meson.build b/Documentation/technical/meson.build\nindex be698ef22a..faff3964a9 100644\n--- a/Documentation/technical/meson.build\n+++ b/Documentation/technical/meson.build\n@@ -53,7 +53,7 @@ doc_targets += custom_target(\n   output: 'api-index.html',\n   depends: documentation_deps,\n   install: true,\n-  install_dir: get_option('datadir') / 'doc/git-doc/technical',\n+  install_dir: htmldir / 'technical',\n )\n \n foreach article : api_docs + articles\n@@ -63,6 +63,6 @@ foreach article : api_docs + articles\n     output: fs.stem(article) + '.html',\n     depends: documentation_deps,\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc/technical',\n+    install_dir: htmldir / 'technical',\n   )\n endforeach\ndiff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build\nindex c8fdb35ed9..4ae6b32a03 100644\n--- a/contrib/contacts/meson.build\n+++ b/contrib/contacts/meson.build\n@@ -50,6 +50,6 @@ if get_option('docs').contains('html')\n     input: 'git-contacts.adoc',\n     output: 'git-contacts.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n endif\ndiff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build\nindex 46cdbcc30c..161435abeb 100644\n--- a/contrib/subtree/meson.build\n+++ b/contrib/subtree/meson.build\n@@ -68,6 +68,6 @@ if get_option('docs').contains('html')\n     input: 'git-subtree.adoc',\n     output: 'git-subtree.html',\n     install: true,\n-    install_dir: get_option('datadir') / 'doc/git-doc',\n+    install_dir: htmldir,\n   )\n endif\ndiff --git a/meson.build b/meson.build\nindex 2b763f7c53..1f95a06edb 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -768,13 +768,18 @@ if test_output_directory == ''\n   test_output_directory = meson.project_build_root() / 'test-output'\n endif\n \n+htmldir = get_option('htmldir')\n+if htmldir == ''\n+  htmldir = get_option('datadir') / 'doc/git-doc'\n+endif\n+\n # These variables are used for building libgit.a.\n libgit_c_args = [\n   '-DBINDIR=\"' + get_option('bindir') + '\"',\n   '-DDEFAULT_GIT_TEMPLATE_DIR=\"' + get_option('datadir') / 'git-core/templates' + '\"',\n   '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n   '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n-  '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n+  '-DGIT_HTML_PATH=\"' + htmldir + '\"',\n   '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n   '-DGIT_LOCALE_PATH=\"' + get_option('localedir') + '\"',\n   '-DGIT_MAN_PATH=\"' + get_option('mandir') + '\"',\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 143dee9237..e0be260ae1 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -1,4 +1,6 @@\n # Configuration for Git installation\n+option('htmldir', type: 'string', value: '',\n+  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n option('perllibdir', type: 'string', value: '',\n   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n \n\nDiff-intervalle :\n1:  385992f602 ! 1:  d6b86ed23e meson: make GIT_HTML_PATH configurable\n    @@ meson.build: if test_output_directory == ''\n      ## meson_options.txt ##\n     @@\n      # Configuration for Git installation\n    - option('perllibdir', type: 'string', value: '',\n    -   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n     +option('htmldir', type: 'string', value: '',\n     +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n    + option('perllibdir', type: 'string', value: '',\n    +   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n      \n    - # Configuration for how Git behaves at runtime.\n    - option('default_pager', type: 'string', value: 'less',\n\nbase-commit: 7f278e958afbf9b7e0727631b4c26dcfa1c63d6e\n-- \n2.52.0.rc0.71.g03eda12af0.dirty\n\n"},{"id":"530512","messageId":"CAOLa=ZTViq=OYoMQNdvi3rV+iUucGZ4RN0c7X_Q0PEugaEqqJQ@mail.gmail.com","threadId":"64434","inReplyTo":"d6b86ed23e28c875b48fdc77095ace3f8ff4ee5d.1762820704.git.ben.knoble+github@gmail.com","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-11-11T13:43:57Z","receivedAt":"2025-11-11T13:43:59Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n\n[snip]\n\n> diff --git a/meson.build b/meson.build\n> index 2b763f7c53..1f95a06edb 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -768,13 +768,18 @@ if test_output_directory == ''\n>    test_output_directory = meson.project_build_root() / 'test-output'\n>  endif\n>\n> +htmldir = get_option('htmldir')\n> +if htmldir == ''\n> +  htmldir = get_option('datadir') / 'doc/git-doc'\n> +endif\n> +\n>  # These variables are used for building libgit.a.\n>  libgit_c_args = [\n>    '-DBINDIR=\"' + get_option('bindir') + '\"',\n>    '-DDEFAULT_GIT_TEMPLATE_DIR=\"' + get_option('datadir') / 'git-core/templates' + '\"',\n>    '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n>    '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n> -  '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n> +  '-DGIT_HTML_PATH=\"' + htmldir + '\"',\n>    '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n>    '-DGIT_LOCALE_PATH=\"' + get_option('localedir') + '\"',\n>    '-DGIT_MAN_PATH=\"' + get_option('mandir') + '\"',\n> diff --git a/meson_options.txt b/meson_options.txt\n> index 143dee9237..e0be260ae1 100644\n> --- a/meson_options.txt\n> +++ b/meson_options.txt\n> @@ -1,4 +1,6 @@\n>  # Configuration for Git installation\n> +option('htmldir', type: 'string', value: '',\n> +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n>  option('perllibdir', type: 'string', value: '',\n>    description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n>\n>\n> Diff-intervalle :\n> 1:  385992f602 ! 1:  d6b86ed23e meson: make GIT_HTML_PATH configurable\n>     @@ meson.build: if test_output_directory == ''\n>       ## meson_options.txt ##\n>      @@\n>       # Configuration for Git installation\n>     - option('perllibdir', type: 'string', value: '',\n>     -   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n>      +option('htmldir', type: 'string', value: '',\n>      +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n>     + option('perllibdir', type: 'string', value: '',\n>     +   description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n>\n\nI guess meson doesn't allow recursive dependency for build options? I\nwas hoping we could do `value: get_option('datadir') / 'doc/git-doc'`\nand remove the custom block which checks for empty value above.\n\nAnyways the patch looks good.\n\n>     - # Configuration for how Git behaves at runtime.\n>     - option('default_pager', type: 'string', value: 'less',\n>\n> base-commit: 7f278e958afbf9b7e0727631b4c26dcfa1c63d6e\n> --\n> 2.52.0.rc0.71.g03eda12af0.dirty\n"},{"id":"530522","messageId":"CALnO6CDwnSYr5bpSFNBTixa0dnJ3yDSy=fCRN19Aj4Ms=_mvPA@mail.gmail.com","threadId":"64434","inReplyTo":"CAOLa=ZTViq=OYoMQNdvi3rV+iUucGZ4RN0c7X_Q0PEugaEqqJQ@mail.gmail.com","subject":"Re: [PATCH] meson: make GIT_HTML_PATH configurable","fromName":"D. Ben Knoble","fromEmail":"ben.knoble+github@gmail.com","sentAt":"2025-11-11T18:52:27Z","receivedAt":"2025-11-11T18:52:40Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"On Tue, Nov 11, 2025 at 8:43 AM Karthik Nayak <karthik.188@gmail.com> wrote:\n>\n> \"D. Ben Knoble\" <ben.knoble+github@gmail.com> writes:\n>\n> [snip]\n>\n> > diff --git a/meson.build b/meson.build\n> > index 2b763f7c53..1f95a06edb 100644\n> > --- a/meson.build\n> > +++ b/meson.build\n> > @@ -768,13 +768,18 @@ if test_output_directory == ''\n> >    test_output_directory = meson.project_build_root() / 'test-output'\n> >  endif\n> >\n> > +htmldir = get_option('htmldir')\n> > +if htmldir == ''\n> > +  htmldir = get_option('datadir') / 'doc/git-doc'\n> > +endif\n> > +\n> >  # These variables are used for building libgit.a.\n> >  libgit_c_args = [\n> >    '-DBINDIR=\"' + get_option('bindir') + '\"',\n> >    '-DDEFAULT_GIT_TEMPLATE_DIR=\"' + get_option('datadir') / 'git-core/templates' + '\"',\n> >    '-DFALLBACK_RUNTIME_PREFIX=\"' + get_option('prefix') + '\"',\n> >    '-DGIT_HOST_CPU=\"' + host_machine.cpu_family() + '\"',\n> > -  '-DGIT_HTML_PATH=\"' + get_option('datadir') / 'doc/git-doc\"',\n> > +  '-DGIT_HTML_PATH=\"' + htmldir + '\"',\n> >    '-DGIT_INFO_PATH=\"' + get_option('infodir') + '\"',\n> >    '-DGIT_LOCALE_PATH=\"' + get_option('localedir') + '\"',\n> >    '-DGIT_MAN_PATH=\"' + get_option('mandir') + '\"',\n> > diff --git a/meson_options.txt b/meson_options.txt\n> > index 143dee9237..e0be260ae1 100644\n> > --- a/meson_options.txt\n> > +++ b/meson_options.txt\n> > @@ -1,4 +1,6 @@\n> >  # Configuration for Git installation\n> > +option('htmldir', type: 'string', value: '',\n> > +  description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')\n> >  option('perllibdir', type: 'string', value: '',\n> >    description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')\n>\n> I guess meson doesn't allow recursive dependency for build options? I\n> was hoping we could do `value: get_option('datadir') / 'doc/git-doc'`\n> and remove the custom block which checks for empty value above.\n\nThe documentation [1] did not suggest that \"default\" could be\nevaluated as an expression here, and I copied the pattern from\nperllibdir [2]. If there's an alternative, I'm all ears.\n\n[1]: https://mesonbuild.com/Build-options.html\n[2]: https://github.com/git/git/blob/4badef0c3503dc29059d678abba7fac0f042bc84/meson.build#L1972-L1975\n\n> Anyways the patch looks good.\n\nThanks!\n"}]}