]> git.ipfire.org Git - thirdparty/git.git/commitdiff
meson: make GIT_HTML_PATH configurable
authorD. Ben Knoble <ben.knoble+github@gmail.com>
Tue, 4 Nov 2025 13:58:29 +0000 (08:58 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Nov 2025 17:58:56 +0000 (09:58 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/howto/meson.build
Documentation/meson.build
Documentation/technical/meson.build
contrib/contacts/meson.build
contrib/subtree/meson.build
meson.build
meson_options.txt

index ece20244af2ad3e875b030a83d83ef459c3d574c..16b9056f24e12e9527c87b0859caeb29a5c0f78f 100644 (file)
@@ -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
index 9d24f2da5446824224c58b7a0b0d386c1bdf5b6f..c00c9fe7f429a5e06963a6aadda05e7e5b8b7334 100644 (file)
@@ -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
 
index be698ef22a30eaf49e226f7d47d96cc5dfd4a5b9..faff3964a9bef5d5d926ebb71353be6fd747a449 100644 (file)
@@ -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
index c8fdb35ed990ee80aa41665904b2bdfb72729081..4ae6b32a033de9d5fc12ddde756cc784c6cc0ff9 100644 (file)
@@ -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
index 46cdbcc30c9bd766866821d53e9ad37b927d186a..161435abebd476884aa902c943b58ba5e26d1468 100644 (file)
@@ -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
index 2b763f7c53493cf17947e577a5f3e5d79fe14d14..1f95a06edb78297bee870b181e2878320c153dd4 100644 (file)
@@ -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') + '"',
index 143dee9237cb41727c937bea5cc5ee2f77aa39bc..e0be260ae1bce84f53971e1b987a079758d00b31 100644 (file)
@@ -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')