source: rtems-docs/wscript @ 2591ca6

5
Last change on this file since 2591ca6 was 2591ca6, checked in by Chris Johns <chrisj@…>, on 01/11/17 at 06:04:02

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
RevLine 
[f529417]1#
2# RTEMS Project Documentation
3#
4
5from sys import path
6from os.path import abspath
7path.append(abspath('common'))
8
[782b4fe]9import waflib
[f529417]10import waf as docs_waf
11
[2591ca6]12version = 'Master (4.11.99)'
[9aa52b9]13
14build_all = ['user',
15             'rsb',
[6345b2d]16             'c-user',
[9aa52b9]17             'bsp-howto',
18             'posix-users',
[f529417]19             'filesystem',
[6345b2d]20             'networking',
21             'shell',
[9aa52b9]22             'cpu-supplement',
23             'develenv',
24             'eclipse']
[f529417]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
[782b4fe]36def catalogue(ctx):
[9aa52b9]37    docs_waf.xml_catalogue(ctx, building, version)
[1a9b02e]38
[2591ca6]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
[f529417]53def build(ctx):
54    for b in building:
55        ctx.recurse(b)
[ecf82d1]56
57    #
[2591ca6]58    # Build the catalogue, coverpage.js and install.
[ecf82d1]59    #
[782b4fe]60    ctx(rule = catalogue,
61        target = 'catalogue.xml',
62        source = ['wscript', 'common/waf.py'])
[9aa52b9]63    ctx.install_files('${PREFIX}', 'catalogue.xml')
[2591ca6]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')
[ecf82d1]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)
[dd43d0b]77
78def install(ctx):
79    for b in building:
80        ctx.recurse(b)
Note: See TracBrowser for help on using the repository browser.