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 "ld" && s/^(.+?\.c):(?:\d+:)?\s*//) {
158 } elsif($tool eq "winebuild" && s/^(.+?\.spec):\s*//) {
159 winebuild_output($1, $_);
160 } elsif($tool eq "wmc" && s/^(.+?\.mc):\s*//) {
162 } elsif($tool eq "wrc" && s/^(.+?\.rc):\s*//) {
164 } elsif($tool eq "cd" && s/^\/bin\/sh:\s*cd:\s*//) {
177 ########################################################################
179 ########################################################################
190 } elsif(/^\*\*\* \[(.*?)\] Error (\d+)$/) {
192 } elsif(/^\*\*\* Error code (\d+)$/) {
194 } elsif(/^\*\*\* Warning:\s+/) { #
195 if(/^File \`(.+?)\' has modification time in the future \((.+?) > \(.+?\)\)$/) {
198 error("make_output");
200 } elsif(/^\`(.*?)\' is up to date.$/) {
202 } elsif(/^\[(.*?)\] Error (\d+) \(ignored\)$/) {
204 } elsif(/^don\'t know how to make (.*?)\. Stop$/) {
206 } elsif(/^(Entering|Leaving) directory \`(.*?)\'$/) {
207 if($1 eq "Entering") {
214 foreach my $component (split(/\//, $directory)) {
215 if($component eq "wine") {
218 push @components, $component;
221 $directory = join("/", @components);
222 } elsif(/^(.*?) is older than (.*?), please rerun (.*?)\$/) {
224 } elsif(/^Nothing to be done for \`(.*?)\'\.$/) {
226 } elsif(s/^warning:\s+//) {
227 if(/^Clock skew detected. Your build may be incomplete.$/) {
230 error("make_output");
232 } elsif(/^Stop in (.*?)\.$/) {
237 error("make_output");
242 ########################################################################
244 ########################################################################
251 my $read_files = ["<???>"];
252 my $write_files = ["<???>"];
253 my $remove_files = [];
257 if(s/^\[\s+-d\s+(.*?)\s+\]\s+\|\|\s+//) {
263 ($read_files, $write_files) = ar_command($_);
264 } elsif(s/^as\s+//) {
266 ($read_files, $write_files) = as_command($_);
267 } elsif(s/^bison\s+//) {
269 ($read_files, $write_files) = bison_command($_);
270 } elsif(s/^cd\s+//) {
272 ($read_files, $write_files) = cd_command($_);
273 } elsif(s/^flex\s+//) {
275 ($read_files, $write_files) = flex_command($_);
276 } elsif(s/^for\s+//) {
278 ($read_files, $write_files) = for_command($_);
279 } elsif(s/^\/usr\/bin\/install\s+//) {
281 ($read_files, $write_files) = install_command($_);
282 } elsif(s/^ld\s+//) {
284 ($read_files, $write_files) = ld_command($_);
285 } elsif(s/^\/sbin\/ldconfig\s+//) {
287 ($read_files, $write_files) = ldconfig_command();
288 } elsif(s/^gcc\s+//) {
290 ($read_files, $write_files) = gcc_command($_);
291 } elsif(s/^(?:(?:\.\.\/)+|\.\/)tools\/makedep\s+//) {
293 ($read_files, $write_files) = makedep_command($_);
294 } elsif(s/^mkdir\s+//) {
296 ($read_files, $write_files) = mkdir_command($_);
297 } elsif(s/^ranlib\s+//) {
299 ($read_files, $write_files) = ranlib_command($_);
300 } elsif(s/^rm\s+//) {
302 ($read_files, $write_files, $remove_files) = rm_command($_);
303 } elsif(s/^sed\s+//) {
305 ($read_files, $write_files) = sed_command($_);
306 } elsif(s/^strip\s+//) {
308 ($read_files, $write_files) = strip_command($_);
309 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/winebuild\/winebuild\s+//) {
311 ($read_files, $write_files) = winebuild_command($_);
312 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wmc\/wmc\s+//) {
314 ($read_files, $write_files) = wmc_command($_);
315 } elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wrc\/wrc\s+//) {
317 ($read_files, $write_files) = wrc_command($_);
320 return ($tool, $read_files, $write_files, $remove_files);
323 ########################################################################
325 ########################################################################
333 if(/rc\s+(\S+)(\s+\S+)+$/) {
336 $read_files =~ s/^\s*//;
337 $read_files = [split(/\s+/, $read_files)];
342 return ($read_files, $write_files);
345 ########################################################################
347 ########################################################################
355 if(/-o\s+(\S+)\s+(\S+)$/) {
362 return ($read_files, $write_files);
365 ########################################################################
367 ########################################################################
375 ########################################################################
377 ########################################################################
385 ########################################################################
387 ########################################################################
392 if(/^(.*?): No such file or directory/) {
393 $message = "directory '$1' doesn't exist";
397 ########################################################################
399 ########################################################################
407 ########################################################################
409 ########################################################################
417 ########################################################################
419 ########################################################################
425 if(/-o\s+(\S+)\s+(\S+)$/) {
429 $write_file =~ s%^\./%%;
430 $read_file =~ s%^\./%%;
432 $write_files = [$write_file];
433 $read_files = [$read_file];
434 } elsif(/-o\s+(\S+)/) {
437 $write_file =~ s%^\./%%;
439 $write_files = [$write_file];
440 $read_files = ["<???>"];
441 } elsif(/^-shared.*?-o\s+(\S+)/) {
444 $write_file =~ s%^\./%%;
446 $write_files = [$write_file];
447 $read_files = ["<???>"];
449 error("gcc_command");
452 return ($read_files, $write_files);
455 ########################################################################
457 ########################################################################
465 if(s/^warning:\s+//) {
470 } elsif(/^((?:signed |unsigned )?(?:int|long)) format, (different type|\S+) arg \(arg (\d+)\)$/) {
473 HACCEL|HACMDRIVER|HANDLE|HBITMAP|HBRUSH|HCALL|HCURSOR|HDC|HDRVR|HDESK|HDRAWDIB
474 HGDIOBJ|HKL|HGLOBAL|HIMC|HINSTANCE|HKEY|HLOCAL|
475 HMENU|HMIDISTRM|HMIDIIN|HMIDIOUT|HMIXER|HMIXEROBJ|HMMIO|HMODULE|
476 HLINE|HPEN|HPHONE|HPHONEAPP|
477 HRASCONN|HRGN|HRSRC|HWAVEIN|HWAVEOUT|HWINSTA|HWND|
478 SC_HANDLE|WSAEVENT|handle_t|pointer)$/x)
484 } elsif(/^\(near initialization for \`(.*?)\'\)$/) {
486 } elsif(/^\`(.*?)\' defined but not used$/) {
488 } elsif(/^\`(.*?)\' is not at beginning of declaration$/) {
490 } elsif(/^\`%x\' yields only last 2 digits of year in some locales$/) {
492 } elsif(/^assignment makes integer from pointer without a cast$/) {
494 } elsif(/^assignment makes pointer from integer without a cast$/) {
496 } elsif(/^assignment from incompatible pointer type$/) {
498 } elsif(/^cast from pointer to integer of different size$/) {
500 } elsif(/^comparison between pointer and integer$/) {
502 } elsif(/^comparison between signed and unsigned$/) {
504 } elsif(/^comparison of unsigned expression < 0 is always false$/) {
506 } elsif(/^comparison of unsigned expression >= 0 is always true$/) {
508 } elsif(/^conflicting types for built-in function \`(.*?)\'$/) {
510 } elsif(/^empty body in an if-statement$/) {
512 } elsif(/^empty body in an else-statement$/) {
514 } elsif(/^implicit declaration of function \`(.*?)\'$/) {
516 } elsif(/^initialization from incompatible pointer type$/) {
518 } elsif(/^initialization makes pointer from integer without a cast$/) {
520 } elsif(/^missing initializer$/) {
522 } elsif(/^ordered comparison of pointer with integer zero$/) {
524 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') from incompatible pointer type$/) {
527 if(defined($name) && $name =~ /^GDI_AllocObject$/) {
532 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes integer from pointer without a cast$/) {
534 } elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes pointer from integer without a cast$/) {
536 } elsif(/^return makes integer from pointer without a cast$/) {
538 } elsif(/^return makes pointer from integer without a cast$/) {
540 } elsif(/^type of \`(.*?)\' defaults to \`(.*?)\'$/) {
542 } elsif(/^unused variable \`(.*?)\'$/) {
544 } elsif(!$options->pedantic) {
552 $message = "function $function: warning: $_";
554 $message = "warning: $_";
559 } elsif(/^\`(.*?)\' undeclared \(first use in this function\)$/) {
561 } elsif(/^\(Each undeclared identifier is reported only once$/) {
563 } elsif(/^conflicting types for \`(.*?)\'$/) {
565 } elsif(/^for each function it appears in.\)$/) {
567 } elsif(/^too many arguments to function$/) {
569 } elsif(/^previous declaration of \`(.*?)\'$/) {
571 } elsif(/^parse error before `(.*?)'$/) {
573 } elsif(!$options->pedantic) {
578 } elsif(/^In function \`(.*?)\':$/) {
580 } elsif(/^At top level:$/) {
587 ########################################################################
589 ########################################################################
591 sub install_command {
597 ########################################################################
599 ########################################################################
607 if(/-r\s+(.*?)\s+-o\s+(\S+)$/) {
609 $read_files = [split(/\s+/, $1)];
614 return ($read_files, $write_files);
617 ########################################################################
619 ########################################################################
627 } elsif(/^In function \`(.*?)\':$/) {
629 } elsif(/^more undefined references to \`(.*?)\' follow$/) {
631 } elsif(/^the use of \`(.+?)\' is dangerous, better use \`(.+?)\'$/) {
633 } elsif(/^undefined reference to \`(.*?)\'$/) {
635 } elsif(/^warning: (.*?)\(\) possibly used unsafely; consider using (.*?)\(\)$/) {
637 } elsif(/^warning: type and size of dynamic symbol \`(.*?)\' are not defined$/) {
644 ########################################################################
646 ########################################################################
648 sub ldconfig_command {
654 ########################################################################
656 ########################################################################
658 sub makedep_command {
664 ########################################################################
666 ########################################################################
674 ########################################################################
676 ########################################################################
684 $read_files = [split(/\s+/)];
687 return ($read_files, $write_files);
690 ########################################################################
692 ########################################################################
697 return ([], [], [split(/\s+/, $_)]);
700 ########################################################################
702 ########################################################################
710 ########################################################################
712 ########################################################################
720 ########################################################################
722 ########################################################################
724 sub winebuild_command {
730 ########################################################################
732 ########################################################################
734 sub winebuild_output {
741 ########################################################################
743 ########################################################################
754 my $rc_file = $mc_file;
755 $rc_file =~ s/\.mc$/.rc/;
757 $write_files = [$rc_file];
758 $read_files = [$mc_file];
760 error("wmc_command");
763 return ($read_files, $write_files);
766 ########################################################################
768 ########################################################################
775 ########################################################################
777 ########################################################################
788 my $o_file = $rc_file;
789 $o_file =~ s/\.rc$/.o/;
791 $write_files = [$o_file];
792 $read_files = [$rc_file];
794 error("wrc_command");
797 return ($read_files, $write_files);
800 ########################################################################
802 ########################################################################