diff --git a/Docs/src/SConscript b/Docs/src/SConscript
index ffec0827..bb9cdc20 100644
--- a/Docs/src/SConscript
+++ b/Docs/src/SConscript
@@ -1,16 +1,7 @@
-config_but = 'config.but'
-
-chapters = 5
-appendices = 9
-
-htmls = Split('IndexPage.html Contents.html') \
- + map(lambda ch: 'Chapter' + str(ch + 1) + '.html', range(chapters)) \
- + map(lambda ap: 'Appendix' + chr(ord('A') + ap) + '.html', range(appendices))
-fixed_htmls = map(lambda fn: 'fixed/'+fn, htmls)
-
-chm_config_but = 'chm_config.but'
+# TODO FIXME extra files should be targets too, so they're rebuilt in case they're gone
buts = Split("""
+ config.but
intro.but
tutorial.but
usage.but
@@ -55,79 +46,126 @@ buts = Split("""
license.but
""")
+chapters = 5
+appendices = 9
+
+htmls = Split('IndexPage.html Contents.html') \
+ + map(lambda ch: 'Chapter' + str(ch + 1) + '.html', range(chapters)) \
+ + map(lambda ap: 'Appendix' + chr(ord('A') + ap) + '.html', range(appendices))
+
+docsdefault_install_basepath = 'Docs'
+
+DOCS_CONFIG = {
+ 'chm' :
+ {
+ 'NSISDOCCONFIG' : 'config_chm.but',
+ 'NSISDOCEXTRAFILES' : File(Split('#Docs/style.css chmlink.js nsis.hhp')),
+ 'NSISDOCEXTRAACTION' : Action('cd $BUILDDIR && "$HHC" nsis.hhp'),
+ 'NSISDOCHTMLFIXES' :
+ {
+ },
+ 'NSISDOCTARGET' : 'NSIS.chm',
+ 'NSISDOCINSTALLBASEPATH' : '',
+ },
+ 'html' :
+ {
+ 'NSISDOCCONFIG' : 'config_html.but',
+ 'NSISDOCEXTRAFILES' : File(Split('#Docs/style.css')),
+ 'NSISDOCEXTRAACTION' : '',
+ 'NSISDOCHTMLFIXES' :
+ {
+ },
+ 'NSISDOCTARGET' : htmls,
+ 'NSISDOCINSTALLBASEPATH' : docsdefault_install_basepath,
+ },
+ 'htmlsingle' :
+ {
+ 'NSISDOCCONFIG' : 'config_htmlsingle.but',
+ 'NSISDOCEXTRAFILES' : [],
+ 'NSISDOCEXTRAACTION' : '',
+ 'NSISDOCHTMLFIXES' :
+ {
+ '---HTML:HEAD:STYLE:CSS---' : File('#/Docs/style.css').get_contents(),
+ },
+ 'NSISDOCTARGET' : 'Manual.html',
+ 'NSISDOCINSTALLBASEPATH' : docsdefault_install_basepath,
+ },
+}
+
import os
import re
-Import('halibut env build_chm')
+Import('halibut env build_doctype')
-env.Append(ENV = {'PATH' : os.environ['PATH']})
+# set up environment
+
+env['HHC'] = env.WhereIs('hhc', os.environ['PATH'])
env['HALIBUT'] = halibut
+env['BUILDDIR'] = build_dir = Dir(GetBuildPath('.')).abspath
+env.Replace(**DOCS_CONFIG[build_doctype])
-build_dir = Dir(GetBuildPath('.')).abspath
+if not env['PLATFORM'] == 'win32':
+ env['NSISDOCHTMLFIXES']['}
-
-\cfg{xhtml-rlink-prefix}{#" onclick="parser('}
-
-\cfg{xhtml-rlink-suffix}{')}
-
-\cfg{chm-toc-file}{toc.hhc}
-
-\cfg{chm-ind-file}{ind.hhk}
-
-\preamble Check \W{http://nsis.sourceforge.net/}{http://nsis.sf.net} for news, information, support, examples, tutorials and more.
-
-\preamble Quick links:\\
\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\
\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\
\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
-
-\copyright Copyright (C) 1999-2009 Contributors
-
diff --git a/Docs/src/config.but b/Docs/src/config.but
index d57f1b93..ad1da046 100644
--- a/Docs/src/config.but
+++ b/Docs/src/config.but
@@ -1,19 +1,10 @@
-\title NSIS Users Manual
+\##############################################/
+\# Common config shared by all output formats #/
+\##############################################/
-\cfg{xhtml-leaf-level}{1}
-
-\cfg{xhtml-leaf-smallest-contents}{3}
-
-\cfg{xhtml-leaf-contains-contents}{true}
-
-\cfg{xhtml-contents-depth-0}{3}
-
-\cfg{xhtml-head-end}{}
-
-\preamble NSIS is a free scriptable win32 installer/uninstaller system that doesn't suck and isn't huge.
+\copyright Copyright (C) 1999-2012 Contributors
\preamble Check \W{http://nsis.sourceforge.net/}{http://nsis.sf.net} for news, information, support, examples, tutorials and more.
\preamble Quick links:\\
\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\
\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\
\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
-\copyright Copyright (C) 1999-2009 Contributors
\ No newline at end of file
diff --git a/Docs/src/config_chm.but b/Docs/src/config_chm.but
new file mode 100644
index 00000000..365e8b38
--- /dev/null
+++ b/Docs/src/config_chm.but
@@ -0,0 +1,23 @@
+\title NSIS Users Manual
+
+
+\#{ Unnamed fragments should generate a smaller file (It will prevent people from making mk:@MSITStore links to named fragments) }
+
+\cfg{xhtml-keywordfragments}{false}
+
+\cfg{xhtml-leaf-level}{2}
+
+\cfg{xhtml-leaf-contains-contents}{false}
+
+\cfg{xhtml-contents-depth-0}{5}
+
+\cfg{xhtml-head-end}{}
+
+\cfg{xhtml-rlink-prefix}{#" onclick="parser('}
+
+\cfg{xhtml-rlink-suffix}{')}
+
+\cfg{chm-toc-file}{toc.hhc}
+
+\cfg{chm-ind-file}{ind.hhk}
+
diff --git a/Docs/src/config_html.but b/Docs/src/config_html.but
new file mode 100644
index 00000000..51a5b7db
--- /dev/null
+++ b/Docs/src/config_html.but
@@ -0,0 +1,15 @@
+\title NSIS Users Manual
+
+\preamble NSIS is a free scriptable win32 installer/uninstaller system that doesn't suck and isn't huge.
+
+
+\cfg{xhtml-leaf-level}{1}
+
+\cfg{xhtml-leaf-smallest-contents}{3}
+
+\cfg{xhtml-leaf-contains-contents}{true}
+
+\cfg{xhtml-contents-depth-0}{3}
+
+\cfg{xhtml-head-end}{}
+
diff --git a/Docs/src/config_htmlsingle.but b/Docs/src/config_htmlsingle.but
new file mode 100644
index 00000000..27b5500d
--- /dev/null
+++ b/Docs/src/config_htmlsingle.but
@@ -0,0 +1,9 @@
+\title NSIS Users Manual
+
+\preamble NSIS is a free scriptable win32 installer/uninstaller system that doesn't suck and isn't huge.
+
+
+\cfg{xhtml-leaf-level}{0}
+
+\cfg{xhtml-head-end}{}
+
diff --git a/SConstruct b/SConstruct
index cf5d9b14..3a043b9f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -54,6 +54,12 @@ doc = [
'COPYING'
]
+doctypes = [
+ 'chm',
+ 'html',
+ 'htmlsingle'
+]
+
######################################################################
####### Build Environment ###
######################################################################
@@ -84,9 +90,9 @@ SConscript('SCons/utils.py')
######################################################################
import os
-hhc = 'no'
+default_doctype = 'html'
if defenv.WhereIs('hhc', os.environ['PATH']):
- hhc = 'yes'
+ default_doctype = 'chm'
from time import strftime, gmtime
cvs_version = strftime('%d-%b-%Y.cvs', gmtime())
@@ -152,7 +158,7 @@ opts.Add(('PATH', 'A colon-separated list of system paths instead of the default
opts.Add(('TOOLSET', 'A comma-separated list of specific tools used for building instead of the default', None))
opts.Add(BoolVariable('MSTOOLKIT', 'Use Microsoft Visual C++ Toolkit', 'no'))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', os.environ.get('MSVS_VERSION'), allowed_values=('6.0', '7.0', '7.1', '8.0', '8.0Exp', '9.0', '9.0Exp', '10.0', '10.0Exp')))
-opts.Add(BoolVariable('CHMDOCS', 'Build CHM documentation, requires hhc.exe', hhc))
+opts.Add(ListVariable('DOCTYPES', 'A list of document types that will be built', default_doctype, doctypes))
opts.Add(PathVariable('APPEND_CPPPATH', 'Additional paths to search for include files', None))
opts.Add(PathVariable('APPEND_LIBPATH', 'Additional paths to search for libraries', None))
opts.Add(('APPEND_CCFLAGS', 'Additional C/C++ compiler flags'))
@@ -323,11 +329,11 @@ def DistributeMenu(files, names=[], path='', alias=None):
def DistributeInclude(files, names=[], path='', alias=None):
return defenv.Distribute(files, names, 'data', 'Include', path, alias, 'includes')
-def DistributeDoc(files, names=[], path='', alias=None):
- return defenv.Distribute(files, names, 'doc', '', path, alias)
+def DistributeDoc(files, names=[], path='', alias=None, basepath='', install_alias='docs'):
+ return defenv.Distribute(files, names, 'doc', path=basepath, subpath=path, alias=alias, install_alias=install_alias)
-def DistributeDocs(files, names=[], path='', alias=None):
- return defenv.Distribute(files, names, 'doc', 'Docs', path, alias, 'docs')
+def DistributeDocs(files, names=[], path='', alias=None, basepath='Docs', install_alias='docs'):
+ return defenv.Distribute(files, names, 'doc', path=basepath, subpath=path, alias=alias, install_alias=install_alias)
def DistributeExamples(files, names=[], path='', alias=None):
return defenv.Distribute(files, names, 'doc', 'Examples', path, alias, 'examples')
@@ -724,19 +730,13 @@ halibut = defenv.SConscript(
exports = {'env' : defenv.Clone()}
)
-if defenv['CHMDOCS']:
+for doctype in defenv['DOCTYPES']:
+
defenv.SConscript(
dirs = 'Docs/src',
- variant_dir = '$BUILD_PREFIX/Docs/chm',
+ variant_dir = '$BUILD_PREFIX/Docs/' + doctype,
duplicate = False,
- exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_chm' : True}
- )
-else:
- defenv.SConscript(
- dirs = 'Docs/src',
- variant_dir = '$BUILD_PREFIX/Docs/html',
- duplicate = False,
- exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_chm' : False}
+ exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_doctype' : doctype}
)
######################################################################