1 | # |
---|
2 | # RTEMS Project Documentation |
---|
3 | # |
---|
4 | |
---|
5 | from sys import path |
---|
6 | from os.path import abspath |
---|
7 | path.append(abspath('common')) |
---|
8 | |
---|
9 | import waflib |
---|
10 | import waf as docs_waf |
---|
11 | |
---|
12 | version = 'Master (4.11.99)' |
---|
13 | |
---|
14 | build_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 | |
---|
26 | building = build_all |
---|
27 | |
---|
28 | def options(opt): |
---|
29 | docs_waf.cmd_options(opt) |
---|
30 | |
---|
31 | def configure(conf): |
---|
32 | for b in building: |
---|
33 | conf.recurse(b) |
---|
34 | conf.env['BUILD_FROM_TOP'] = 'yes' |
---|
35 | |
---|
36 | def catalogue(ctx): |
---|
37 | docs_waf.xml_catalogue(ctx, building, version) |
---|
38 | |
---|
39 | def 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 | |
---|
53 | def 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'] + ['%s/conf.py' % x for x in building]) |
---|
63 | ctx.install_files('${PREFIX}', 'catalogue.xml') |
---|
64 | ctx(rule = coverpage_js, |
---|
65 | target = 'coverpage.js', |
---|
66 | source = ['wscript', 'catalogue.xml', 'common/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/coverpage/coverpage.html') |
---|
72 | static_dir = ctx.path.find_dir('common/coverpage/static') |
---|
73 | ctx.install_files('${PREFIX}/static', |
---|
74 | static_dir.ant_glob('**'), |
---|
75 | cwd = static_dir, |
---|
76 | relative_trick = True) |
---|
77 | |
---|
78 | def install(ctx): |
---|
79 | for b in building: |
---|
80 | ctx.recurse(b) |
---|