]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/build_option_survey/mkhtml.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / build_option_survey / mkhtml.sh
1 #!/bin/sh
2 # This file is in the public domain
3 # $FreeBSD$
4
5 set -e
6
7 sh reduce.sh
8
9 OPLIST=`sh listallopts.sh`
10
11 ODIR=/usr/obj/`pwd`
12 RDIR=${ODIR}/_.result
13 export ODIR RDIR
14
15 table_td () (
16
17         awk -v R=$1 -v T=$2 -v M=$4 '
18         BEGIN   {
19                 t= R "-" T
20         }
21         $1 == t {
22                 if ($3 == 0 && $5 == 0 && $7 == 0) {
23                         printf "<TD align=center COLSPAN=5>no effect</TD>"
24                 } else {
25                         if ($3 == 0) {
26                                 printf "<TD align=right>+%d</TD>", $3
27                         } else {
28                                 printf "<TD align=right>"
29                                 printf "<A HREF=\"%s/%s.mtree.add.txt\">+%d</A>", M, t, $3
30                                 printf "</TD>"
31                         }
32                         if ($5 == 0) {
33                                 printf "<TD align=right>-%d</TD>", $5
34                         } else {
35                                 printf "<TD align=right>"
36                                 printf "<A HREF=\"%s/%s.mtree.sub.txt\">-%d</A>", M, t, $5
37                                 printf "</TD>"
38                         }
39                         if ($7 == 0) {
40                                 printf "<TD align=right>*%d</TD>", $7
41                         } else {
42                                 printf "<TD align=right>"
43                                 printf "<A HREF=\"%s/%s.mtree.chg.txt\">*%d</A>", M, t, $7
44                                 printf "</TD>"
45                         }
46                         printf "<TD align=right>%d</TD>", $9
47                         printf "<TD align=right>%d</TD>", -$11
48                 }
49                 printf "\n"
50                 d = 1
51                 }
52         END     {
53                 if (d != 1) {
54                         printf "<TD COLSPAN=5></TD>"
55                 }
56         }
57         ' $3/stats
58         mkdir -p $HDIR/$4
59         cp $3/r*.txt $HDIR/$4 || true
60 )
61
62 HDIR=${ODIR}/HTML
63 rm -rf ${HDIR}
64 mkdir -p ${HDIR}
65 H=${HDIR}/index.html
66
67 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
68 <HTML>' > $H
69
70 echo '<HEAD>
71 <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
72 <TITLE>FreeBSD Build Options Survey</TITLE>
73 </HEAD>
74 <BODY bgcolor="#FFFFFF">
75 ' >> $H
76
77 echo '
78 <H2>The table is explained at the bottom</H2>
79 <HR>
80 ' >> $H
81
82 echo '<TABLE  border="1" cellspacing="0">' >> $H
83
84 echo "<TR>" >> $H
85 echo "<TH ROWSPAN=2>src.conf</TH>" >> $H
86 echo "<TH ROWSPAN=2>MK_FOO</TH>" >> $H
87 echo "<TH ROWSPAN=2></TH>" >> $H
88 echo "<TH COLSPAN=5>BuildWorld</TH>" >> $H
89 echo "<TH ROWSPAN=2></TH>" >> $H
90 echo "<TH COLSPAN=5>InstallWorld</TH>" >> $H
91 echo "<TH ROWSPAN=2></TH>" >> $H
92 echo "<TH COLSPAN=5>World</TH>" >> $H
93 echo "</TR>" >> $H
94
95 echo "<TR>" >> $H
96 for i in bw iw w
97 do
98         echo "<TH>A</TH>" >> $H
99         echo "<TH>D</TH>" >> $H
100         echo "<TH>C</TH>" >> $H
101         echo "<TH>KB</TH>" >> $H
102         echo "<TH>Delta</TH>" >> $H
103 done
104 echo "</TR>" >> $H
105
106 majcol ( ) (
107         echo "<TD></TD>" >> $H
108         if [ ! -f $3/$1/done ] ; then
109                 echo "<TD align=center COLSPAN=5>no data yet</TD>" >> $H
110         elif [ -f $3/$1/_.success ] ; then
111                 table_td $2 $1 $3 $4 >> $H
112         else
113                 echo "<TD align=center COLSPAN=5>failed</TD>" >> $H
114         fi
115 )
116
117
118 for o in $OPLIST
119 do
120         md=`echo "${o}=foo" | md5`
121         m=${RDIR}/$md
122         if [ ! -d $m ] ; then
123                 continue
124         fi
125         if [ ! -f $m/stats ] ; then
126                 continue
127         fi
128         echo "=== mkhtml ${d}_${o}"
129
130         echo "<TR>" >> $H
131         echo "<TD><PRE>" >> $H
132         cat $m/src.conf >> $H
133         echo "</PRE></TD>" >> $H
134         echo "<TD><PRE>" >> $H
135         if [ -f $m/bw/_.sc ] ; then
136                 comm -13 ${RDIR}/Ref/_.sc $m/bw/_.sc >> $H
137         fi
138         echo "</PRE></TD>" >> $H
139
140         majcol bw r $m $md
141         majcol iw r $m $md
142         majcol w  r $m $md
143         echo "</TR>" >> $H
144 done
145 echo "</TABLE>" >> $H
146 echo '
147 <HR>
148 <H2>How to read this table</H2>
149 <P>
150 The table has five major columns.
151
152 <OL>
153 <LI><P><B>src.conf</B></P>
154 <P>The name of the option being tested</P>
155 <P>
156 All options are tested both in their WITH_FOO and WITHOUT_FOO variants
157 but if the option has no effect (ie: is the default) it will not appear
158 in the table
159 </P>
160 </LI>
161
162 <LI><P><B>MK_FOO</B></P>
163 <P>Internal build flags affected by this option </P>
164 </LI>
165
166 <LI><P><B>Buildworld</B></P>
167 <P>What happens when the option is given to buildworld but not installworld</P>
168 <PRE>Ie:
169         make buildworld WITH_FOO=yes
170         make installworld 
171 </PRE>
172 </LI>
173
174 <LI><P><B>Installworld</B></P>
175 <P>What happens when the option is given to installworld but not buildworld</P>
176 <PRE>Ie:
177         make buildworld 
178         make installworld WITH_FOO=yes
179 </PRE>
180 </LI>
181
182 <LI><P><B>World</B></P>
183 <P>What happens when the option is given to both buildworld and installworld</P>
184 <PRE>Ie:
185         make buildworld WITH_FOO=yes
186         make installworld WITH_FOO=yes
187 </PRE>
188 </LI>
189 </OL>
190
191 <P>Inside each of the last three major columns there are five subcolumns</P>
192 <OL>
193 <LI><P><B>A</B></P>
194 <P>Number of added files/directories (relative to the option not be given</P>
195 <P>If non-zero, the number links to a list of the added files/directories</P>
196 </LI>
197 <LI><P><B>D</B></P>
198 <P>Number of deleted files/directories (relative to the option not be given</P>
199 <P>If non-zero, the number links to a list of the files not installed files/directories</P>
200 </LI>
201 <LI><P><B>C</B></P>
202 <P>Number of changed files/directories (relative to the option not be given</P>
203 <P>If non-zero, the number links to a list of the files/directories which are differnet (two lines each)</P>
204 </LI>
205 <LI><P><B>KB</B></P>
206 <P>Size of installed operating system in kilobytes</P>
207 <LI><P><B>Delta</B></P>
208 <P>Size change in kilobytes relative to the option not be given</P>
209 </LI>
210 </OL>
211
212 <HR>' >> $H
213 echo '
214 <p>
215     <a href="http://validator.w3.org/check?uri=referer"><img
216         src="http://www.w3.org/Icons/valid-html401"
217         alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
218 </p>
219
220 ' >> $H
221 echo "</HTML>" >> $H
222
223 echo "rsync phk"
224 rsync -r $HDIR/. phk@phk:www/misc/build_options