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
This commit is contained in:
Junio C Hamano
2025-01-28 13:02:23 -08:00
6 changed files with 95 additions and 10 deletions

View File

@ -1 +1,3 @@
subdir('completion')
foreach feature : get_option('contrib')
subdir(feature)
endforeach

View File

@ -1,4 +1,6 @@
*~
asciidoc.conf
asciidoctor-extensions.rb
git-subtree
git-subtree.1
git-subtree.html

View File

@ -1,6 +1,7 @@
# The default target of this Makefile is...
all::
-include ../../shared.mak
-include ../../config.mak.autogen
-include ../../config.mak
@ -13,17 +14,16 @@ htmldir ?= $(prefix)/share/doc/git-doc
../../GIT-VERSION-FILE: FORCE
$(MAKE) -C ../../ GIT-VERSION-FILE
-include ../../GIT-VERSION-FILE
# this should be set to a 'standard' bsd-type install program
INSTALL ?= install
RM ?= rm -f
ASCIIDOC = asciidoc
ASCIIDOC_CONF = -f ../../Documentation/asciidoc.conf
ASCIIDOC_CONF = -f asciidoc.conf
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_EXTRA =
ASCIIDOC_DEPS = asciidoc.conf
XMLTO = xmlto
XMLTO_EXTRA =
@ -32,8 +32,9 @@ ASCIIDOC = asciidoctor
ASCIIDOC_CONF =
ASCIIDOC_HTML = xhtml5
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_EXTRA += -I../../Documentation -rasciidoctor-extensions
ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
ASCIIDOC_DEPS = asciidoctor-extensions.rb
XMLTO_EXTRA += --skip-validation
endif
@ -82,13 +83,13 @@ install-html: $(GIT_SUBTREE_HTML)
$(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $^
$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
$(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
$(ASCIIDOC_EXTRA) $<
$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
-agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
$(ASCIIDOC_EXTRA) $<
$(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
cp $< $@
@ -98,6 +99,12 @@ test: $(GIT_SUBTREE_TEST)
clean:
$(RM) $(GIT_SUBTREE)
$(RM) asciidoc.conf asciidoctor-extensions.rb
$(RM) *.xml *.html *.1
asciidoc.conf: ../../Documentation/asciidoc.conf.in ../../GIT-VERSION-FILE
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
asciidoctor-extensions.rb: ../../Documentation/asciidoctor-extensions.rb.in ../../GIT-VERSION-FILE
$(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
.PHONY: FORCE

View File

@ -0,0 +1,71 @@
git_subtree = custom_target(
input: 'git-subtree.sh',
output: 'git-subtree',
command: [
shell,
meson.project_source_root() / 'generate-script.sh',
'@INPUT@',
'@OUTPUT@',
meson.project_build_root() / 'GIT-BUILD-OPTIONS',
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
subtree_test_environment = test_environment
subtree_test_environment.prepend('PATH', meson.current_build_dir())
test('t7900-subtree', shell,
args: [ 't7900-subtree.sh' ],
env: subtree_test_environment,
workdir: meson.current_source_dir() / 't',
depends: test_dependencies + bin_wrappers + [ git_subtree ],
timeout: 0,
)
if get_option('docs').contains('man')
subtree_xml = custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_docbook,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: 'git-subtree.txt',
output: 'git-subtree.xml',
)
custom_target(
command: [
xmlto,
'-m', '@INPUT@',
'man',
subtree_xml,
'-o',
meson.current_build_dir(),
] + xmlto_extra,
input: [
'../../Documentation/manpage-normal.xsl',
],
output: 'git-subtree.1',
install: true,
install_dir: get_option('mandir') / 'man1',
)
endif
if get_option('docs').contains('html')
custom_target(
command: asciidoc_common_options + [
'--backend=' + asciidoc_html,
'--doctype=manpage',
'--out-file=@OUTPUT@',
'@INPUT@',
],
depends: documentation_deps,
input: 'git-subtree.txt',
output: 'git-subtree.html',
install: true,
install_dir: get_option('datadir') / 'doc/git-doc',
)
endif