diff --git a/contrib/meson.build b/contrib/meson.build index a7b77b87c2..d74b64a518 100644 --- a/contrib/meson.build +++ b/contrib/meson.build @@ -1 +1,3 @@ -subdir('completion') +foreach feature : get_option('contrib') + subdir(feature) +endforeach diff --git a/contrib/subtree/.gitignore b/contrib/subtree/.gitignore index 0b9381abca..6deaf177c7 100644 --- a/contrib/subtree/.gitignore +++ b/contrib/subtree/.gitignore @@ -1,4 +1,6 @@ *~ +asciidoc.conf +asciidoctor-extensions.rb git-subtree git-subtree.1 git-subtree.html diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile index 6fa7496bfd..8fe0bfd401 100644 --- a/contrib/subtree/Makefile +++ b/contrib/subtree/Makefile @@ -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 diff --git a/contrib/subtree/meson.build b/contrib/subtree/meson.build new file mode 100644 index 0000000000..a752a188df --- /dev/null +++ b/contrib/subtree/meson.build @@ -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 diff --git a/meson.build b/meson.build index 623caf7d5e..5b2fe99a0e 100644 --- a/meson.build +++ b/meson.build @@ -1879,7 +1879,6 @@ endforeach if intl.found() subdir('po') endif -subdir('contrib') # Gitweb requires Perl, so we disable the auto-feature if Perl was not found. # We make sure further up that Perl is required in case the gitweb option is @@ -1906,6 +1905,8 @@ if get_option('docs') != [] subdir('Documentation') endif +subdir('contrib') + foreach key, value : { 'DIFF': diff.full_path(), 'GIT_TEST_CMP': diff.full_path() + ' -u', diff --git a/meson_options.txt b/meson_options.txt index 89b01bad04..c0d72d85a3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -27,6 +27,8 @@ option('version', type: 'string', value: '', description: 'Version string reported by git-version(1) and other tools.') # Features supported by Git. +option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ], + description: 'Contributed features to include.') option('curl', type: 'feature', value: 'enabled', description: 'Build helpers used to access remotes with the HTTP transport.') option('expat', type: 'feature', value: 'enabled',