Merge pull request #4668 from adamscott/template-pool-to-scons_pool
[scons.git] / doc / user / SConstruct
blob69792ae3e63e09c965fa838063560aca27e830c5
1 # SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
2 # SPDX-License-Identifier: MIT
4 """
5 SConstruct file for building SCons User Guide..
7 This is usually invoked as a separate build by the top-level SCons build.
9 If invoked directly, can add SKIP_PDF=1 to avoid pdf and epub generation.
10 """
12 import os
14 env = Environment(
15 ENV={'PATH': os.environ['PATH']},
16 tools=['docbook', 'gs', 'zip'],
17 toolpath=['../../SCons/Tool'],
18 # DOCBOOK_XSLTPROCFLAGS="--stringparam fop.extensions 1",
19 DOCBOOK_DEFAULT_XSL_HTML='html.xsl',
20 DOCBOOK_DEFAULT_XSL_HTMLCHUNKED='chtml.xsl',
21 DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl',
24 skip_pdf = ARGUMENTS.get('SKIP_PDF', False)
25 has_pdf = False
26 if not skip_pdf and any((env.WhereIs('fop'), env.WhereIs('xep'))):
27 has_pdf = True
30 # UserGuide for SCons
32 env.DocbookXInclude('scons_xi.xml', 'main.xml')
33 env.DocbookXslt('scons_ex.xml', 'scons_xi.xml', xsl='../xslt/xinclude_examples.xslt')
34 env.DocbookXInclude('scons_exi.xml', 'scons_ex.xml')
35 env.DocbookXslt('scons_db.xml', 'scons_exi.xml', xsl='../xslt/to_docbook.xslt')
36 env.DocbookHtml('index.html', 'scons_db.xml')
37 env.DocbookHtmlChunked('index.html', 'scons_db.xml', base_dir='scons-user/')
38 if has_pdf:
39 env.DocbookPdf('scons-user.pdf', 'scons_db.xml')
41 has_gs = False
42 if env.WhereIs('gs'):
43 has_gs = True
46 # Create the EPUB format
48 if has_gs and has_pdf:
49 jpg = env.Gs(
50 'OEBPS/cover.jpg',
51 'scons-user.pdf',
52 GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q',
54 epub = env.DocbookEpub('scons-user.epub', 'scons_db.xml', xsl='epub.xsl')
55 env.Depends(epub, jpg)