Skip to content

Commit 3ddeb7f

Browse files
committed
Merge branch 'ps/build-meson-subtree'
The meson-driven build is now aware of "git-subtree" housed in contrib/subtree hierarchy. * ps/build-meson-subtree: meson: wire up the git-subtree(1) command meson: introduce build option for contrib contrib/subtree: fix building docs
2 parents 63d555a + 8454b42 commit 3ddeb7f

File tree

6 files changed

+95
-10
lines changed

6 files changed

+95
-10
lines changed

contrib/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
subdir('completion')
1+
foreach feature : get_option('contrib')
2+
subdir(feature)
3+
endforeach

contrib/subtree/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
*~
2+
asciidoc.conf
3+
asciidoctor-extensions.rb
24
git-subtree
35
git-subtree.1
46
git-subtree.html

contrib/subtree/Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# The default target of this Makefile is...
22
all::
33

4+
-include ../../shared.mak
45
-include ../../config.mak.autogen
56
-include ../../config.mak
67

@@ -13,17 +14,16 @@ htmldir ?= $(prefix)/share/doc/git-doc
1314
../../GIT-VERSION-FILE: FORCE
1415
$(MAKE) -C ../../ GIT-VERSION-FILE
1516

16-
-include ../../GIT-VERSION-FILE
17-
1817
# this should be set to a 'standard' bsd-type install program
1918
INSTALL ?= install
2019
RM ?= rm -f
2120

2221
ASCIIDOC = asciidoc
23-
ASCIIDOC_CONF = -f ../../Documentation/asciidoc.conf
22+
ASCIIDOC_CONF = -f asciidoc.conf
2423
ASCIIDOC_HTML = xhtml11
2524
ASCIIDOC_DOCBOOK = docbook
2625
ASCIIDOC_EXTRA =
26+
ASCIIDOC_DEPS = asciidoc.conf
2727
XMLTO = xmlto
2828
XMLTO_EXTRA =
2929

@@ -32,8 +32,9 @@ ASCIIDOC = asciidoctor
3232
ASCIIDOC_CONF =
3333
ASCIIDOC_HTML = xhtml5
3434
ASCIIDOC_DOCBOOK = docbook
35-
ASCIIDOC_EXTRA += -I../../Documentation -rasciidoctor-extensions
35+
ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
3636
ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
37+
ASCIIDOC_DEPS = asciidoctor-extensions.rb
3738
XMLTO_EXTRA += --skip-validation
3839
endif
3940

@@ -82,13 +83,13 @@ install-html: $(GIT_SUBTREE_HTML)
8283
$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
8384
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $^
8485

85-
$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
86+
$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
8687
$(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
87-
-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
88+
$(ASCIIDOC_EXTRA) $<
8889

89-
$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
90+
$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
9091
$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
91-
-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
92+
$(ASCIIDOC_EXTRA) $<
9293

9394
$(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
9495
cp $< $@
@@ -98,6 +99,12 @@ test: $(GIT_SUBTREE_TEST)
9899

99100
clean:
100101
$(RM) $(GIT_SUBTREE)
102+
$(RM) asciidoc.conf asciidoctor-extensions.rb
101103
$(RM) *.xml *.html *.1
102104

105+
asciidoc.conf: ../../Documentation/asciidoc.conf.in ../../GIT-VERSION-FILE
106+
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
107+
asciidoctor-extensions.rb: ../../Documentation/asciidoctor-extensions.rb.in ../../GIT-VERSION-FILE
108+
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
109+
103110
.PHONY: FORCE

contrib/subtree/meson.build

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,6 @@ endforeach
18791879
if intl.found()
18801880
subdir('po')
18811881
endif
1882-
subdir('contrib')
18831882

18841883
# Gitweb requires Perl, so we disable the auto-feature if Perl was not found.
18851884
# We make sure further up that Perl is required in case the gitweb option is
@@ -1906,6 +1905,8 @@ if get_option('docs') != []
19061905
subdir('Documentation')
19071906
endif
19081907

1908+
subdir('contrib')
1909+
19091910
foreach key, value : {
19101911
'DIFF': diff.full_path(),
19111912
'GIT_TEST_CMP': diff.full_path() + ' -u',

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ option('version', type: 'string', value: '',
2727
description: 'Version string reported by git-version(1) and other tools.')
2828

2929
# Features supported by Git.
30+
option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],
31+
description: 'Contributed features to include.')
3032
option('curl', type: 'feature', value: 'enabled',
3133
description: 'Build helpers used to access remotes with the HTTP transport.')
3234
option('expat', type: 'feature', value: 'enabled',

0 commit comments

Comments
 (0)