1 | #! /bin/sh |
---|
2 | # |
---|
3 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
4 | # Copyright 2015-2016 Chris Johns (chrisj@rtems.org) |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
8 | # |
---|
9 | # Redistribution and use in source and binary forms, with or without |
---|
10 | # modification, are permitted provided that the following conditions are met: |
---|
11 | # |
---|
12 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
13 | # this list of conditions and the following disclaimer. |
---|
14 | # |
---|
15 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
16 | # this list of conditions and the following disclaimer in the documentation |
---|
17 | # and/or other materials provided with the distribution. |
---|
18 | # |
---|
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
29 | # POSSIBILITY OF SUCH DAMAGE. |
---|
30 | # |
---|
31 | |
---|
32 | # |
---|
33 | # This worker script to build the doco. |
---|
34 | # |
---|
35 | echo "RTEMS Documentation Release builder, v0.1" |
---|
36 | |
---|
37 | # |
---|
38 | # Defaults. |
---|
39 | # |
---|
40 | . ${release_top}/rtems-release-defaults |
---|
41 | |
---|
42 | # |
---|
43 | # Only build if sphinx-build is present on the system. |
---|
44 | # |
---|
45 | if [ "`command -v sphinx-build`"no = no ]; then |
---|
46 | echo "warning: documentation not built" |
---|
47 | exit 0 |
---|
48 | fi |
---|
49 | |
---|
50 | # |
---|
51 | # Common package start. |
---|
52 | # |
---|
53 | . ./rtems-release-package-start |
---|
54 | |
---|
55 | # |
---|
56 | # The workspace pwd |
---|
57 | # |
---|
58 | ws_pwd=${PWD} |
---|
59 | |
---|
60 | # |
---|
61 | # Get the documentation, create the tarball and stamp. |
---|
62 | # |
---|
63 | echo "git clone ${git_remote} ${git_local}" |
---|
64 | git clone ${git_remote} ${git_local} |
---|
65 | |
---|
66 | cd ${git_local} |
---|
67 | echo "git fetch origin" |
---|
68 | git fetch origin |
---|
69 | echo "git archive --format=tar --prefix=${prefix}/ origin/${version}" |
---|
70 | git archive --format=tar --prefix=${prefix}/ origin/${version} | \ |
---|
71 | xz > ../${prefix}-unstamped.tar.xz |
---|
72 | cd .. |
---|
73 | |
---|
74 | # |
---|
75 | # Stamp the source and package |
---|
76 | # |
---|
77 | echo "tar Jxf ../${prefix}-unstamped.tar.xz" |
---|
78 | tar Jxf ${prefix}-unstamped.tar.xz |
---|
79 | |
---|
80 | cd ${prefix} |
---|
81 | # |
---|
82 | # This is a hack until I add support for the VERSION file created below. |
---|
83 | # |
---|
84 | cat wscript | sed -e "s/^version[[:space:]].*=.*$/version = '${release}'/g" > wscript.tmp |
---|
85 | rm -f wscript |
---|
86 | mv wscript.tmp wscript |
---|
87 | echo "Creating VERSION: ${release}" |
---|
88 | echo "[version]" > VERSION |
---|
89 | echo "release = ${release}" >> VERSION |
---|
90 | cd .. |
---|
91 | |
---|
92 | echo "tar cf - ${prefix}" |
---|
93 | tar cf - ${prefix} | xz > ../${prefix}.tar.xz |
---|
94 | |
---|
95 | echo "Created: ${release}/${prefix}.tar.xz" |
---|
96 | |
---|
97 | # |
---|
98 | # Build the docs. |
---|
99 | # |
---|
100 | mkdir install |
---|
101 | cd ${prefix} |
---|
102 | ./waf distclean configure --prefix=../install/${prefix} --pdf --singlehtml |
---|
103 | ./waf build install |
---|
104 | cd .. |
---|
105 | |
---|
106 | # |
---|
107 | # Package the docs, PDF first. |
---|
108 | # |
---|
109 | mkdir ${top}/${release}/docs |
---|
110 | cd install |
---|
111 | echo "Creating DOC all rtems-${release}-docs-all.tar.xz" |
---|
112 | tar cf - * > ${top}/${release}/docs/rtems-${release}-docs-all.tar.xz |
---|
113 | for p in $(find . -name \*.pdf) |
---|
114 | do |
---|
115 | manual=$(echo $(basename $p) | sed -e "s/\\..*//") |
---|
116 | base=$(dirname $p) |
---|
117 | # |
---|
118 | # Compress the PDF and move it out of the way. |
---|
119 | # |
---|
120 | echo "Creating PDF rtems-${release}-${manual}.pdf.xz" |
---|
121 | xz $p |
---|
122 | mv $p.xz ${top}/${release}/docs/rtems-${release}-${manual}.pdf.xz |
---|
123 | # |
---|
124 | # Create the single html manual |
---|
125 | # |
---|
126 | echo "Creating SingleHTML rtems-${release}-${manual}.html.xz" |
---|
127 | mv ${base}/${manual}.html ${base}/rtems-${release}-${manual}.html |
---|
128 | xz ${base}/rtems-${release}-${manual}.html |
---|
129 | mv ${base}/rtems-${release}-${manual}.html.xz ${top}/${release}/docs/. |
---|
130 | # |
---|
131 | # Tar the multi-page html and install. |
---|
132 | # |
---|
133 | echo "Creating HTML rtems-${release}-${manual}-html.tar.xz" |
---|
134 | tar cf - ${base}/${manual} > ${top}/${release}/docs/rtems-${release}-${manual}-html.tar.xz |
---|
135 | done |
---|
136 | cd .. |
---|
137 | |
---|
138 | # |
---|
139 | # Comman package end. |
---|
140 | # |
---|
141 | . ${top}/rtems-release-package-end |
---|
142 | |
---|
143 | cd ${release}/docs |
---|
144 | rm -f ${checksum}sum.txt |
---|
145 | for f in $(ls -1) |
---|
146 | do |
---|
147 | if [ ! -d ${f} ]; then |
---|
148 | csum=$(${checksum} -q ${f}) |
---|
149 | echo "${csum} ${f}" >> ${checksum}sum.txt |
---|
150 | fi |
---|
151 | done |
---|
152 | cd .. |
---|
153 | |
---|
154 | echo "Created: ${release}/docs/${checksum}sum.txt" |
---|
155 | echo "Created: ${release}/docs" |
---|
156 | |
---|
157 | exit 0 |
---|