interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / Documentation / meson.build

548 lines · 14635 bytes Raw Blame History
1manpages = {
2 # Category 1.
3 'git-add.adoc' : 1,
4 'git-am.adoc' : 1,
5 'git-annotate.adoc' : 1,
6 'git-apply.adoc' : 1,
7 'git-archimport.adoc' : 1,
8 'git-archive.adoc' : 1,
9 'git-backfill.adoc' : 1,
10 'git-bisect.adoc' : 1,
11 'git-blame.adoc' : 1,
12 'git-branch.adoc' : 1,
13 'git-bugreport.adoc' : 1,
14 'git-bundle.adoc' : 1,
15 'git-cat-file.adoc' : 1,
16 'git-check-attr.adoc' : 1,
17 'git-check-ignore.adoc' : 1,
18 'git-check-mailmap.adoc' : 1,
19 'git-checkout-index.adoc' : 1,
20 'git-checkout.adoc' : 1,
21 'git-check-ref-format.adoc' : 1,
22 'git-cherry-pick.adoc' : 1,
23 'git-cherry.adoc' : 1,
24 'git-citool.adoc' : 1,
25 'git-clean.adoc' : 1,
26 'git-clone.adoc' : 1,
27 'git-column.adoc' : 1,
28 'git-commit-graph.adoc' : 1,
29 'git-commit-tree.adoc' : 1,
30 'git-commit.adoc' : 1,
31 'git-config.adoc' : 1,
32 'git-count-objects.adoc' : 1,
33 'git-credential-cache--daemon.adoc' : 1,
34 'git-credential-cache.adoc' : 1,
35 'git-credential-store.adoc' : 1,
36 'git-credential.adoc' : 1,
37 'git-cvsexportcommit.adoc' : 1,
38 'git-cvsimport.adoc' : 1,
39 'git-cvsserver.adoc' : 1,
40 'git-daemon.adoc' : 1,
41 'git-describe.adoc' : 1,
42 'git-diagnose.adoc' : 1,
43 'git-diff-files.adoc' : 1,
44 'git-diff-index.adoc' : 1,
45 'git-diff-pairs.adoc' : 1,
46 'git-difftool.adoc' : 1,
47 'git-diff-tree.adoc' : 1,
48 'git-diff.adoc' : 1,
49 'git-fast-export.adoc' : 1,
50 'git-fast-import.adoc' : 1,
51 'git-fetch-pack.adoc' : 1,
52 'git-fetch.adoc' : 1,
53 'git-filter-branch.adoc' : 1,
54 'git-fmt-merge-msg.adoc' : 1,
55 'git-for-each-ref.adoc' : 1,
56 'git-for-each-repo.adoc' : 1,
57 'git-format-patch.adoc' : 1,
58 'git-format-rev.adoc' : 1,
59 'git-fsck-objects.adoc' : 1,
60 'git-fsck.adoc' : 1,
61 'git-fsmonitor--daemon.adoc' : 1,
62 'git-gc.adoc' : 1,
63 'git-get-tar-commit-id.adoc' : 1,
64 'git-grep.adoc' : 1,
65 'git-gui.adoc' : 1,
66 'git-hash-object.adoc' : 1,
67 'git-help.adoc' : 1,
68 'git-history.adoc' : 1,
69 'git-hook.adoc' : 1,
70 'git-http-backend.adoc' : 1,
71 'git-http-fetch.adoc' : 1,
72 'git-http-push.adoc' : 1,
73 'git-imap-send.adoc' : 1,
74 'git-index-pack.adoc' : 1,
75 'git-init-db.adoc' : 1,
76 'git-init.adoc' : 1,
77 'git-instaweb.adoc' : 1,
78 'git-interpret-trailers.adoc' : 1,
79 'git-last-modified.adoc' : 1,
80 'git-log.adoc' : 1,
81 'git-ls-files.adoc' : 1,
82 'git-ls-remote.adoc' : 1,
83 'git-ls-tree.adoc' : 1,
84 'git-mailinfo.adoc' : 1,
85 'git-mailsplit.adoc' : 1,
86 'git-maintenance.adoc' : 1,
87 'git-merge-base.adoc' : 1,
88 'git-merge-file.adoc' : 1,
89 'git-merge-index.adoc' : 1,
90 'git-merge-one-file.adoc' : 1,
91 'git-mergetool--lib.adoc' : 1,
92 'git-mergetool.adoc' : 1,
93 'git-merge-tree.adoc' : 1,
94 'git-merge.adoc' : 1,
95 'git-mktag.adoc' : 1,
96 'git-mktree.adoc' : 1,
97 'git-multi-pack-index.adoc' : 1,
98 'git-mv.adoc' : 1,
99 'git-name-rev.adoc' : 1,
100 'git-notes.adoc' : 1,
101 'git-p4.adoc' : 1,
102 'git-pack-objects.adoc' : 1,
103 'git-pack-refs.adoc' : 1,
104 'git-patch-id.adoc' : 1,
105 'git-prune-packed.adoc' : 1,
106 'git-prune.adoc' : 1,
107 'git-pull.adoc' : 1,
108 'git-push.adoc' : 1,
109 'git-quiltimport.adoc' : 1,
110 'git-range-diff.adoc' : 1,
111 'git-read-tree.adoc' : 1,
112 'git-rebase.adoc' : 1,
113 'git-receive-pack.adoc' : 1,
114 'git-reflog.adoc' : 1,
115 'git-refs.adoc' : 1,
116 'git-remote-ext.adoc' : 1,
117 'git-remote-fd.adoc' : 1,
118 'git-remote.adoc' : 1,
119 'git-repack.adoc' : 1,
120 'git-replace.adoc' : 1,
121 'git-replay.adoc' : 1,
122 'git-repo.adoc' : 1,
123 'git-request-pull.adoc' : 1,
124 'git-rerere.adoc' : 1,
125 'git-reset.adoc' : 1,
126 'git-restore.adoc' : 1,
127 'git-revert.adoc' : 1,
128 'git-rev-list.adoc' : 1,
129 'git-rev-parse.adoc' : 1,
130 'git-rm.adoc' : 1,
131 'git-send-email.adoc' : 1,
132 'git-send-pack.adoc' : 1,
133 'git-shell.adoc' : 1,
134 'git-sh-i18n--envsubst.adoc' : 1,
135 'git-sh-i18n.adoc' : 1,
136 'git-shortlog.adoc' : 1,
137 'git-show-branch.adoc' : 1,
138 'git-show-index.adoc' : 1,
139 'git-show-ref.adoc' : 1,
140 'git-show.adoc' : 1,
141 'git-sh-setup.adoc' : 1,
142 'git-sparse-checkout.adoc' : 1,
143 'git-stage.adoc' : 1,
144 'git-stash.adoc' : 1,
145 'git-status.adoc' : 1,
146 'git-stripspace.adoc' : 1,
147 'git-submodule.adoc' : 1,
148 'git-svn.adoc' : 1,
149 'git-switch.adoc' : 1,
150 'git-symbolic-ref.adoc' : 1,
151 'git-tag.adoc' : 1,
152 'git-unpack-file.adoc' : 1,
153 'git-unpack-objects.adoc' : 1,
154 'git-update-index.adoc' : 1,
155 'git-update-ref.adoc' : 1,
156 'git-update-server-info.adoc' : 1,
157 'git-upload-archive.adoc' : 1,
158 'git-upload-pack.adoc' : 1,
159 'git-url-parse.adoc' : 1,
160 'git-var.adoc' : 1,
161 'git-verify-commit.adoc' : 1,
162 'git-verify-pack.adoc' : 1,
163 'git-verify-tag.adoc' : 1,
164 'git-version.adoc' : 1,
165 'git-web--browse.adoc' : 1,
166 'git-worktree.adoc' : 1,
167 'git-write-tree.adoc' : 1,
168 'git.adoc' : 1,
169 'gitk.adoc' : 1,
170 'gitweb.adoc' : 1,
171 'scalar.adoc' : 1,
172
173 # Category 5.
174 'gitattributes.adoc' : 5,
175 'gitformat-bundle.adoc' : 5,
176 'gitformat-chunk.adoc' : 5,
177 'gitformat-commit-graph.adoc' : 5,
178 'gitformat-index.adoc' : 5,
179 'gitformat-loose.adoc' : 5,
180 'gitformat-pack.adoc' : 5,
181 'gitformat-signature.adoc' : 5,
182 'githooks.adoc' : 5,
183 'gitignore.adoc' : 5,
184 'gitmailmap.adoc' : 5,
185 'gitmodules.adoc' : 5,
186 'gitprotocol-capabilities.adoc' : 5,
187 'gitprotocol-common.adoc' : 5,
188 'gitprotocol-http.adoc' : 5,
189 'gitprotocol-pack.adoc' : 5,
190 'gitprotocol-v2.adoc' : 5,
191 'gitrepository-layout.adoc' : 5,
192 'gitweb.conf.adoc' : 5,
193
194 # Category 7.
195 'gitcli.adoc' : 7,
196 'gitcore-tutorial.adoc' : 7,
197 'gitcredentials.adoc' : 7,
198 'gitcvs-migration.adoc' : 7,
199 'gitdatamodel.adoc' : 7,
200 'gitdiffcore.adoc' : 7,
201 'giteveryday.adoc' : 7,
202 'gitfaq.adoc' : 7,
203 'gitglossary.adoc' : 7,
204 'gitpacking.adoc' : 7,
205 'gitmergeconflicts.adoc' : 7,
206 'gitnamespaces.adoc' : 7,
207 'gitremote-helpers.adoc' : 7,
208 'gitrevisions.adoc' : 7,
209 'gitsubmodules.adoc' : 7,
210 'gittutorial-2.adoc' : 7,
211 'gittutorial.adoc' : 7,
212 'gitworkflows.adoc' : 7,
213}
214
215manpages_breaking_changes = {
216 'git-pack-redundant.adoc' : 1,
217 'git-whatchanged.adoc' : 1,
218}
219
220if not get_option('breaking_changes')
221 manpages += manpages_breaking_changes
222endif
223
224docs_backend = get_option('docs_backend')
225if docs_backend == 'auto'
226 if find_program('asciidoc', dirs: program_path, native: true, required: false).found()
227 docs_backend = 'asciidoc'
228 elif find_program('asciidoctor', dirs: program_path, native: true, required: false).found()
229 docs_backend = 'asciidoctor'
230 else
231 error('Neither asciidoc nor asciidoctor were found.')
232 endif
233endif
234
235if docs_backend == 'asciidoc'
236 asciidoc = find_program('asciidoc', dirs: program_path, native: true)
237 asciidoc_html = 'xhtml11'
238 asciidoc_docbook = 'docbook'
239 xmlto_extra = [ ]
240
241 asciidoc_conf = custom_target(
242 command: [
243 shell,
244 meson.project_source_root() / 'GIT-VERSION-GEN',
245 meson.project_source_root(),
246 '@INPUT@',
247 '@OUTPUT@',
248 ],
249 input: 'asciidoc.conf.in',
250 output: 'asciidoc.conf',
251 depends: [git_version_file],
252 env: version_gen_environment,
253 )
254
255 asciidoc_common_options = [
256 asciidoc,
257 '--conf-file=' + asciidoc_conf.full_path(),
258 '--attribute=build_dir=' + meson.current_build_dir(),
259 ]
260
261 pager_opt = get_option('default_pager')
262 if pager_opt != '' and pager_opt != 'less'
263 asciidoc_common_options += '-agit-default-pager=' + pager_opt
264 endif
265
266 editor_opt = get_option('default_editor')
267 if editor_opt != '' and editor_opt != 'vi'
268 asciidoc_common_options += '-agit-default-editor=' + editor_opt
269 endif
270
271 documentation_deps = [
272 asciidoc_conf,
273 ]
274elif docs_backend == 'asciidoctor'
275 asciidoctor = find_program('asciidoctor', dirs: program_path, native: true)
276 asciidoc_html = 'xhtml5'
277 asciidoc_docbook = 'docbook5'
278 xmlto_extra = [
279 '--skip-validation',
280 '-x', meson.current_source_dir() / 'manpage.xsl',
281 ]
282
283 asciidoctor_extensions = custom_target(
284 command: [
285 shell,
286 meson.project_source_root() / 'GIT-VERSION-GEN',
287 meson.project_source_root(),
288 '@INPUT@',
289 '@OUTPUT@',
290 ],
291 input: 'asciidoctor-extensions.rb.in',
292 output: 'asciidoctor-extensions.rb',
293 depends: [git_version_file],
294 env: version_gen_environment,
295 )
296
297 asciidoc_common_options = [
298 asciidoctor,
299 '--attribute', 'compat-mode',
300 '--attribute', 'tabsize=8',
301 '--attribute', 'litdd=--',
302 '--attribute', 'docinfo=shared',
303 '--attribute', 'build_dir=' + meson.current_build_dir(),
304 '--load-path', meson.current_build_dir(),
305 '--require', 'asciidoctor-extensions',
306 ]
307
308 pager_opt = get_option('default_pager')
309 if pager_opt != '' and pager_opt != 'less'
310 asciidoc_common_options += '-agit-default-pager=' + pager_opt
311 endif
312
313 editor_opt = get_option('default_editor')
314 if editor_opt != '' and editor_opt != 'vi'
315 asciidoc_common_options += '-agit-default-editor=' + editor_opt
316 endif
317
318 documentation_deps = [
319 asciidoctor_extensions,
320 ]
321endif
322
323if get_option('breaking_changes')
324 asciidoc_common_options += ['--attribute', 'with-breaking-changes']
325endif
326
327xmlto = find_program('xmlto', dirs: program_path, native: true)
328
329cmd_lists = [
330 'cmds-ancillaryinterrogators.adoc',
331 'cmds-ancillarymanipulators.adoc',
332 'cmds-mainporcelain.adoc',
333 'cmds-plumbinginterrogators.adoc',
334 'cmds-plumbingmanipulators.adoc',
335 'cmds-synchingrepositories.adoc',
336 'cmds-synchelpers.adoc',
337 'cmds-guide.adoc',
338 'cmds-developerinterfaces.adoc',
339 'cmds-userinterfaces.adoc',
340 'cmds-purehelpers.adoc',
341 'cmds-foreignscminterface.adoc',
342]
343
344documentation_deps += custom_target(
345 command: [
346 shell,
347 '@INPUT@',
348 meson.project_source_root(),
349 meson.current_build_dir(),
350 ] + cmd_lists,
351 input: 'cmd-list.sh',
352 output: cmd_lists
353)
354
355foreach mode : [ 'diff', 'merge' ]
356 documentation_deps += custom_target(
357 command: [
358 shell,
359 '@INPUT@',
360 meson.project_source_root(),
361 mode,
362 '@OUTPUT@'
363 ],
364 input: 'generate-mergetool-list.sh',
365 output: 'mergetools-' + mode + '.adoc',
366 )
367endforeach
368
369foreach manpage, category : manpages
370 if get_option('docs').contains('man')
371 manpage_xml_target = custom_target(
372 command: asciidoc_common_options + [
373 '--backend=' + asciidoc_docbook,
374 '--doctype=manpage',
375 '--out-file=@OUTPUT@',
376 '@INPUT@',
377 ],
378 depends: documentation_deps,
379 input: manpage,
380 output: fs.stem(manpage) + '.xml',
381 )
382
383 man_base_url = 'file://' + htmldir + '/'
384 if get_option('man_base_url') != ''
385 man_base_url = get_option('man_base_url')
386 endif
387
388 doc_targets += custom_target(
389 command: [
390 xmlto,
391 '-m', '@INPUT0@',
392 '-m', '@INPUT1@',
393 '--stringparam',
394 'man.base.url.for.relative.links=' + man_base_url,
395 'man',
396 manpage_xml_target,
397 '-o',
398 meson.current_build_dir(),
399 ] + xmlto_extra,
400 input: [
401 'manpage-normal.xsl',
402 'manpage-bold-literal.xsl',
403 ],
404 output: fs.stem(manpage) + '.' + category.to_string(),
405 install: true,
406 install_dir: get_option('mandir') / 'man' + category.to_string(),
407 )
408 endif
409
410 if get_option('docs').contains('html')
411 doc_targets += custom_target(
412 command: asciidoc_common_options + [
413 '--backend=' + asciidoc_html,
414 '--doctype=manpage',
415 '--out-file=@OUTPUT@',
416 '@INPUT@',
417 ],
418 depends: documentation_deps,
419 input: manpage,
420 output: fs.stem(manpage) + '.html',
421 install: true,
422 install_dir: htmldir,
423 )
424 endif
425endforeach
426
427if get_option('docs').contains('html')
428 configure_file(
429 input: 'docinfo-html.in',
430 output: 'docinfo.html',
431 copy: true,
432 install: true,
433 install_dir: htmldir,
434 )
435
436 configure_file(
437 input: 'docbook-xsl.css',
438 output: 'docbook-xsl.css',
439 copy: true,
440 install: true,
441 install_dir: htmldir,
442 )
443
444 install_symlink('index.html',
445 install_dir: htmldir,
446 pointing_to: 'git.html',
447 )
448
449 xsltproc = find_program('xsltproc', dirs: program_path, native: true)
450
451 user_manual_xml = custom_target(
452 command: asciidoc_common_options + [
453 '--backend=' + asciidoc_docbook,
454 '--doctype=book',
455 '--out-file=@OUTPUT@',
456 '@INPUT@',
457 ],
458 input: 'user-manual.adoc',
459 output: 'user-manual.xml',
460 depends: documentation_deps,
461 )
462
463 doc_targets += custom_target(
464 command: [
465 xsltproc,
466 '--xinclude',
467 '--stringparam', 'html.stylesheet', 'docbook-xsl.css',
468 '--param', 'generate.consistent.ids', '1',
469 '--output', '@OUTPUT@',
470 '@INPUT@',
471 user_manual_xml,
472 ],
473 input: 'docbook.xsl',
474 output: 'user-manual.html',
475 install: true,
476 install_dir: htmldir,
477 )
478
479 articles = [
480 'BreakingChanges.adoc',
481 'DecisionMaking.adoc',
482 'MyFirstContribution.adoc',
483 'MyFirstObjectWalk.adoc',
484 'ReviewingGuidelines.adoc',
485 'SubmittingPatches',
486 'ToolsForGit.adoc',
487 'git-bisect-lk2009.adoc',
488 'git-tools.adoc',
489 ]
490
491 foreach article : articles
492 doc_targets += custom_target(
493 command: asciidoc_common_options + [
494 '--backend=' + asciidoc_html,
495 '--out-file=@OUTPUT@',
496 '@INPUT@',
497 ],
498 input: article,
499 output: fs.stem(article) + '.html',
500 depends: documentation_deps,
501 install: true,
502 install_dir: htmldir,
503 )
504 endforeach
505
506 asciidoc_html_options = asciidoc_common_options + [
507 '--backend=' + asciidoc_html,
508 '--out-file=@OUTPUT@',
509 '--attribute', 'git-relative-html-prefix=../',
510 '@INPUT@',
511 ]
512
513 subdir('howto')
514 subdir('technical')
515endif
516
517# Sanity check that we are not missing any tests present in 't/'. This check
518# only runs once at configure time and is thus best-effort, only. Furthermore,
519# it only verifies man pages for the sake of simplicity.
520configured_manpages = manpages.keys()
521configured_manpages += manpages_breaking_changes.keys()
522configured_manpages += [ 'git-bisect-lk2009.adoc', 'git-tools.adoc' ]
523actual_manpages = run_command(shell, '-c', 'ls git*.adoc scalar.adoc',
524 check: true,
525 env: script_environment,
526).stdout().strip().split('\n')
527
528if configured_manpages != actual_manpages
529 missing_manpage = [ ]
530 foreach actual_manpage : actual_manpages
531 if actual_manpage not in configured_manpages
532 missing_manpage += actual_manpage
533 endif
534 endforeach
535 if missing_manpage.length() > 0
536 error('Man page found, but not configured:\n\n - ' + '\n - '.join(missing_manpage))
537 endif
538
539 superfluous_manpage = [ ]
540 foreach configured_manpage : configured_manpages
541 if configured_manpage not in actual_manpages
542 superfluous_manpage += configured_manpage
543 endif
544 endforeach
545 if superfluous_manpage.length() > 0
546 error('Man page configured, but not found:\n\n - ' + '\n - '.join(superfluous_manpage))
547 endif
548endif