Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ef07d35

Browse files
committed
meson: add docs, docs_pdf options
Detect and report if the tools necessary to build documentation are available during configure. This is represented as two new options 'docs' and 'docs_pdf', both defaulting to 'auto'. This should also fix a meson error about the installdocs target, when none of the doc tools are found. Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://postgr.es/m/20230325201414.sh7c6xlut2fpunnv@awork3.anarazel.de Discussion: https://postgr.es/m/ZB8331v5IhUA/pNu@telsasoft.com
1 parent 0ba827e commit ef07d35

File tree

4 files changed

+86
-16
lines changed

4 files changed

+86
-16
lines changed

doc/src/sgml/installation.sgml

+33
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,39 @@ ninja install
28932893
</variablelist>
28942894
</sect3>
28952895

2896+
<sect3 id="meson-options-docs">
2897+
<title>Documentation</title>
2898+
2899+
<para>
2900+
See <xref linkend="docguide-toolsets"/> for the tools needed for building
2901+
the documentation.
2902+
</para>
2903+
2904+
<variablelist>
2905+
2906+
<varlistentry id="configure-docs-meson">
2907+
<term><option>-Ddocs={ auto | enabled | disabled }</option></term>
2908+
<listitem>
2909+
<para>
2910+
Enables building the documentation in <acronym>HTML</acronym> and
2911+
<acronym>man</acronym> format. It defaults to auto.
2912+
</para>
2913+
</listitem>
2914+
</varlistentry>
2915+
2916+
<varlistentry id="configure-docs-pdf-meson">
2917+
<term><option>-Ddocs_pdf={ auto | enabled | disabled }</option></term>
2918+
<listitem>
2919+
<para>
2920+
Enables building the documentation in <acronym>PDF</acronym>
2921+
format. It defaults to auto.
2922+
</para>
2923+
</listitem>
2924+
</varlistentry>
2925+
2926+
</variablelist>
2927+
</sect3>
2928+
28962929
<sect3 id="meson-options-misc">
28972930
<title>Miscellaneous</title>
28982931

doc/src/sgml/meson.build

+7-16
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ installdocs = []
55
alldocs = []
66
doc_generated = []
77

8-
xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
9-
10-
118
version_sgml = configure_file(
129
input: 'version.sgml.in',
1310
output: 'version.sgml',
@@ -68,8 +65,6 @@ if not xmllint_bin.found()
6865
endif
6966

7067
pandoc = find_program('pandoc', native: true, required: false)
71-
xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
72-
fop = find_program('fop', native: true, required: false)
7368

7469
xmltools_wrapper = [
7570
python, files('xmltools_dep_wrapper'),
@@ -117,7 +112,7 @@ endif
117112
#
118113
# Full documentation as html, text
119114
#
120-
if xsltproc_bin.found()
115+
if docs_dep.found()
121116
html = custom_target('html',
122117
input: ['stylesheet.xsl', postgres_full_xml],
123118
output: 'html',
@@ -167,7 +162,7 @@ endif
167162
#
168163
# INSTALL in html, text
169164
#
170-
if xsltproc_bin.found()
165+
if docs_dep.found()
171166
# Depend on postgres_full_xml, so validity errors are raised in one place,
172167
# and so dependencies don't need to be re-specified.
173168
install_xml = custom_target('INSTALL.xml',
@@ -204,7 +199,7 @@ endif
204199
#
205200
# Man pages
206201
#
207-
if xsltproc_bin.found()
202+
if docs_dep.found()
208203
# FIXME: implement / consider sqlmansectnum logic
209204
man = custom_target('man',
210205
input: ['stylesheet-man.xsl', postgres_full_xml],
@@ -233,7 +228,7 @@ endif
233228
#
234229
# Full documentation as PDF
235230
#
236-
if fop.found() and xsltproc_bin.found()
231+
if docs_pdf_dep.found()
237232
xsltproc_fo_flags = xsltproc_flags + [
238233
'--stringparam', 'img.src.path', meson.current_source_dir() + '/'
239234
]
@@ -291,7 +286,7 @@ db2x_xsltproc = find_program('db2x_xsltproc', native: true, required: false)
291286
db2x_texixml = find_program('db2x_texixml', native: true, required: false)
292287
makeinfo = find_program('makeinfo', native: true, required: false)
293288

294-
if db2x_texixml.found() and db2x_xsltproc.found() and makeinfo.found()
289+
if xsltproc_bin.found() and db2x_texixml.found() and db2x_xsltproc.found() and makeinfo.found()
295290
postgres_texixml = custom_target('postgres.texixml',
296291
output: 'postgres.texixml',
297292
command: [db2x_xsltproc, '-s', 'texi',
@@ -315,15 +310,11 @@ if db2x_texixml.found() and db2x_xsltproc.found() and makeinfo.found()
315310
endif
316311

317312

318-
if docs.length() == 0
319-
run_target('docs', command: [missing, 'xsltproc'])
320-
else
313+
if docs_dep.found()
321314
alias_target('docs', docs)
322315
alias_target('install-docs', installdocs)
323316
endif
324317

325-
if alldocs.length() == 0
326-
run_target('alldocs', command: [missing, 'xsltproc'])
327-
else
318+
if alldocs.length() != 0
328319
alias_target('alldocs', alldocs)
329320
endif

meson.build

+37
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ program_zstd = find_program(get_option('ZSTD'), native: true, required: false)
341341
dtrace = find_program(get_option('DTRACE'), native: true, required: get_option('dtrace'))
342342
missing = find_program('config/missing', native: true)
343343
cp = find_program('cp', required: false, native: true)
344+
xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
345+
xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
344346

345347
bison_flags = []
346348
if bison.found()
@@ -567,6 +569,39 @@ endif
567569

568570

569571

572+
###############################################################
573+
# Option: docs in HTML and man page format
574+
###############################################################
575+
576+
docs_opt = get_option('docs')
577+
docs_dep = not_found_dep
578+
if not docs_opt.disabled()
579+
if xmllint_bin.found() and xsltproc_bin.found()
580+
docs_dep = declare_dependency()
581+
elif docs_opt.enabled()
582+
error('missing required tools for docs in HTML / man page format')
583+
endif
584+
endif
585+
586+
587+
588+
###############################################################
589+
# Option: docs in PDF format
590+
###############################################################
591+
592+
docs_pdf_opt = get_option('docs_pdf')
593+
docs_pdf_dep = not_found_dep
594+
if not docs_pdf_opt.disabled()
595+
fop = find_program(get_option('FOP'), native: true, required: docs_pdf_opt)
596+
if xmllint_bin.found() and xsltproc_bin.found() and fop.found()
597+
docs_pdf_dep = declare_dependency()
598+
elif docs_pdf_opt.enabled()
599+
error('missing required tools for docs in PDF format')
600+
endif
601+
endif
602+
603+
604+
570605
###############################################################
571606
# Library: GSSAPI
572607
###############################################################
@@ -3323,6 +3358,8 @@ if meson.version().version_compare('>=0.57')
33233358
{
33243359
'bonjour': bonjour,
33253360
'bsd_auth': bsd_auth,
3361+
'docs': docs_dep,
3362+
'docs_pdf': docs_pdf_dep,
33263363
'gss': gssapi,
33273364
'icu': icu,
33283365
'ldap': ldap,

meson_options.txt

+9
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ option('bonjour', type : 'feature', value: 'auto',
7979
option('bsd_auth', type : 'feature', value: 'auto',
8080
description: 'build with BSD Authentication support')
8181

82+
option('docs', type : 'feature', value: 'auto',
83+
description: 'documentation in HTML and man page format')
84+
85+
option('docs_pdf', type : 'feature', value: 'auto',
86+
description: 'documentation in PDF format')
87+
8288
option('dtrace', type : 'feature', value: 'disabled',
8389
description: 'DTrace support')
8490

@@ -159,6 +165,9 @@ option('DTRACE', type : 'string', value: 'dtrace',
159165
option('FLEX', type : 'array', value: ['flex', 'win_flex'],
160166
description: 'path to flex binary')
161167

168+
option('FOP', type : 'string', value: 'fop',
169+
description: 'path to fop binary')
170+
162171
option('GZIP', type : 'string', value: 'gzip',
163172
description: 'path to gzip binary')
164173

0 commit comments

Comments
 (0)