3 # TOPDIR: set this to the directory containing
4 # your 'mono' and 'mcs' directories. Do NOT use '~' here.
7 # BACKUP: initially this directory should contain a working install of mono.
8 # this directory should minimally contain the 'bin' and 'lib' dirs.
9 # after each successful build, the results are placed in here.
10 BACKUP
=$TOPDIR/install.bak
12 # INSTALL: this is used as the install directory for
13 # the various stages of the build.
14 INSTALL
=$TOPDIR/install
16 # SENDMAIL: uncomment this line if you want to send notifications.
17 # be careful to check the recipients below before running this script!
18 SENDMAIL
=$TOPDIR/mcs
/tools
/tinderbox
/smtp
20 # EMAIL_*: notification addresses. please change these before running!
21 EMAIL_FATAL
="piersh@friskit.com"
22 EMAIL_MESSAGE
="mono-patches@lists.ximian.com"
23 #EMAIL_MESSAGE="piersh@friskit.com"
24 #EMAIL_MESSAGE="mono-hackers-list@ximian.com"
25 EMAIL_FROM
="piersh@friskit.com"
26 EMAIL_CC
="-c mono-hackers-list@lists.ximian.com"
27 EMAIL_HOST
="zeus.sfhq.friskit.com"
29 LOGBASE
=$TOPDIR/.build.log
32 LOGFATAL
=$LOGBASE.fatal
33 LOGDATE
=$TOPDIR/.build.
date
34 LOGLOG
=$TOPDIR/.build.log.log
35 BUILDMSG
=$TOPDIR/.build.msg
38 DELAY_SUCCESS
=5m
# wait after a successful build
39 DELAY_CHECK_BROKEN
=5m
# wait while verifying the build is broken
40 DELAY_STILL_BROKEN
=3m
# wait while waiting for fix
41 DELAY_BROKEN
=5m
# wait after notification sent
43 FILTER_LOG
="sed -e 's/^in <0x[0-9a-z]*>//' -e 's/:[0-9]*): WARNING \*\*:/): WARNING **/' -e 's/^\[[0-9][0-9]*:[0-9][0-9]*\] - .*//' -e 's/^[0-9][0-9]* - Member cache//' -e 's/^[0-9][0-9]* - Misc counter//' -e 's/: [0-9]* Trace\/breakpoint/ : Trace\/breakpoint/' -e 's/Needed to allocate blacklisted block at 0x[0-9a-f]*//'"
47 $SENDMAIL -h $EMAIL_HOST -f $EMAIL_FROM -t $EMAIL_FATAL -a $LOGFATAL -s "[MONOBUILD] FATAL ERROR (`uname -s -m`)"
48 echo FATAL
: `date` >> $LOGLOG
53 function build_mono
()
64 [ -f $LOG ] && mv $LOG $LOGPREV
67 # restore tools from backup
69 cp -a $BACKUP $INSTALL
72 cvs
-z3 update
-APd mcs mono
2>&1 |
tee -a $LOG
73 [ $PIPESTATUS == "0" ] ||
return 1
77 make -f makefile.gnu clean
2>&1 |
tee -a $LOG
78 [ $PIPESTATUS == "0" ] ||
return 1
82 make -f makefile.gnu
2>&1 |
tee -a $LOG
83 [ $PIPESTATUS == "0" ] ||
return 1
87 make -f makefile.gnu
2>&1 |
tee -a $LOG
88 [ $PIPESTATUS == "0" ] ||
return 1
90 # build CORLIB with old tools
91 cd $TOPDIR/mcs
/class
/corlib
92 make -f makefile.gnu
2>&1 |
tee -a $LOG
93 [ $PIPESTATUS == "0" ] ||
return 1
95 # copy new MCS and CORLIB to build tools
96 cp -f $TOPDIR/mcs
/class
/lib
/corlib.dll
$INSTALL/lib
/
97 cp -f $TOPDIR/mcs
/mcs
/mcs.exe
$INSTALL/bin
/
103 # configure mono build
105 .
/autogen.sh
--prefix=$INSTALL 2>&1 |
tee -a $LOG
106 [ $PIPESTATUS == "0" ] ||
return 1
109 make clean
2>&1 |
tee -a $LOG
110 [ $PIPESTATUS == "0" ] ||
return 1
113 make 2>&1 |
tee -a $LOG
114 [ $PIPESTATUS == "0" ] ||
return 1
118 make install 2>&1 |
tee -a $LOG
119 [ $PIPESTATUS == "0" ] ||
return 1
123 # clean/make runtime libraries/tools
125 make -f makefile.gnu clean
2>&1 |
tee -a $LOG
126 [ $PIPESTATUS == "0" ] ||
return 1
128 make -f makefile.gnu
2>&1 |
tee -a $LOG
129 [ $PIPESTATUS == "0" ] ||
return 1
133 # retrieve runtime libraries
134 cd $TOPDIR/mono
/runtime
139 make install 2>&1 |
tee -a $LOG
140 [ $PIPESTATUS == "0" ] ||
return 1
143 # test mcs self-build
145 make -f makefile.gnu clean
2>&1 |
tee -a $LOG
146 [ $PIPESTATUS == "0" ] ||
return 1
147 make -f makefile.gnu
2>&1 |
tee -a $LOG
148 [ $PIPESTATUS == "0" ] ||
return 1
151 # test corlib self-build
152 cd $TOPDIR/mcs
/class
/corlib
153 make -f makefile.gnu clean
2>&1 |
tee -a $LOG
154 [ $PIPESTATUS == "0" ] ||
return 1
155 make -f makefile.gnu
2>&1 |
tee -a $LOG
156 [ $PIPESTATUS == "0" ] ||
return 1
159 # it worked, backup build tools
161 cp -a $INSTALL $BACKUP
166 function compare_logs
()
169 echo Comparing build logs
170 eval $FILTER_LOG $LOG > $LOG.tmp
171 eval $FILTER_LOG $LOGPREV > $LOGPREV.tmp
172 diff -b --brief $LOG.tmp
$LOGPREV.tmp
175 function build_fixed
()
177 echo "Build fixed: `date`" > $BUILDMSG
178 echo "Previous breakage: `cat .build.date.last_fail`" >> $BUILDMSG
179 echo "Previous build: `cat .build.date.last_success`" >> $BUILDMSG
182 $SENDMAIL -h $EMAIL_HOST -f $EMAIL_FROM -t $EMAIL_MESSAGE $EMAIL_CC -s "[MONOBUILD] fixed (`uname -s -m`)" -m $BUILDMSG
186 function build_failed
()
188 echo "Build broken: `date`" > $BUILDMSG
189 echo "Broken since: `cat .build.date.last_fail`" >> $BUILDMSG
190 echo "Previous build: `cat .build.date.last_success`" >> $BUILDMSG
193 sed -e 's/$/
/' < $LOG > errors.txt
194 tail -25 errors.txt
>> $BUILDMSG
198 $SENDMAIL -h $EMAIL_HOST -f $EMAIL_FROM -t $EMAIL_MESSAGE $EMAIL_CC -a errors.txt.gz
-s "[MONOBUILD] broken (`uname -s -m`)" -m $BUILDMSG
199 rm -f $BUILDMSG errors.txt.gz
202 function stabilize
()
205 while ! compare_logs
; do
207 date > $LOGDATE.last_fail
208 echo "|||||||||||||||||||||||||"
209 echo "|||||| LOGS DIFFER ||||||"
210 echo "|||||||||||||||||||||||||"
211 echo CHECK
: `date` >> $LOGLOG
213 echo sleeping
for $DELAY_CHECK_BROKEN
214 sleep $DELAY_CHECK_BROKEN
226 [ -f $LOGPREV ] && mv $LOGPREV $LOG
236 echo "|||||||||||||||||||||||||"
237 echo "|||| BUILD SUCCEEDED ||||"
238 echo "|||||||||||||||||||||||||"
239 echo SUCCESS
: `date` >> $LOGLOG
240 date > $LOGDATE.last_success
241 echo sleeping
for $DELAY_SUCCESS
246 if ! stabilize
; then
250 echo "||||||||||||||||||||||"
251 echo "|||| BUILD BROKEN ||||"
252 echo "||||||||||||||||||||||"
253 echo BROKEN
: `date` >> $LOGLOG
254 date > $LOGDATE.last_fail
255 echo sleeping
for $DELAY_BROKEN
258 until build_mono
; do
261 echo "||||||||||||||||||||||||||||"
262 echo "|||| BUILD STILL BROKEN ||||"
263 echo "||||||||||||||||||||||||||||"
264 echo STILL BROKEN
: `date` >> $LOGLOG
265 date > $LOGDATE.last_fail
266 echo sleeping
for $DELAY_STILL_BROKEN
267 sleep $DELAY_STILL_BROKEN
273 echo "|||||||||||||||||||||"
274 echo "|||| BUILD FIXED ||||"
275 echo "|||||||||||||||||||||"
276 echo FIXED
: `date` >> $LOGLOG
277 date > $LOGDATE.last_success
278 echo sleeping
for $DELAY_SUCCESS