blob: 92b1abde905cfb35d1b7a524e5314ad546a3289e [file] [log] [blame]
Mark Whitley1171c2f2001-01-04 01:05:55 +00001#!/usr/bin/perl
2
3# multibuild.pl
4# Tests BusyBox-0.48 (at least) to see if each applet builds
5# properly on its own. The most likely problems this will
6# flush out are those involving preprocessor instructions in
7# utility.c.
8
9$logfile = "multibuild.log";
10
11# Support building from pristine source
12$make_opt = "-f $ARGV[0]/Makefile BB_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne "");
13
14# Move the config file to a safe place
15-e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die;
16
17# Clear previous log file, if any
18unlink($logfile);
19
20# Parse the config file
21open(C,"<Config.h.orig") || die;
22while (<C>) {
23 if ($in_trailer) {
24 $trailer .= $_;
25 } else {
26 $in_trailer=1 if /End of Applications List/;
27 if (/^\/*#define BB_([A-Z_]*)/) {
28 push @apps, $1;
29 }
30 }
31}
32close C;
33
34# Do the real work ...
35for $a (@apps) {
36 # print "Testing build of applet $a ...\n";
37 open (O, ">Config.h") || die;
38 print O "#define BB_$a\n", $trailer;
39 close O;
40 system("echo -e '\n***\n$a\n***' >>$logfile");
41 # todo: figure out why the "rm -f *.o" is needed
42 $result{$a} = system("rm -f *.o; make $make_opt busybox >>$logfile 2>&1");
43 $flag = $result{$a} ? "FAIL" : "OK";
44 print "Applet $a: $flag\n";
45}
46
47# Clean up our mess
48system("mv -f Config.h.orig Config.h");
49
50print "See $logfile for details.\n";
51