aboutsummaryrefslogtreecommitdiff
path: root/tools/tools/build_option_survey/mkhtml.sh
blob: a6261f918887c703b425b066ddc79673597e1bad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/sh
# This file is in the public domain
# $FreeBSD$

set -e

sh reduce.sh

OPLIST=`sh listallopts.sh`

ODIR=/usr/obj/`pwd`
RDIR=${ODIR}/_.result
export ODIR RDIR

table_td () (

	awk -v R=$1 -v T=$2 -v M=$4 '
	BEGIN	{
		t= R "-" T
	}
	$1 == t {
		if ($3 == 0 && $5 == 0 && $7 == 0) {
			printf "<TD align=center COLSPAN=5>no effect</TD>"
		} else {
			if ($3 == 0) {
				printf "<TD align=right>+%d</TD>", $3
			} else {
				printf "<TD align=right>"
				printf "<A HREF=\"%s/%s.mtree.add.txt\">+%d</A>", M, t, $3
				printf "</TD>"
			}
			if ($5 == 0) {
				printf "<TD align=right>-%d</TD>", $5
			} else {
				printf "<TD align=right>"
				printf "<A HREF=\"%s/%s.mtree.sub.txt\">-%d</A>", M, t, $5
				printf "</TD>"
			}
			if ($7 == 0) {
				printf "<TD align=right>*%d</TD>", $7
			} else {
				printf "<TD align=right>"
				printf "<A HREF=\"%s/%s.mtree.chg.txt\">*%d</A>", M, t, $7
				printf "</TD>"
			}
			printf "<TD align=right>%d</TD>", $9
			printf "<TD align=right>%d</TD>", -$11
		}
		printf "\n"
		d = 1
		}
	END	{
		if (d != 1) {
			printf "<TD COLSPAN=5></TD>"
		}
	}
	' $3/stats
	mkdir -p $HDIR/$4
	cp $3/r*.txt $HDIR/$4 || true
)

HDIR=${ODIR}/HTML
rm -rf ${HDIR}
mkdir -p ${HDIR}
H=${HDIR}/index.html

echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>' > $H

echo '<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>FreeBSD Build Options Survey</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
' >> $H

echo '
<H2>The table is explained at the bottom</H2>
<HR>
' >> $H

echo '<TABLE  border="1" cellspacing="0">' >> $H

echo "<TR>" >> $H
echo "<TH ROWSPAN=2>src.conf</TH>" >> $H
echo "<TH ROWSPAN=2>MK_FOO</TH>" >> $H
echo "<TH ROWSPAN=2></TH>" >> $H
echo "<TH COLSPAN=5>BuildWorld</TH>" >> $H
echo "<TH ROWSPAN=2></TH>" >> $H
echo "<TH COLSPAN=5>InstallWorld</TH>" >> $H
echo "<TH ROWSPAN=2></TH>" >> $H
echo "<TH COLSPAN=5>World</TH>" >> $H
echo "</TR>" >> $H

echo "<TR>" >> $H
for i in bw iw w
do
	echo "<TH>A</TH>" >> $H
	echo "<TH>D</TH>" >> $H
	echo "<TH>C</TH>" >> $H
	echo "<TH>KB</TH>" >> $H
	echo "<TH>Delta</TH>" >> $H
done
echo "</TR>" >> $H

majcol ( ) (
	echo "<TD></TD>" >> $H
	if [ ! -f $3/$1/done ] ; then
		echo "<TD align=center COLSPAN=5>no data yet</TD>" >> $H
	elif [ -f $3/$1/_.success ] ; then
		table_td $2 $1 $3 $4 >> $H
	else
		echo "<TD align=center COLSPAN=5>failed</TD>" >> $H
	fi
)


for o in $OPLIST
do
	md=`echo "${o}=foo" | md5`
	m=${RDIR}/$md
	if [ ! -d $m ] ; then
		continue
	fi
	if [ ! -f $m/stats ] ; then
		continue
	fi
	echo "=== mkhtml ${d}_${o}"

	echo "<TR>" >> $H
	echo "<TD><PRE>" >> $H
	cat $m/src.conf >> $H
	echo "</PRE></TD>" >> $H
	echo "<TD><PRE>" >> $H
	if [ -f $m/bw/_.sc ] ; then
		comm -13 ${RDIR}/Ref/_.sc $m/bw/_.sc >> $H
	fi
	echo "</PRE></TD>" >> $H

	majcol bw r $m $md
	majcol iw r $m $md
	majcol w  r $m $md
	echo "</TR>" >> $H
done
echo "</TABLE>" >> $H
echo '
<HR>
<H2>How to read this table</H2>
<P>
The table has five major columns.

<OL>
<LI><P><B>src.conf</B></P>
<P>The name of the option being tested</P>
<P>
All options are tested both in their WITH_FOO and WITHOUT_FOO variants
but if the option has no effect (ie: is the default) it will not appear
in the table
</P>
</LI>

<LI><P><B>MK_FOO</B></P>
<P>Internal build flags affected by this option </P>
</LI>

<LI><P><B>Buildworld</B></P>
<P>What happens when the option is given to buildworld but not installworld</P>
<PRE>Ie:
	make buildworld WITH_FOO=yes
	make installworld 
</PRE>
</LI>

<LI><P><B>Installworld</B></P>
<P>What happens when the option is given to installworld but not buildworld</P>
<PRE>Ie:
	make buildworld 
	make installworld WITH_FOO=yes
</PRE>
</LI>

<LI><P><B>World</B></P>
<P>What happens when the option is given to both buildworld and installworld</P>
<PRE>Ie:
	make buildworld WITH_FOO=yes
	make installworld WITH_FOO=yes
</PRE>
</LI>
</OL>

<P>Inside each of the last three major columns there are five subcolumns</P>
<OL>
<LI><P><B>A</B></P>
<P>Number of added files/directories (relative to the option not be given</P>
<P>If non-zero, the number links to a list of the added files/directories</P>
</LI>
<LI><P><B>D</B></P>
<P>Number of deleted files/directories (relative to the option not be given</P>
<P>If non-zero, the number links to a list of the files not installed files/directories</P>
</LI>
<LI><P><B>C</B></P>
<P>Number of changed files/directories (relative to the option not be given</P>
<P>If non-zero, the number links to a list of the files/directories which are differnet (two lines each)</P>
</LI>
<LI><P><B>KB</B></P>
<P>Size of installed operating system in kilobytes</P>
<LI><P><B>Delta</B></P>
<P>Size change in kilobytes relative to the option not be given</P>
</LI>
</OL>

<HR>' >> $H
echo '
<p>
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-html401"
        alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
</p>

' >> $H
echo "</HTML>" >> $H

echo "rsync phk"
rsync -r $HDIR/. phk@phk:www/misc/build_options