meson: make GIT_HTML_PATH configurable
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>
D. Ben Knoble committed
Nov 4, 2025 at 08:58 UTC
d63417e3ad67e5857cd52f9177fe39719d6ac84a
7 files changed
+20
-13
Documentation/howto/meson.build
+2
-2
@@ -35,7 +35,7 @@ doc_targets += custom_target(
35
output: 'howto-index.html',
36
depends: documentation_deps,
37
install: true,
38
- install_dir: get_option('datadir') / 'doc/git-doc',
38
+ install_dir: htmldir,
39
)
40
41
foreach howto : howto_sources
@@ -57,6 +57,6 @@ foreach howto : howto_sources
57
output: fs.stem(howto_stripped.full_path()) + '.html',
58
depends: documentation_deps,
59
install: true,
60
- install_dir: get_option('datadir') / 'doc/git-doc/howto',
60
+ install_dir: htmldir / 'howto',
61
)
62
endforeach
Documentation/meson.build
+6
-6
@@ -412,7 +412,7 @@ foreach manpage, category : manpages
412
input: manpage,
413
output: fs.stem(manpage) + '.html',
414
install: true,
415
- install_dir: get_option('datadir') / 'doc/git-doc',
415
+ install_dir: htmldir,
416
)
417
endif
418
endforeach
@@ -423,7 +423,7 @@ if get_option('docs').contains('html')
423
output: 'docinfo.html',
424
copy: true,
425
install: true,
426
- install_dir: get_option('datadir') / 'doc/git-doc',
426
+ install_dir: htmldir,
427
)
428
429
configure_file(
@@ -431,11 +431,11 @@ if get_option('docs').contains('html')
431
output: 'docbook-xsl.css',
432
copy: true,
433
install: true,
434
- install_dir: get_option('datadir') / 'doc/git-doc',
434
+ install_dir: htmldir,
435
)
436
437
install_symlink('index.html',
438
- install_dir: get_option('datadir') / 'doc/git-doc',
438
+ install_dir: htmldir,
439
pointing_to: 'git.html',
440
)
441
@@ -466,7 +466,7 @@ if get_option('docs').contains('html')
466
input: 'docbook.xsl',
467
output: 'user-manual.html',
468
install: true,
469
- install_dir: get_option('datadir') / 'doc/git-doc',
469
+ install_dir: htmldir,
470
)
471
472
articles = [
@@ -492,7 +492,7 @@ if get_option('docs').contains('html')
492
output: fs.stem(article) + '.html',
493
depends: documentation_deps,
494
install: true,
495
- install_dir: get_option('datadir') / 'doc/git-doc',
495
+ install_dir: htmldir,
496
)
497
endforeach
498
Documentation/technical/meson.build
+2
-2
@@ -53,7 +53,7 @@ doc_targets += custom_target(
53
output: 'api-index.html',
54
depends: documentation_deps,
55
install: true,
56
- install_dir: get_option('datadir') / 'doc/git-doc/technical',
56
+ install_dir: htmldir / 'technical',
57
)
58
59
foreach article : api_docs + articles
@@ -63,6 +63,6 @@ foreach article : api_docs + articles
63
output: fs.stem(article) + '.html',
64
depends: documentation_deps,
65
install: true,
66
- install_dir: get_option('datadir') / 'doc/git-doc/technical',
66
+ install_dir: htmldir / 'technical',
67
)
68
endforeach
contrib/contacts/meson.build
+1
-1
@@ -50,6 +50,6 @@ if get_option('docs').contains('html')
50
input: 'git-contacts.adoc',
51
output: 'git-contacts.html',
52
install: true,
53
- install_dir: get_option('datadir') / 'doc/git-doc',
53
+ install_dir: htmldir,
54
)
55
endif
contrib/subtree/meson.build
+1
-1
@@ -68,6 +68,6 @@ if get_option('docs').contains('html')
68
input: 'git-subtree.adoc',
69
output: 'git-subtree.html',
70
install: true,
71
- install_dir: get_option('datadir') / 'doc/git-doc',
71
+ install_dir: htmldir,
72
)
73
endif
meson.build
+6
-1
@@ -768,13 +768,18 @@ if test_output_directory == ''
768
test_output_directory = meson.project_build_root() / 'test-output'
769
endif
770
771
+htmldir = get_option('htmldir')
772
+if htmldir == ''
773
+ htmldir = get_option('datadir') / 'doc/git-doc'
774
+endif
775
+
776
# These variables are used for building libgit.a.
777
libgit_c_args = [
778
'-DBINDIR="' + get_option('bindir') + '"',
779
'-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
780
'-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
781
'-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
777
- '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
782
+ '-DGIT_HTML_PATH="' + htmldir + '"',
783
'-DGIT_INFO_PATH="' + get_option('infodir') + '"',
784
'-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
785
'-DGIT_MAN_PATH="' + get_option('mandir') + '"',
meson_options.txt
+2
@@ -1,4 +1,6 @@
1
# Configuration for Git installation
2
+option('htmldir', type: 'string', value: '',
3
+ description: 'Directory to install HTML docs to. Defaults to <datadir>/doc/git-doc')
4
option('perllibdir', type: 'string', value: '',
5
description: 'Directory to install perl lib to. Defaults to <datadir>/perl5')
6