7 use setup qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
9 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
14 @EXPORT_OK = qw($directory $tool $file $line $message);
16 use vars qw($directory $tool $file $line $message);
18 use output qw($output);
19 use options qw($options);
21 ########################################################################
23 ########################################################################
28 ########################################################################
30 ########################################################################
35 if(!defined($where)) {
43 $context .= "<$where>";
47 $context = "<$where>";
54 $output->write("$directory: $context: can't parse output: '$current'\n");
56 $output->write("$directory: $context: can't parse output: '$current'\n");
61 ########################################################################
63 ########################################################################
74 my ($new_tool, $read_files, $write_files, $remove_files) = command($_);
75 if(defined($new_tool)) {
81 if($directory && $directory ne ".") {
82 $progress .= "$directory: ";
85 $progress .= "$tool: ";
88 if($tool =~ /^cd|make$/) {
90 } elsif($tool =~ /^ld$/) {
91 foreach my $file (@{$read_files}) {
92 $output->lazy_progress("${progress}reading '$file'");
94 my $file = $$write_files[0];
95 $output->progress("$progress: writing '$file'");
96 } elsif($tool =~ /^rm$/) {
97 foreach my $file (@{$remove_files}) {
98 $output->lazy_progress("${progress}removing '$file'");
101 if($#$read_files >= 0) {
102 $progress .= "read[" . join(" ", @{$read_files}) . "]";
104 if($#$write_files >= 0) {
105 if($#$read_files >= 0) {
108 $progress .= "write[" . join(" ", @{$write_files}) . "]";
110 if($#$remove_files >= 0) {
111 if($#$read_files >= 0 || $#$write_files >= 0) {
114 $progress .= "remove[" . join(" ", @{$remove_files}) . "]";
117 $output->progress($progress);
123 my $make = $options->make;
125 if(/^Wine build complete\.$/) {
127 } elsif(/^(.*?) is newer than (.*?), please rerun (.*?)\!$/) {
129 } elsif(/^(.*?) is older than (.*?), please rerun (.*?)$/) {
131 } elsif(/^\`(.*?)\' is up to date.$/) {
134 } elsif(s/^$make(?:\[(\d+)\])?:\s*//) {
137 } elsif(!defined($tool)) {
139 } elsif($tool eq "make") {
141 } elsif($tool eq "bison" && /^conflicts:\s+\d+\s+shift\/reduce$/) {
143 } elsif($tool eq "gcc" && /^(?:In file included |\s*)from (.+?):(\d+)[,:]$/) {
145 } elsif($tool =~ /^gcc|ld$/ && s/^(.+?\.s?o)(?:\(.*?\))?:\s*//) {
148 } elsif($tool =~ /^gcc|ld$/ && s/^(.*?)ld:\s*//) {
151 } elsif($tool =~ /^gcc|ld$/ && s/^collect2:\s*//) {
153 ld_output("collect2", $_);
154 } elsif($tool eq "gcc" && s/^(.+?\.[chly]):\s*//) {
156 } elsif($tool eq "winebuild" && s/^(.+?\.spec):\s*//) {
157 winebuild_output($1, $_);
158 } elsif($tool eq "wmc" && s/^(.+?\.mc):\s*//) {
160 } elsif($tool eq "wrc" && s/^(.+?\.rc):\s*//) {
162 } elsif($tool eq "cd" && s/^\/bin\/sh:\s*cd:\s*//) {
175 ########################################################################
177 ########################################################################
188 } elsif(/^\*\*\* \[(.*?)\] Error (\d+)$/) {
190 } elsif(/^\*\*\* Error code (\d+)$/) {
192 } elsif(/^\*\*\* Warning:\s+/) { #
193 if(/^File \`(.+?)\' has modification time in the future \((.+?) > \(.+?\)\)$/) {
196 error("make_output");
198 } elsif(/^\`(.*?)\' is up to date.$/) {
200 } elsif(/^\[(.*?)\] Error (\d+) \(ignored\)$/) {
202 } elsif(/^don\'t know how to make (.*?)\. Stop$/) {
204 } elsif(/^(Entering|Leaving) directory \`(.*?)\'$/) {
205 if($1 eq "Entering") {
212 foreach my $component (split(/\//, $directory)) {
213 if($component eq "wine") {
216 push @components, $component;
219 $directory = join("/", @components);
220 } elsif(/^(.*?) is older than (.*?), please rerun (.*?)\$/) {
222 } elsif(/^Nothing to be done for \`(.*?)\'\.$/) {
224 } elsif(s/^warning:\s+//) {
225 if(/^Clock skew detected. Your build may be incomplete.$/) {
228 error("make_output");
230 } elsif(/^Stop in (.*?)\.$/) {
235 error("make_output");
240 ########################################################################
242 ########################################################################
249 my $read_files = ["<???>"];
250 my $write_files = ["<???>"];
251 my $remove_files = [];
255 if(s/^\[\s+-d\s+(.*?)\s+\]\s+\|\|\s+//) {
261 ($read_files, $write_files) = ar_command($_);
262 } elsif(s/^as\s+//) {
264 ($read_files, $write_files) = as_command($_);
265 } elsif(s/^bison\s+//) {
267 ($read_files, $write_files) = bison_command($_);
268 } elsif(s/^cd\s+//) {
270 ($read_files, $write_files) = cd_command($_);
271 } elsif(s/^flex\s+//) {
273 ($read_files, $write_files) = flex_command($_);
274 } elsif(s/^for\s+//) {
276 ($read_files, $write_files) = for_command($_);
277 } elsif(s/^\/usr\/bin\/install\s+//) {
279 ($read_files, $write_files) = install_command($_);
280 } elsif(s/^ld\s+//) {
282 ($read_files, $write_files) = ld_command($_);
283 } elsif(s/^\/sbin\/ldconfig\s+//) {
285 ($read_files, $write_files) = ldconfig_command();
286 } elsif(s/^gcc\s+//) {
288 ($read_files, $write_files) = gcc_command($_);
289 } elsif(s/^(?:(?:\.\.\/)+|\.\/)tools\/makedep\s+//) {
291 ($read_files, $write_files) = makedep_command($_);
292 } elsif(s/^mkdir\s+//) {
294 ($read_files, $write_files) = mkdir_command($_);
295 } elsif(s/^ranlib\s+//) {
297 ($read_files, $write_files) = ranlib_command($_);
298 } elsif(s/^rm\s+//) {
300 ($read_files, $write_files, $remove_files) = rm_command($_);
301 } elsif(s/^sed\s+//) {
303 ($read_files, $write_files) = sed_command($_);
304 } elsif(s/^strip\s+//) {
306 ($read_files, $write_files) = strip_command($_);
307 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/winebuild\/winebuild\s+//) {
309 ($read_files, $write_files) = winebuild_command($_);
310 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wmc\/wmc\s+//) {
312 ($read_files, $write_files) = wmc_command($_);
313 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wrc\/wrc\s+//) {
315 ($read_files, $write_files) = wrc_command($_);
318 return ($tool, $read_files, $write_files, $remove_files);
321 ########################################################################
323 ########################################################################
331 if(/rc\s+(\S+)(\s+\S+)+$/) {
334 $read_files =~ s/^\s*//;
335 $read_files = [split(/\s+/, $read_files)];
340 return ($read_files, $write_files);
343 ########################################################################
345 ########################################################################
353 if(/-o\s+(\S+)\s+(\S+)$/) {
360 return ($read_files, $write_files);
363 ########################################################################
365 ########################################################################
373 ########################################################################
375 ########################################################################
383 ########################################################################
385 ########################################################################
390 if(/^(.*?): No such file or directory/) {
391 $message = "directory '$1' doesn't exist";
395 ########################################################################
397 ########################################################################
405 ########################################################################
407 ########################################################################
415 ########################################################################
417 ########################################################################
423 if(/-o\s+(\S+)\s+(\S+)$/) {
427 $write_file =~ s%^\./%%;
428 $read_file =~ s%^\./%%;
430 $write_files = [$write_file];
431 $read_files = [$read_file];
432 } elsif(/-o\s+(\S+)/) {
435 $write_file =~ s%^\./%%;
437 $write_files = [$write_file];
438 $read_files = ["<???>"];
439 } elsif(/^-shared.*?-o\s+(\S+)/) {
442 $write_file =~ s%^\./%%;
444 $write_files = [$write_file];
445 $read_files = ["<???>"];
447 error("gcc_command");
450 return ($read_files, $write_files);
453 ########################################################################
455 ########################################################################
463 if(s/^warning:\s+//) {
468 } elsif(/^((?:signed |unsigned )?(?:int|long)) format, (different type|\S+) arg \(arg (\d+)\)$/) {
471 HACCEL|HACMDRIVER|HANDLE|HBITMAP|HBRUSH|HCALL|HCURSOR|HDC|HDRVR|HDESK|HDRAWDIB
472 HGDIOBJ|HKL|HGLOBAL|HIMC|HINSTANCE|HKEY|HLOCAL|
473 HMENU|HMIDISTRM|HMIDIIN|HMIDIOUT|HMIXER|HMIXEROBJ|HMMIO|HMODULE|
474 HLINE|HPEN|HPHONE|HPHONEAPP|
475 HRASCONN|HRGN|HRSRC|HWAVEIN|HWAVEOUT|HWINSTA|HWND|
476 SC_HANDLE|WSAEVENT|handle_t|pointer)$/x)
482 } elsif(/^\(near initialization for \`(.*?)\'\)$/) {
484 } elsif(/^\`(.*?)\' defined but not used$/) {
486 } elsif(/^\`(.*?)\' is not at beginning of declaration$/) {
488 } elsif(/^\`%x\' yields only last 2 digits of year in some locales$/) {
490 } elsif(/^assignment makes integer from pointer without a cast$/) {
492 } elsif(/^assignment makes pointer from integer without a cast$/) {
494 } elsif(/^assignment from incompatible pointer type$/) {
496 } elsif(/^cast from pointer to integer of different size$/) {
498 } elsif(/^comparison between pointer and integer$/) {
500 } elsif(/^comparison between signed and unsigned$/) {
502 } elsif(/^comparison of unsigned expression < 0 is always false$/) {
504 } elsif(/^comparison of unsigned expression >= 0 is always true$/) {
506 } elsif(/^conflicting types for built-in function \`(.*?)\'$/) {
508 } elsif(/^empty body in an if-statement$/) {
510 } elsif(/^empty body in an else-statement$/) {
512 } elsif(/^implicit declaration of function \`(.*?)\'$/) {
514 } elsif(/^initialization from incompatible pointer type$/) {
516 } elsif(/^initialization makes pointer from integer without a cast$/) {
518 } elsif(/^missing initializer$/) {
520 } elsif(/^ordered comparison of pointer with integer zero$/) {
522 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') from incompatible pointer type$/) {
525 if(defined($name) && $name =~ /^GDI_AllocObject$/) {
530 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes integer from pointer without a cast$/) {
532 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes pointer from integer without a cast$/) {
534 } elsif(/^return makes integer from pointer without a cast$/) {
536 } elsif(/^return makes pointer from integer without a cast$/) {
538 } elsif(/^type of \`(.*?)\' defaults to \`(.*?)\'$/) {
540 } elsif(/^unused variable \`(.*?)\'$/) {
542 } elsif(!$options->pedantic) {
550 $message = "function $function: warning: $_";
552 $message = "warning: $_";
557 } elsif(/^\`(.*?)\' undeclared \(first use in this function\)$/) {
559 } elsif(/^\(Each undeclared identifier is reported only once$/) {
561 } elsif(/^conflicting types for \`(.*?)\'$/) {
563 } elsif(/^for each function it appears in.\)$/) {
565 } elsif(/^too many arguments to function$/) {
567 } elsif(/^previous declaration of \`(.*?)\'$/) {
569 } elsif(/^parse error before `(.*?)'$/) {
571 } elsif(!$options->pedantic) {
576 } elsif(/^In function \`(.*?)\':$/) {
578 } elsif(/^At top level:$/) {
585 ########################################################################
587 ########################################################################
589 sub install_command {
595 ########################################################################
597 ########################################################################
605 if(/-r\s+(.*?)\s+-o\s+(\S+)$/) {
607 $read_files = [split(/\s+/, $1)];
612 return ($read_files, $write_files);
615 ########################################################################
617 ########################################################################
625 } elsif(/^In function \`(.*?)\':$/) {
627 } elsif(/^more undefined references to \`(.*?)\' follow$/) {
629 } elsif(/^the use of \`(.+?)\' is dangerous, better use \`(.+?)\'$/) {
631 } elsif(/^undefined reference to \`(.*?)\'$/) {
633 } elsif(/^warning: (.*?)\(\) possibly used unsafely; consider using (.*?)\(\)$/) {
635 } elsif(/^warning: type and size of dynamic symbol \`(.*?)\' are not defined$/) {
642 ########################################################################
644 ########################################################################
646 sub ldconfig_command {
652 ########################################################################
654 ########################################################################
656 sub makedep_command {
662 ########################################################################
664 ########################################################################
672 ########################################################################
674 ########################################################################
682 $read_files = [split(/\s+/)];
685 return ($read_files, $write_files);
688 ########################################################################
690 ########################################################################
695 return ([], [], [split(/\s+/, $_)]);
698 ########################################################################
700 ########################################################################
708 ########################################################################
710 ########################################################################
718 ########################################################################
720 ########################################################################
722 sub winebuild_command {
728 ########################################################################
730 ########################################################################
732 sub winebuild_output {
739 ########################################################################
741 ########################################################################
752 my $rc_file = $mc_file;
753 $rc_file =~ s/\.mc$/.rc/;
755 $write_files = [$rc_file];
756 $read_files = [$mc_file];
758 error("wmc_command");
761 return ($read_files, $write_files);
764 ########################################################################
766 ########################################################################
773 ########################################################################
775 ########################################################################
786 my $o_file = $rc_file;
787 $o_file =~ s/\.rc$/.o/;
789 $write_files = [$o_file];
790 $read_files = [$rc_file];
792 error("wrc_command");
795 return ($read_files, $write_files);
798 ########################################################################
800 ########################################################################