source: rtems-docs/wscript @ 2591ca6

Last change on this file since 2591ca6 was 2591ca6, checked in by Chris Johns <chrisj@…>, on Jan 11, 2017 at 6:04:02 AM

html: Embed the catalogue XML in JS.

The is to work around a security issue with Chrome on Windows. This
patches let the cover page load on Chrome and Edge on Windows 10.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#
2# RTEMS Project Documentation
3#
4
5from sys import path
6from os.path import abspath
7path.append(abspath('common'))
8
9import waflib
10import waf as docs_waf
11
12version = 'Master (4.11.99)'
13
14build_all = ['user',
15             'rsb',
16             'c-user',
17             'bsp-howto',
18             'posix-users',
19             'filesystem',
20             'networking',
21             'shell',
22             'cpu-supplement',
23             'develenv',
24             'eclipse']
25
26building = build_all
27
28def options(opt):
29    docs_waf.cmd_options(opt)
30
31def configure(conf):
32    for b in building:
33        conf.recurse(b)
34    conf.env['BUILD_FROM_TOP'] = 'yes'
35
36def catalogue(ctx):
37    docs_waf.xml_catalogue(ctx, building, version)
38
39def coverpage_js(ctx):
40    js = None
41    xml = None
42    for f in ctx.inputs:
43        if f.abspath().endswith('.js'):
44            with open(f.abspath()) as i:
45                js = i.read()
46        elif f.abspath().endswith('.xml'):
47            with open(f.abspath()) as i:
48                xml = i.read()
49    xml = xml.replace('\n', ' \\\n');
50    with open(ctx.outputs[0].abspath(), 'w') as o:
51        o.write(js.replace('@CATALOGUE', xml))
52
53def build(ctx):
54    for b in building:
55        ctx.recurse(b)
56
57    #
58    # Build the catalogue, coverpage.js and install.
59    #
60    ctx(rule = catalogue,
61        target = 'catalogue.xml',
62        source = ['wscript', 'common/waf.py'])
63    ctx.install_files('${PREFIX}', 'catalogue.xml')
64    ctx(rule = coverpage_js,
65        target = 'coverpage.js',
66        source = ['wscript', 'catalogue.xml', 'common/html-coverpage/coverpage.js'])
67    ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js')
68    #
69    # Install the static content.
70    #
71    ctx.install_as('${PREFIX}/index.html', 'common/html-coverpage/coverpage.html')
72    static_dir = ctx.path.find_dir('common/html-coverpage/static')
73    ctx.install_files('${PREFIX}/static',
74                      static_dir.ant_glob('**'),
75                      cwd = static_dir,
76                      relative_trick = True)
77
78def install(ctx):
79    for b in building:
80        ctx.recurse(b)
Note: See TracBrowser for help on using the repository browser.