source: rtems-docs/wscript @ f067ba3

5
Last change on this file since f067ba3 was 21c1a44, checked in by Chris Johns <chrisj@…>, on 11/02/18 at 03:05:51

waf: Add support to build PlantUML and Ditaa images.

  • Property mode set to 100644
File size: 2.4 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 = '5.0.0 (master)'
13
14build_all = ['user',
15             'rsb',
16             'c-user',
17             'bsp-howto',
18             'posix-users',
19             'posix-compliance',
20             'filesystem',
21             'networking',
22             'shell',
23             'cpu-supplement',
24             'develenv',
25             'eclipse']
26
27building = build_all
28
29def options(opt):
30    docs_waf.cmd_options(opt)
31
32def configure(conf):
33    conf.env.VERSION = version
34    for b in building:
35        conf.recurse(b)
36    conf.env['BUILD_FROM_TOP'] = 'yes'
37
38def catalogue(ctx):
39    docs_waf.xml_catalogue(ctx, building)
40
41def coverpage_js(ctx):
42    js = None
43    xml = None
44    for f in ctx.inputs:
45        if f.abspath().endswith('.js'):
46            with open(f.abspath()) as i:
47                js = i.read()
48        elif f.abspath().endswith('.xml'):
49            with open(f.abspath()) as i:
50                xml = i.read()
51    xml = xml.replace('\n', ' \\\n');
52    with open(ctx.outputs[0].abspath(), 'w') as o:
53        o.write(js.replace('@CATALOGUE', xml))
54
55def build(ctx):
56    #
57    # Generate any PlantUML images if enabled.
58    #
59    ctx.recurse('images')
60    ctx.add_group('images')
61
62    for b in building:
63        ctx.recurse(b)
64
65    #
66    # Build the catalogue, coverpage.js and install.
67    #
68    ctx(rule = catalogue,
69        target = 'catalogue.xml',
70        source = ['wscript', 'common/waf.py'] + ['%s/conf.py' % x for x in building])
71    ctx.install_files('${PREFIX}', 'catalogue.xml')
72    ctx(rule = coverpage_js,
73        target = 'coverpage.js',
74        source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js'])
75    ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js')
76    #
77    # Install the static content.
78    #
79    ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html')
80    static_dir = ctx.path.find_dir('common/coverpage/static')
81    ctx.install_files('${PREFIX}/static',
82                      static_dir.ant_glob('**'),
83                      cwd = static_dir,
84                      relative_trick = True)
85
86def install(ctx):
87    for b in building:
88        ctx.recurse(b)
89
90def cmd_spell(ctx):
91    for b in building:
92        ctx.recurse(b)
93
94def cmd_linkcheck(ctx):
95    for b in building:
96        ctx.recurse(b)
Note: See TracBrowser for help on using the repository browser.