Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/src/doc/meson.build
4052 views
1
if not get_option('build-docs')
2
subdir_done()
3
endif
4
5
sphinx_check = py_module.find_installation(required: false, modules: ['sphinx'])
6
if not sphinx_check.found()
7
warning(
8
'Python package "sphinx" is not installed. Documentation build not enabled.',
9
)
10
subdir_done()
11
endif
12
13
14
doc_src = []
15
subdir('en/reference/repl')
16
# TODO: Migrate this completely to meson
17
doc_src += custom_target(
18
'doc-src',
19
output: ['autogen'],
20
command: [files('bootstrap')],
21
env: {'SAGE_ROOT': root},
22
)
23
24
references = run_command(
25
py,
26
[
27
src / 'build-docs.py',
28
'--all-documents',
29
'reference',
30
'--source',
31
meson.current_source_dir(),
32
],
33
check: true,
34
).stdout().strip()
35
36
reference_inventory = []
37
reference_html = []
38
reference_pdf = []
39
bibliography = []
40
foreach type : ['inventory', 'html', 'pdf']
41
foreach ref : references.splitlines()
42
if '/' in ref
43
short_ref = ref.split('/')[1]
44
else
45
short_ref = ref
46
endif
47
deps = []
48
deps += doc_src
49
if type == 'html' or type == 'pdf'
50
deps += reference_inventory
51
endif
52
if short_ref != 'references'
53
deps += bibliography
54
endif
55
if short_ref == 'reference_top'
56
deps += reference_inventory
57
if type == 'html'
58
deps += reference_html
59
elif type == 'pdf'
60
deps += reference_pdf
61
endif
62
endif
63
target = custom_target(
64
'doc-' + type + '-reference-' + short_ref,
65
output: [type + short_ref],
66
command: [
67
py,
68
src / 'build-docs.py',
69
'--no-pdf-links',
70
ref,
71
type,
72
'-o',
73
'@OUTDIR@',
74
'--source',
75
meson.current_source_dir(),
76
],
77
depends: deps,
78
)
79
if short_ref == 'references'
80
bibliography += target
81
endif
82
if type == 'inventory'
83
reference_inventory += target
84
elif type == 'html'
85
reference_html += target
86
elif type == 'pdf'
87
reference_pdf += target
88
endif
89
endforeach
90
endforeach
91
92
other_documents = run_command(
93
py,
94
[
95
src / 'build-docs.py',
96
'--all-documents',
97
'all',
98
'--source',
99
meson.current_source_dir(),
100
],
101
check: true,
102
).stdout().strip()
103
other_documents_html = []
104
other_documents_pdf = []
105
foreach type : ['html', 'pdf']
106
foreach doc : other_documents.splitlines()
107
short_doc = doc.replace('/', '-')
108
target = custom_target(
109
'doc-' + type + '-other-' + short_doc,
110
output: [type + short_doc],
111
command: [
112
py,
113
src / 'build-docs.py',
114
'--no-pdf-links',
115
doc,
116
type,
117
'-o',
118
'@OUTDIR@',
119
'--source',
120
meson.current_source_dir(),
121
],
122
depends: reference_inventory,
123
)
124
if type == 'html'
125
other_documents_html += target
126
elif type == 'pdf'
127
other_documents_pdf += target
128
endif
129
endforeach
130
endforeach
131
132
# Custom target for building the complete documentation
133
alias_target('doc-html', [reference_html, other_documents_html])
134
alias_target('doc-pdf', [reference_pdf, other_documents_pdf])
135
136