Replaced CHMDOCS build switch with DOCTYPES=chm,html,htmlsingle
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6190 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
5a7c66b0f0
commit
bbb592401a
7 changed files with 178 additions and 126 deletions
|
@ -1,16 +1,7 @@
|
||||||
config_but = 'config.but'
|
# TODO FIXME extra files should be targets too, so they're rebuilt in case they're gone
|
||||||
|
|
||||||
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'
|
|
||||||
|
|
||||||
buts = Split("""
|
buts = Split("""
|
||||||
|
config.but
|
||||||
intro.but
|
intro.but
|
||||||
tutorial.but
|
tutorial.but
|
||||||
usage.but
|
usage.but
|
||||||
|
@ -55,79 +46,126 @@ buts = Split("""
|
||||||
license.but
|
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 os
|
||||||
import re
|
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['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']['<a href="../(Include|Stubs|Plugins|Contrib)/'] = '<a href="$PREFIX_DATA/\\1/'
|
||||||
|
|
||||||
replacement = '<a href="%s/\\1/' % env.subst('$PREFIX_DATA')
|
|
||||||
|
|
||||||
def fix_html(target, source, env):
|
# builder
|
||||||
for i in range(len(source)):
|
|
||||||
data = open(source[i].path,'rb').read()
|
|
||||||
data = re.sub('<a href="../(Include|Stubs|Plugins|Contrib)/', replacement, data)
|
|
||||||
open(target[i].path,'wb').write(data)
|
|
||||||
return None
|
|
||||||
|
|
||||||
if build_chm:
|
def docs_emitter(target, source, env):
|
||||||
hhc_action = Action(r'cd %s && hhc nsis.hhp' % build_dir)
|
env.Depends(target, '$HALIBUT')
|
||||||
|
for i in env['NSISDOCEXTRAFILES']:
|
||||||
|
env.Depends(target, i)
|
||||||
|
return target, source
|
||||||
|
|
||||||
chm_builder = Builder(
|
def docs_halibut_action(target, source, env):
|
||||||
action = [
|
buts = ' '.join(i.abspath for i in source if i.get_suffix() == '.but')
|
||||||
Copy(build_dir, '${SOURCE.dir}/../style.css'),
|
result = Execute(env.Action(
|
||||||
Copy(build_dir, '${SOURCE.dir}/chmlink.js'),
|
'${HALIBUT[0].abspath} ' + buts,
|
||||||
Copy(build_dir, '${SOURCE.dir}/nsis.hhp'),
|
'', # empty display string
|
||||||
Action(
|
chdir = '$BUILDDIR',
|
||||||
['${HALIBUT[0].abspath} ${SOURCES.abspath}'],
|
))
|
||||||
chdir = build_dir
|
#raw_input('meh?')
|
||||||
),
|
|
||||||
hhc_action
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
env.Append(BUILDERS = {'HalibutCHM' : chm_builder})
|
def docs_fixer(target, source, env):
|
||||||
|
fixes = env['NSISDOCHTMLFIXES']
|
||||||
|
if not fixes:
|
||||||
|
return
|
||||||
|
|
||||||
# fix hhc.exe reverse return value - UGLY
|
for i, html in enumerate(target):
|
||||||
old_spawn = env['SPAWN']
|
data = open(html.path,'rb').read()
|
||||||
def new_spawn(*args, **kw):
|
|
||||||
result = old_spawn(*args, **kw)
|
for pat, repl in fixes.items():
|
||||||
if 'hhc' in args[3]:
|
data = re.sub(env.subst(pat), env.subst(repl), data)
|
||||||
|
|
||||||
|
open(html.path, 'wb').write(data)
|
||||||
|
|
||||||
|
|
||||||
|
def docs_extras(target, source, env):
|
||||||
|
for i in env['NSISDOCEXTRAFILES']:
|
||||||
|
env.Execute(Copy('$BUILDDIR', i))
|
||||||
|
|
||||||
|
docs_builder = env.Builder(
|
||||||
|
action = [
|
||||||
|
Action(docs_halibut_action),
|
||||||
|
Action(docs_fixer),
|
||||||
|
Action(docs_extras),
|
||||||
|
'$NSISDOCEXTRAACTION'
|
||||||
|
],
|
||||||
|
emitter = docs_emitter
|
||||||
|
)
|
||||||
|
|
||||||
|
env.Append(BUILDERS = {'Halibut' : docs_builder})
|
||||||
|
|
||||||
|
# fix hhc.exe reverse return value - UGLY
|
||||||
|
old_spawn = env['SPAWN']
|
||||||
|
def new_spawn(*args, **kw):
|
||||||
|
result = old_spawn(*args, **kw)
|
||||||
|
for p in args[3]:
|
||||||
|
if 'hhc.exe' in p.lower():
|
||||||
return not result
|
return not result
|
||||||
else:
|
return result
|
||||||
return result
|
|
||||||
env['SPAWN'] = new_spawn
|
|
||||||
|
|
||||||
# build CHM
|
env['SPAWN'] = new_spawn
|
||||||
chm = env.HalibutCHM('NSIS.chm', [chm_config_but] + buts)
|
|
||||||
env.Depends(chm, halibut)
|
|
||||||
env.Depends(chm, '#Docs/style.css')
|
|
||||||
env.Depends(chm, 'chmlink.js')
|
|
||||||
env.Depends(chm, 'nsis.hhp')
|
|
||||||
env.DistributeDoc(chm)
|
|
||||||
|
|
||||||
else:
|
# BUILD!
|
||||||
html_builder = Builder(
|
docs = env.Halibut(env['NSISDOCTARGET'], ['$NSISDOCCONFIG'] + buts)
|
||||||
action = [
|
env.DistributeDocs(docs, basepath=env['NSISDOCINSTALLBASEPATH'])
|
||||||
Copy(build_dir, '${SOURCE.dir}/../style.css'),
|
|
||||||
Action(['${HALIBUT[0].abspath} ${SOURCES.abspath}'], chdir = build_dir)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
html_fixer = Builder(action = fix_html, suffix = '.html', src_suffix = '.html')
|
|
||||||
|
|
||||||
env.Append(BUILDERS = {'Halibut' : html_builder, 'FixHTML': html_fixer})
|
|
||||||
|
|
||||||
html = env.Halibut(htmls, [config_but] + buts)
|
|
||||||
env.Depends(html, halibut)
|
|
||||||
env.DistributeDocs('#Docs/style.css')
|
|
||||||
|
|
||||||
if env['PLATFORM'] == 'win32':
|
|
||||||
env.DistributeDocs(html)
|
|
||||||
else:
|
|
||||||
fixed_html = env.FixHTML(fixed_htmls, htmls)
|
|
||||||
env.DistributeDocs(fixed_html)
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
\title NSIS Users Manual
|
|
||||||
|
|
||||||
\cfg{xhtml-leaf-level}{2}
|
|
||||||
|
|
||||||
\cfg{xhtml-leaf-contains-contents}{false}
|
|
||||||
|
|
||||||
\cfg{xhtml-contents-depth-0}{5}
|
|
||||||
|
|
||||||
\cfg{xhtml-head-end}{<link rel="stylesheet" href="style.css" type='text/css' /><script language="JavaScript" type="text/javascript" src="chmlink.js"></script>}
|
|
||||||
|
|
||||||
\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:\\<br\\>\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\<br\\>\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\<br\\>\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
|
|
||||||
|
|
||||||
\copyright Copyright (C) 1999-2009 Contributors
|
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
\title NSIS Users Manual
|
\##############################################/
|
||||||
|
\# Common config shared by all output formats #/
|
||||||
|
\##############################################/
|
||||||
|
|
||||||
\cfg{xhtml-leaf-level}{1}
|
\copyright Copyright (C) 1999-2012 Contributors
|
||||||
|
|
||||||
\cfg{xhtml-leaf-smallest-contents}{3}
|
|
||||||
|
|
||||||
\cfg{xhtml-leaf-contains-contents}{true}
|
|
||||||
|
|
||||||
\cfg{xhtml-contents-depth-0}{3}
|
|
||||||
|
|
||||||
\cfg{xhtml-head-end}{<link rel="stylesheet" href="style.css" type='text/css' />}
|
|
||||||
|
|
||||||
\preamble NSIS is a free scriptable win32 installer/uninstaller system that doesn't suck and isn't huge.
|
|
||||||
|
|
||||||
\preamble Check \W{http://nsis.sourceforge.net/}{http://nsis.sf.net} for news, information, support, examples, tutorials and more.
|
\preamble Check \W{http://nsis.sourceforge.net/}{http://nsis.sf.net} for news, information, support, examples, tutorials and more.
|
||||||
|
|
||||||
\preamble Quick links:\\<br\\>\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\<br\\>\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\<br\\>\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
|
\preamble Quick links:\\<br\\>\W{http://nsis.sourceforge.net/support/faq/}{FAQ} - A list of frequently asked questions\\<br\\>\W{http://nsis.sourceforge.net/wiki/}{NSIS Wiki} - Examples, functions, tutorials, plug-ins, software and more\\<br\\>\W{http://forums.winamp.com/forumdisplay.php?forumid=65}{Forum} - Post questions or discuss NSIS features
|
||||||
|
|
||||||
\copyright Copyright (C) 1999-2009 Contributors
|
|
23
Docs/src/config_chm.but
Normal file
23
Docs/src/config_chm.but
Normal file
|
@ -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}{<link rel="stylesheet" href="style.css" type='text/css' /><script language="JavaScript" type="text/javascript" src="chmlink.js"></script>}
|
||||||
|
|
||||||
|
\cfg{xhtml-rlink-prefix}{#" onclick="parser('}
|
||||||
|
|
||||||
|
\cfg{xhtml-rlink-suffix}{')}
|
||||||
|
|
||||||
|
\cfg{chm-toc-file}{toc.hhc}
|
||||||
|
|
||||||
|
\cfg{chm-ind-file}{ind.hhk}
|
||||||
|
|
15
Docs/src/config_html.but
Normal file
15
Docs/src/config_html.but
Normal file
|
@ -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}{<link rel="stylesheet" href="style.css" type='text/css' />}
|
||||||
|
|
9
Docs/src/config_htmlsingle.but
Normal file
9
Docs/src/config_htmlsingle.but
Normal file
|
@ -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}{<style type='text/css'>---HTML:HEAD:STYLE:CSS---</style>}
|
||||||
|
|
34
SConstruct
34
SConstruct
|
@ -54,6 +54,12 @@ doc = [
|
||||||
'COPYING'
|
'COPYING'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
doctypes = [
|
||||||
|
'chm',
|
||||||
|
'html',
|
||||||
|
'htmlsingle'
|
||||||
|
]
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
####### Build Environment ###
|
####### Build Environment ###
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -84,9 +90,9 @@ SConscript('SCons/utils.py')
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
hhc = 'no'
|
default_doctype = 'html'
|
||||||
if defenv.WhereIs('hhc', os.environ['PATH']):
|
if defenv.WhereIs('hhc', os.environ['PATH']):
|
||||||
hhc = 'yes'
|
default_doctype = 'chm'
|
||||||
|
|
||||||
from time import strftime, gmtime
|
from time import strftime, gmtime
|
||||||
cvs_version = strftime('%d-%b-%Y.cvs', 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(('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(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(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_CPPPATH', 'Additional paths to search for include files', None))
|
||||||
opts.Add(PathVariable('APPEND_LIBPATH', 'Additional paths to search for libraries', None))
|
opts.Add(PathVariable('APPEND_LIBPATH', 'Additional paths to search for libraries', None))
|
||||||
opts.Add(('APPEND_CCFLAGS', 'Additional C/C++ compiler flags'))
|
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):
|
def DistributeInclude(files, names=[], path='', alias=None):
|
||||||
return defenv.Distribute(files, names, 'data', 'Include', path, alias, 'includes')
|
return defenv.Distribute(files, names, 'data', 'Include', path, alias, 'includes')
|
||||||
|
|
||||||
def DistributeDoc(files, names=[], path='', alias=None):
|
def DistributeDoc(files, names=[], path='', alias=None, basepath='', install_alias='docs'):
|
||||||
return defenv.Distribute(files, names, 'doc', '', path, alias)
|
return defenv.Distribute(files, names, 'doc', path=basepath, subpath=path, alias=alias, install_alias=install_alias)
|
||||||
|
|
||||||
def DistributeDocs(files, names=[], path='', alias=None):
|
def DistributeDocs(files, names=[], path='', alias=None, basepath='Docs', install_alias='docs'):
|
||||||
return defenv.Distribute(files, names, 'doc', 'Docs', path, 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):
|
def DistributeExamples(files, names=[], path='', alias=None):
|
||||||
return defenv.Distribute(files, names, 'doc', 'Examples', path, alias, 'examples')
|
return defenv.Distribute(files, names, 'doc', 'Examples', path, alias, 'examples')
|
||||||
|
@ -724,19 +730,13 @@ halibut = defenv.SConscript(
|
||||||
exports = {'env' : defenv.Clone()}
|
exports = {'env' : defenv.Clone()}
|
||||||
)
|
)
|
||||||
|
|
||||||
if defenv['CHMDOCS']:
|
for doctype in defenv['DOCTYPES']:
|
||||||
|
|
||||||
defenv.SConscript(
|
defenv.SConscript(
|
||||||
dirs = 'Docs/src',
|
dirs = 'Docs/src',
|
||||||
variant_dir = '$BUILD_PREFIX/Docs/chm',
|
variant_dir = '$BUILD_PREFIX/Docs/' + doctype,
|
||||||
duplicate = False,
|
duplicate = False,
|
||||||
exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_chm' : True}
|
exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_doctype' : doctype}
|
||||||
)
|
|
||||||
else:
|
|
||||||
defenv.SConscript(
|
|
||||||
dirs = 'Docs/src',
|
|
||||||
variant_dir = '$BUILD_PREFIX/Docs/html',
|
|
||||||
duplicate = False,
|
|
||||||
exports = {'halibut' : halibut, 'env' : defenv.Clone(), 'build_chm' : False}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue