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 = '4.11.99 (master)' |
---|
13 | |
---|
14 | build_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 | |
---|
27 | building = build_all |
---|
28 | |
---|
29 | def options(opt): |
---|
30 | docs_waf.cmd_options(opt) |
---|
31 | |
---|
32 | def configure(conf): |
---|
33 | conf.env.VERSION = version |
---|
34 | for b in building: |
---|
35 | conf.recurse(b) |
---|
36 | conf.env['BUILD_FROM_TOP'] = 'yes' |
---|
37 | |
---|
38 | def catalogue(ctx): |
---|
39 | docs_waf.xml_catalogue(ctx, building) |
---|
40 | |
---|
41 | def 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 | |
---|
55 | def build(ctx): |
---|
56 | for b in building: |
---|
57 | ctx.recurse(b) |
---|
58 | |
---|
59 | # |
---|
60 | # Build the catalogue, coverpage.js and install. |
---|
61 | # |
---|
62 | ctx(rule = catalogue, |
---|
63 | target = 'catalogue.xml', |
---|
64 | source = ['wscript', 'common/waf.py'] + ['%s/conf.py' % x for x in building]) |
---|
65 | ctx.install_files('${PREFIX}', 'catalogue.xml') |
---|
66 | ctx(rule = coverpage_js, |
---|
67 | target = 'coverpage.js', |
---|
68 | source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js']) |
---|
69 | ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js') |
---|
70 | # |
---|
71 | # Install the static content. |
---|
72 | # |
---|
73 | ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html') |
---|
74 | static_dir = ctx.path.find_dir('common/coverpage/static') |
---|
75 | ctx.install_files('${PREFIX}/static', |
---|
76 | static_dir.ant_glob('**'), |
---|
77 | cwd = static_dir, |
---|
78 | relative_trick = True) |
---|
79 | |
---|
80 | def install(ctx): |
---|
81 | for b in building: |
---|
82 | ctx.recurse(b) |
---|
83 | |
---|
84 | def cmd_spell(ctx): |
---|
85 | for b in building: |
---|
86 | ctx.recurse(b) |
---|
87 | |
---|
88 | def cmd_linkcheck(ctx): |
---|
89 | for b in building: |
---|
90 | ctx.recurse(b) |
---|