1 | # |
---|
2 | # RTEMS Project Documentation |
---|
3 | # |
---|
4 | |
---|
5 | import sys |
---|
6 | import os.path |
---|
7 | |
---|
8 | sys.path.append(os.path.abspath('common')) |
---|
9 | |
---|
10 | import waflib |
---|
11 | import waf as docs_waf |
---|
12 | import version |
---|
13 | |
---|
14 | # |
---|
15 | # Branch version |
---|
16 | # |
---|
17 | rtems_major_version = '5' |
---|
18 | |
---|
19 | # |
---|
20 | # The documents to build. |
---|
21 | # |
---|
22 | build_all = ['user', |
---|
23 | 'c-user', |
---|
24 | 'bsp-howto', |
---|
25 | 'posix-users', |
---|
26 | 'posix-compliance', |
---|
27 | 'eng', |
---|
28 | 'filesystem', |
---|
29 | 'networking', |
---|
30 | 'shell', |
---|
31 | 'cpu-supplement', |
---|
32 | 'develenv', |
---|
33 | 'eclipse'] |
---|
34 | |
---|
35 | building = build_all |
---|
36 | |
---|
37 | def options(opt): |
---|
38 | docs_waf.cmd_options(opt) |
---|
39 | |
---|
40 | def configure(conf): |
---|
41 | for b in building: |
---|
42 | conf.recurse(b) |
---|
43 | conf.env['BUILD_FROM_TOP'] = 'yes' |
---|
44 | |
---|
45 | def catalogue(ctx): |
---|
46 | docs_waf.xml_catalogue(ctx, building) |
---|
47 | |
---|
48 | def coverpage_js(ctx): |
---|
49 | js = None |
---|
50 | xml = None |
---|
51 | for f in ctx.inputs: |
---|
52 | if f.abspath().endswith('.js'): |
---|
53 | with open(f.abspath()) as i: |
---|
54 | js = i.read() |
---|
55 | elif f.abspath().endswith('.xml'): |
---|
56 | with open(f.abspath()) as i: |
---|
57 | xml = i.read() |
---|
58 | xml = xml.replace('\n', ' \\\n'); |
---|
59 | with open(ctx.outputs[0].abspath(), 'w') as o: |
---|
60 | o.write(js.replace('@CATALOGUE', xml)) |
---|
61 | |
---|
62 | |
---|
63 | def build(ctx): |
---|
64 | # |
---|
65 | # Get the version. |
---|
66 | # |
---|
67 | ver_version, ver_date, ver_released = version.get(ctx, rtems_major_version) |
---|
68 | ctx.env.DATE = ver_date |
---|
69 | ctx.env.RELEASE = ver_version + ' (' + ver_date + ')' |
---|
70 | ctx.env.VERSION = ver_version |
---|
71 | ctx.to_log('Build: %s%s' % (ctx.env.RELEASE, os.linesep)) |
---|
72 | |
---|
73 | # |
---|
74 | # |
---|
75 | # Generate any PlantUML images if enabled. |
---|
76 | # |
---|
77 | ctx.recurse('images') |
---|
78 | ctx.add_group('images') |
---|
79 | |
---|
80 | for b in building: |
---|
81 | ctx.recurse(b) |
---|
82 | |
---|
83 | # |
---|
84 | # Build the catalogue, coverpage.js and install. |
---|
85 | # |
---|
86 | ctx(rule = catalogue, |
---|
87 | target = 'catalogue.xml', |
---|
88 | source = ['wscript', 'common/waf.py'] + ['%s/conf.py' % x for x in building]) |
---|
89 | ctx.install_files('${PREFIX}', 'catalogue.xml') |
---|
90 | ctx(rule = coverpage_js, |
---|
91 | target = 'coverpage.js', |
---|
92 | source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js']) |
---|
93 | ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js') |
---|
94 | # |
---|
95 | # Install the static content. |
---|
96 | # |
---|
97 | ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html') |
---|
98 | static_dir = ctx.path.find_dir('common/coverpage/static') |
---|
99 | ctx.install_files('${PREFIX}/static', |
---|
100 | static_dir.ant_glob('**'), |
---|
101 | cwd = static_dir, |
---|
102 | relative_trick = True) |
---|
103 | |
---|
104 | def install(ctx): |
---|
105 | for b in building: |
---|
106 | ctx.recurse(b) |
---|
107 | |
---|
108 | def cmd_spell(ctx): |
---|
109 | for b in building: |
---|
110 | ctx.recurse(b) |
---|
111 | |
---|
112 | def cmd_linkcheck(ctx): |
---|
113 | for b in building: |
---|
114 | ctx.recurse(b) |
---|