1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
config_but = 'config.but'
chapters = 5
appendices = 8
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))
chm_config_but = 'chm_config.but'
buts = Split("""
intro.but
tutorial.but
usage.but
script.but
var.but
labels.but
jumps.but
pages.but
sections.but
usection.but
functions.but
callback.but
attributes.but
compilerflags.but
basic.but
registry.but
generalpurpose.but
flowcontrol.but
file.but
uninstall.but
misc.but
string.but
stack.but
int.but
reboot.but
log.but
sec.but
ui.but
langs.but
plugin.but
silent.but
compiler.but
defines.but
modernui.but
library.but
usefulfunc.but
usefulinfos.but
history.but
build.but
credits.but
license.but
""")
import os
Import('halibut env build_chm')
env.Append(ENV = {'PATH' : os.environ['PATH']})
build_dir = Dir(GetBuildPath('.')).abspath
if build_chm:
hhc_action = Action('cd "%s" && hhc nsis.hhp' % (build_dir))
execute = hhc_action.execute
def rexecute(*args):
return execute(*args) != 1 # hhc returns 1 on success
hhc_action.execute = rexecute
chm_builder = Builder(
action = [
Copy(build_dir, '${SOURCE.dir}/../style.css'),
Copy(build_dir, '${SOURCE.dir}/chmlink.js'),
Copy(build_dir, '${SOURCE.dir}/nsis.hhp'),
Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].abspath)),
hhc_action
]
)
env.Append(BUILDERS = {'HalibutCHM' : chm_builder})
chm = env.HalibutCHM('NSIS.chm', [chm_config_but] + buts)
env.Depends(chm, halibut)
env.Distribute('', chm)
else:
html_builder = Builder(
action = [
Copy(build_dir, '${SOURCE.dir}/../style.css'),
Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].abspath))
]
)
env.Append(BUILDERS = {'Halibut' : html_builder})
html = env.Halibut(htmls, [config_but] + buts)
env.Depends(html, halibut)
env.DistributeDocs('', build_dir + '/style.css')
env.DistributeDocs('', htmls)
|