xref: /freebsd/tools/tools/build_option_survey/option_survey.sh (revision 68d71fe787873e1891efa0c85513b63a11093975)
168d71fe7SPoul-Henning Kamp#!/bin/sh
268d71fe7SPoul-Henning Kamp# This file is in the public domain
368d71fe7SPoul-Henning Kamp# $FreeBSD$
468d71fe7SPoul-Henning Kamp
568d71fe7SPoul-Henning Kampset -e
668d71fe7SPoul-Henning Kamp
768d71fe7SPoul-Henning Kampbw ( ) (
868d71fe7SPoul-Henning Kamp	cd ../../..
968d71fe7SPoul-Henning Kamp	make -j 4 buildworld \
1068d71fe7SPoul-Henning Kamp		__MAKE_CONF=${ODIR}/make.conf \
1168d71fe7SPoul-Henning Kamp		> ${ODIR}/_.bw 2>&1
1268d71fe7SPoul-Henning Kamp	make -j 4 buildkernel \
1368d71fe7SPoul-Henning Kamp		KERNCONF=GENERIC \
1468d71fe7SPoul-Henning Kamp		__MAKE_CONF=${ODIR}/make.conf \
1568d71fe7SPoul-Henning Kamp		> ${ODIR}/_.bk 2>&1
1668d71fe7SPoul-Henning Kamp)
1768d71fe7SPoul-Henning Kamp
1868d71fe7SPoul-Henning Kampiw ( ) (
1968d71fe7SPoul-Henning Kamp	dd if=/dev/zero of=${ODIR}/_.i bs=1m count=200
2068d71fe7SPoul-Henning Kamp	mkdir -p ${MNT}
2168d71fe7SPoul-Henning Kamp	MD=`mdconfig -a -t vnode -f ${ODIR}/_.i`
2268d71fe7SPoul-Henning Kamp	trap "umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT
2368d71fe7SPoul-Henning Kamp	newfs -O1 -U -b 4096 -f 512 /dev/$MD
2468d71fe7SPoul-Henning Kamp	mount /dev/${MD} ${MNT}
2568d71fe7SPoul-Henning Kamp
2668d71fe7SPoul-Henning Kamp	cd ../../..
2768d71fe7SPoul-Henning Kamp	make installworld \
2868d71fe7SPoul-Henning Kamp		__MAKE_CONF=${ODIR}/make.conf \
2968d71fe7SPoul-Henning Kamp		DESTDIR=${MNT} \
3068d71fe7SPoul-Henning Kamp		> ${ODIR}/_.iw 2>&1
3168d71fe7SPoul-Henning Kamp	cd etc
3268d71fe7SPoul-Henning Kamp	make distribution \
3368d71fe7SPoul-Henning Kamp		__MAKE_CONF=${ODIR}/make.conf \
3468d71fe7SPoul-Henning Kamp		DESTDIR=${MNT} \
3568d71fe7SPoul-Henning Kamp		> ${ODIR}/_.etc 2>&1
3668d71fe7SPoul-Henning Kamp	cd ..
3768d71fe7SPoul-Henning Kamp	make installkernel \
3868d71fe7SPoul-Henning Kamp		KERNCONF=GENERIC \
3968d71fe7SPoul-Henning Kamp		DESTDIR=${MNT} \
4068d71fe7SPoul-Henning Kamp		__MAKE_CONF=${ODIR}/make.conf \
4168d71fe7SPoul-Henning Kamp		> ${ODIR}/_.ik 2>&1
4268d71fe7SPoul-Henning Kamp
4368d71fe7SPoul-Henning Kamp	sync ${MNT}
4468d71fe7SPoul-Henning Kamp	( cd ${MNT} && mtree -c ) > ${ODIR}/_.mtree
4568d71fe7SPoul-Henning Kamp	( cd ${MNT} && du ) > ${ODIR}/_.du
4668d71fe7SPoul-Henning Kamp	( df -i ${MNT} ) > ${ODIR}/_.df
4768d71fe7SPoul-Henning Kamp)
4868d71fe7SPoul-Henning Kamp
4968d71fe7SPoul-Henning KampODIR=/usr/obj/`pwd`
5068d71fe7SPoul-Henning KampMNT=${ODIR}/_.mnt
5168d71fe7SPoul-Henning KampMAKEOBJDIRPREFIX=$ODIR
5268d71fe7SPoul-Henning Kampexport MAKEOBJDIRPREFIX ODIR MNT
5368d71fe7SPoul-Henning Kamp
5468d71fe7SPoul-Henning Kampif false ; then
5568d71fe7SPoul-Henning Kamp	if rm -rf ${ODIR} ; then
5668d71fe7SPoul-Henning Kamp		true
5768d71fe7SPoul-Henning Kamp	else
5868d71fe7SPoul-Henning Kamp		chflags -R noschg ${ODIR}
5968d71fe7SPoul-Henning Kamp		rm -rf ${ODIR}
6068d71fe7SPoul-Henning Kamp	fi
6168d71fe7SPoul-Henning Kamp	mkdir -p ${ODIR}
6268d71fe7SPoul-Henning Kamp
6368d71fe7SPoul-Henning Kamp	echo '' > ${ODIR}/make.conf
6468d71fe7SPoul-Henning Kamp
6568d71fe7SPoul-Henning Kamp	bw
6668d71fe7SPoul-Henning Kampfi
6768d71fe7SPoul-Henning Kamp
6868d71fe7SPoul-Henning Kampif false ; then
6968d71fe7SPoul-Henning Kamp	rm -rf Tmp
7068d71fe7SPoul-Henning Kamp
7168d71fe7SPoul-Henning Kamp	echo '' > ${ODIR}/make.conf
7268d71fe7SPoul-Henning Kamp
7368d71fe7SPoul-Henning Kamp	if iw ; then
7468d71fe7SPoul-Henning Kamp		m=Tmp/Ref
7568d71fe7SPoul-Henning Kamp		mkdir -p $m
7668d71fe7SPoul-Henning Kamp		cp ${ODIR}/_.df $m
7768d71fe7SPoul-Henning Kamp		cp ${ODIR}/_.mtree $m
7868d71fe7SPoul-Henning Kamp		cp ${ODIR}/_.du $m
7968d71fe7SPoul-Henning Kamp	fi
8068d71fe7SPoul-Henning Kamp
8168d71fe7SPoul-Henning Kamp	cat no_list | while read o
8268d71fe7SPoul-Henning Kamp	do
8368d71fe7SPoul-Henning Kamp		echo "IW $o"
8468d71fe7SPoul-Henning Kamp		echo "$o=YES" > ${ODIR}/make.conf
8568d71fe7SPoul-Henning Kamp		m=Tmp/`md5 < ${ODIR}/make.conf`/iw
8668d71fe7SPoul-Henning Kamp		mkdir -p $m
8768d71fe7SPoul-Henning Kamp		echo $m
8868d71fe7SPoul-Henning Kamp		cp ${ODIR}/make.conf $m
8968d71fe7SPoul-Henning Kamp		if iw ; then
9068d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.df $m
9168d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.mtree $m
9268d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.du $m
9368d71fe7SPoul-Henning Kamp		else
9468d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.iw $m
9568d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.ik $m
9668d71fe7SPoul-Henning Kamp		fi
9768d71fe7SPoul-Henning Kamp	done
9868d71fe7SPoul-Henning Kampfi
9968d71fe7SPoul-Henning Kamp
10068d71fe7SPoul-Henning Kampif true ; then
10168d71fe7SPoul-Henning Kamp	cat no_list | while read o
10268d71fe7SPoul-Henning Kamp	do
10368d71fe7SPoul-Henning Kamp		# First build+installworld
10468d71fe7SPoul-Henning Kamp		echo "W $o"
10568d71fe7SPoul-Henning Kamp		echo "$o=YES" > ${ODIR}/make.conf
10668d71fe7SPoul-Henning Kamp
10768d71fe7SPoul-Henning Kamp		m=Tmp/`md5 < ${ODIR}/make.conf`/w
10868d71fe7SPoul-Henning Kamp		mkdir -p $m
10968d71fe7SPoul-Henning Kamp		echo $m
11068d71fe7SPoul-Henning Kamp		cp ${ODIR}/make.conf $m
11168d71fe7SPoul-Henning Kamp
11268d71fe7SPoul-Henning Kamp		if bw ; then
11368d71fe7SPoul-Henning Kamp			true
11468d71fe7SPoul-Henning Kamp		else
11568d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.bw $m || true
11668d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.bk $m || true
11768d71fe7SPoul-Henning Kamp		fi
11868d71fe7SPoul-Henning Kamp		if iw ; then
11968d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.df $m
12068d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.mtree $m
12168d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.du $m
12268d71fe7SPoul-Henning Kamp		else
12368d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.iw $m
12468d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.ik $m
12568d71fe7SPoul-Henning Kamp		fi
12668d71fe7SPoul-Henning Kamp
12768d71fe7SPoul-Henning Kamp		# Then only buildworld
12868d71fe7SPoul-Henning Kamp		echo "BW $o"
12968d71fe7SPoul-Henning Kamp		m=Tmp/`md5 < ${ODIR}/make.conf`/bw
13068d71fe7SPoul-Henning Kamp		mkdir -p $m
13168d71fe7SPoul-Henning Kamp		echo $m
13268d71fe7SPoul-Henning Kamp		cp ${ODIR}/make.conf $m
13368d71fe7SPoul-Henning Kamp		echo '' > ${ODIR}/make.conf
13468d71fe7SPoul-Henning Kamp		if iw ; then
13568d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.df $m
13668d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.mtree $m
13768d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.du $m
13868d71fe7SPoul-Henning Kamp		else
13968d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.iw $m
14068d71fe7SPoul-Henning Kamp			cp ${ODIR}/_.ik $m
14168d71fe7SPoul-Henning Kamp		fi
14268d71fe7SPoul-Henning Kamp
14368d71fe7SPoul-Henning Kamp
14468d71fe7SPoul-Henning Kamp	done
14568d71fe7SPoul-Henning Kampfi
146