meson: wire up the git-subtree(1) command
Wire up the git-subtree(1) command, which is part of "contrib/". Note that we have to move around the exact location where we include the "contrib/" subdirectory so that it comes after building the docs so that we have access to some of the common functionality. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jan 17, 2025 at 10:56 UTC
8454b42f947e185a65b2950123493928558f2f5e
2 files changed
+73
-1
contrib/subtree/meson.build
new
+71
@@ -0,0 +1,71 @@
1
+git_subtree = custom_target(
2
+ input: 'git-subtree.sh',
3
+ output: 'git-subtree',
4
+ command: [
5
+ shell,
6
+ meson.project_source_root() / 'generate-script.sh',
7
+ '@INPUT@',
8
+ '@OUTPUT@',
9
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
10
+ ],
11
+ install: true,
12
+ install_dir: get_option('libexecdir') / 'git-core',
13
+)
14
+
15
+subtree_test_environment = test_environment
16
+subtree_test_environment.prepend('PATH', meson.current_build_dir())
17
+
18
+test('t7900-subtree', shell,
19
+ args: [ 't7900-subtree.sh' ],
20
+ env: subtree_test_environment,
21
+ workdir: meson.current_source_dir() / 't',
22
+ depends: test_dependencies + bin_wrappers + [ git_subtree ],
23
+ timeout: 0,
24
+)
25
+
26
+if get_option('docs').contains('man')
27
+ subtree_xml = custom_target(
28
+ command: asciidoc_common_options + [
29
+ '--backend=' + asciidoc_docbook,
30
+ '--doctype=manpage',
31
+ '--out-file=@OUTPUT@',
32
+ '@INPUT@',
33
+ ],
34
+ depends: documentation_deps,
35
+ input: 'git-subtree.txt',
36
+ output: 'git-subtree.xml',
37
+ )
38
+
39
+ custom_target(
40
+ command: [
41
+ xmlto,
42
+ '-m', '@INPUT@',
43
+ 'man',
44
+ subtree_xml,
45
+ '-o',
46
+ meson.current_build_dir(),
47
+ ] + xmlto_extra,
48
+ input: [
49
+ '../../Documentation/manpage-normal.xsl',
50
+ ],
51
+ output: 'git-subtree.1',
52
+ install: true,
53
+ install_dir: get_option('mandir') / 'man1',
54
+ )
55
+endif
56
+
57
+if get_option('docs').contains('html')
58
+ custom_target(
59
+ command: asciidoc_common_options + [
60
+ '--backend=' + asciidoc_html,
61
+ '--doctype=manpage',
62
+ '--out-file=@OUTPUT@',
63
+ '@INPUT@',
64
+ ],
65
+ depends: documentation_deps,
66
+ input: 'git-subtree.txt',
67
+ output: 'git-subtree.html',
68
+ install: true,
69
+ install_dir: get_option('datadir') / 'doc/git-doc',
70
+ )
71
+endif
meson.build
+2
-1
@@ -1857,7 +1857,6 @@ endforeach
1857
if intl.found()
1858
subdir('po')
1859
endif
1860
-subdir('contrib')
1860
1861
# Gitweb requires Perl, so we disable the auto-feature if Perl was not found.
1862
# We make sure further up that Perl is required in case the gitweb option is
@@ -1884,6 +1883,8 @@ if get_option('docs') != []
1883
subdir('Documentation')
1884
endif
1885
1886
+subdir('contrib')
1887
+
1888
foreach key, value : {
1889
'DIFF': diff.full_path(),
1890
'GIT_TEST_CMP': diff.full_path() + ' -u',