@@ -2,7 +2,7 @@ docs = []
22alldocs = []
33doc_generated = []
44
5- xmllint = find_program (get_option (' XMLLINT' ), native : true , required : false )
5+ xmllint_bin = find_program (get_option (' XMLLINT' ), native : true , required : false )
66
77
88version_sgml = configure_file (
@@ -60,21 +60,31 @@ doc_generated += custom_target('keywords-table.sgml',
6060)
6161
6262# For everything else we need at least xmllint
63- if not xmllint .found()
63+ if not xmllint_bin .found()
6464 subdir_done ()
6565endif
6666
6767pandoc = find_program (' pandoc' , native : true , required : false )
68- xsltproc = find_program (get_option (' XSLTPROC' ), native : true , required : false )
68+ xsltproc_bin = find_program (get_option (' XSLTPROC' ), native : true , required : false )
6969fop = find_program (' fop' , native : true , required : false )
7070
71+ xmltools_wrapper = [
72+ python, files (' xmltools_dep_wrapper' ),
73+ ' --targetname' , ' @OUTPUT@' , ' --depfile' , ' @DEPFILE@'
74+ ]
75+
76+ xmllint = xmltools_wrapper + [
77+ ' --tool' , xmllint_bin, ' --' ,
78+ ]
79+
7180# Run validation only once, common to all subsequent targets. While
7281# we're at it, also resolve all entities (that is, copy all included
7382# files into one big file). This helps tools that don't understand
7483# vpath builds (such as dbtoepub).
7584postgres_full_xml = custom_target (' postgres-full.xml' ,
7685 input : ' postgres.sgml' ,
7786 output : ' postgres-full.xml' ,
87+ depfile : ' postgres-full.xml.d' ,
7888 command : [xmllint, ' --noent' , ' --valid' , ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTPUT@' , ' @INPUT@' ],
7989 depends : doc_generated,
8090 build_by_default : false ,
@@ -86,18 +96,20 @@ alldocs += postgres_full_xml
8696#
8797# Full documentation as html, text
8898#
89- if xsltproc .found()
99+ if xsltproc_bin .found()
90100 xsltproc_flags = [
91101 ' --stringparam' , ' pg.version' , pg_version,
92102 ' --param' , ' website.stylesheet' , ' 1'
93103 ]
94104
105+ xsltproc = xmltools_wrapper + [
106+ ' --tool' , xsltproc_bin, ' --' ,
107+ ]
95108
96- # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
97- # depfile
98109 html = custom_target (' html' ,
99110 input : [' stylesheet.xsl' , postgres_full_xml],
100111 output : ' html' ,
112+ depfile : ' html.d' ,
101113 depends : doc_generated,
102114 command : [xsltproc, ' -o' , ' @OUTDIR@/' , xsltproc_flags, ' @INPUT@' ],
103115 build_by_default : false ,
@@ -110,6 +122,7 @@ if xsltproc.found()
110122 html_help = custom_target (' html_help' ,
111123 input : [' stylesheet-hh.xsl' , postgres_full_xml],
112124 output : ' htmlhelp' ,
125+ depfile : ' htmlhelp.d' ,
113126 depends : doc_generated,
114127 command : [xsltproc, ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTDIR@/' , xsltproc_flags, ' @INPUT@' ],
115128 build_by_default : false ,
@@ -121,6 +134,7 @@ if xsltproc.found()
121134 postgres_html = custom_target (' postgres.html' ,
122135 input : [' stylesheet-html-nochunk.xsl' , postgres_full_xml],
123136 output : ' postgres.html' ,
137+ depfile : ' postgres.html.d' ,
124138 depends : doc_generated,
125139 command : [xsltproc, ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTPUT@' , xsltproc_flags, ' @INPUT@' ],
126140 build_by_default : false ,
@@ -144,17 +158,19 @@ endif
144158#
145159# INSTALL in html, text
146160#
147- if xsltproc .found()
161+ if xsltproc_bin .found()
148162 install_xml = custom_target (' INSTALL.xml' ,
149163 input : [' standalone-profile.xsl' , ' standalone-install.xml' ],
150164 output : ' INSTALL.xml' ,
165+ depfile : ' INSTALL.xml.d' ,
151166 depends : doc_generated + [postgres_full_xml],
152167 command : [xsltproc, ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTPUT@' , xsltproc_flags, ' --xinclude' , ' @INPUT@' ],
153168 build_by_default : false ,
154169 )
155170 install_html = custom_target (' INSTALL.html' ,
156171 input : [' stylesheet-text.xsl' , install_xml],
157172 output : ' INSTALL.html' ,
173+ depfile : ' INSTALL.html.d' ,
158174 command : [xsltproc, ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTPUT@' , xsltproc_flags, ' @INPUT@' ],
159175 build_by_default : false ,
160176 )
@@ -177,11 +193,12 @@ endif
177193#
178194# Man pages
179195#
180- if xsltproc .found()
196+ if xsltproc_bin .found()
181197 # FIXME: implement / consider sqlmansectnum logic
182198 man = custom_target (' man' ,
183199 input : [' stylesheet-man.xsl' , postgres_full_xml],
184200 output : [' man1' , ' man3' , ' man7' ],
201+ depfile : ' man.d' ,
185202 depends : doc_generated,
186203 command : [xsltproc, ' --path' , ' @OUTDIR@' , ' -o' , ' @OUTDIR@/' , xsltproc_flags, ' @INPUT@' ],
187204 build_by_default : false ,
@@ -195,7 +212,7 @@ endif
195212#
196213# Full documentation as PDF
197214#
198- if fop.found() and xsltproc .found()
215+ if fop.found() and xsltproc_bin .found()
199216 xsltproc_fo_flags = xsltproc_flags + [' --stringparam' , ' img.src.path' , meson .current_source_dir() + ' /' ]
200217
201218 foreach format, detail : {' A4' : ' A4' , ' US' : ' USletter' }
@@ -206,6 +223,7 @@ if fop.found() and xsltproc.found()
206223 input : [' stylesheet-fo.xsl' , postgres_full_xml],
207224 output : [postgres_x_fo_f],
208225 depends : doc_generated,
226+ depfile : postgres_x_fo_f + ' .d' ,
209227 command : [xsltproc, ' --path' , ' @OUTDIR@/' , xsltproc_fo_flags,
210228 ' --stringparam' , ' paper.type' , detail,
211229 ' -o' , ' @OUTPUT@' , ' @INPUT@' ],
@@ -230,7 +248,7 @@ endif
230248# This was previously implemented using dbtoepub - but that doesn't seem to
231249# support running in build != source directory (i.e. VPATH builds already
232250# weren't supported).
233- if pandoc.found() and xsltproc .found()
251+ if pandoc.found() and xsltproc_bin .found()
234252 postgres_epub = custom_target (' postgres.epub' ,
235253 input : postgres_full_xml,
236254 output : ' postgres.epub' ,
0 commit comments