2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
# Copyright 1999, 2000, 2001 Patrik Stridvall
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
package make_parser;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2005-05-04 12:43:00 +02:00
|
|
|
use setup qw($current_dir $wine_dir $winapi_dir);
|
2001-07-29 22:19:14 +02:00
|
|
|
|
|
|
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
|
|
|
|
require Exporter;
|
|
|
|
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
@EXPORT = qw();
|
|
|
|
@EXPORT_OK = qw($directory $tool $file $line $message);
|
|
|
|
|
|
|
|
use vars qw($directory $tool $file $line $message);
|
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
use output qw($output);
|
2001-07-29 22:19:14 +02:00
|
|
|
use options qw($options);
|
2001-07-26 23:42:12 +02:00
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
|
|
|
|
#sub command($);
|
|
|
|
#sub gcc_output($$);
|
|
|
|
#sub ld_output($$);
|
|
|
|
#sub make_output($$);
|
|
|
|
#sub winebuild_output($$);
|
|
|
|
#sub wmc_output($$);
|
|
|
|
#sub wrc_output($$);
|
|
|
|
|
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
########################################################################
|
|
|
|
# global
|
|
|
|
########################################################################
|
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
my $current;
|
2001-07-26 23:42:12 +02:00
|
|
|
my $function;
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# error
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub error($) {
|
2001-07-30 20:49:10 +02:00
|
|
|
my $where = shift;
|
|
|
|
|
|
|
|
if(!defined($where)) {
|
|
|
|
$where = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $context;
|
|
|
|
if($tool) {
|
|
|
|
$context = "$tool";
|
|
|
|
if($where) {
|
|
|
|
$context .= "<$where>";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if($where) {
|
|
|
|
$context = "<$where>";
|
|
|
|
} else {
|
|
|
|
$context = "<>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-29 22:19:14 +02:00
|
|
|
if(defined($tool)) {
|
2001-08-22 20:09:15 +02:00
|
|
|
$output->write("$directory: $context: can't parse output: '$current'\n");
|
2001-07-29 22:19:14 +02:00
|
|
|
} else {
|
2001-08-22 20:09:15 +02:00
|
|
|
$output->write("$directory: $context: can't parse output: '$current'\n");
|
2001-07-29 22:19:14 +02:00
|
|
|
}
|
2001-07-26 23:42:12 +02:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# make_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub make_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
my $level = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
$file = "";
|
|
|
|
$message = "";
|
|
|
|
|
2007-02-20 15:49:17 +01:00
|
|
|
if(/^\*\*\* \[(.*?)\] Error (\d+)$/) {
|
2001-09-11 01:16:05 +02:00
|
|
|
# Nothing
|
|
|
|
} elsif(/^\*\*\* Error code (\d+)$/) {
|
|
|
|
# Nothing
|
2002-06-01 04:55:48 +02:00
|
|
|
} elsif(/^\*\*\* Warning:\s+/) { #
|
2001-07-26 23:42:12 +02:00
|
|
|
if(/^File \`(.+?)\' has modification time in the future \((.+?) > \(.+?\)\)$/) {
|
|
|
|
# Nothing
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("make_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
} elsif(/^\`(.*?)\' is up to date.$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^\[(.*?)\] Error (\d+) \(ignored\)$/) {
|
|
|
|
# Nothing
|
2001-09-11 01:16:05 +02:00
|
|
|
} elsif(/^don\'t know how to make (.*?)\. Stop$/) {
|
|
|
|
$message = "$_";
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^(Entering|Leaving) directory \`(.*?)\'$/) {
|
|
|
|
if($1 eq "Entering") {
|
|
|
|
$directory = $2;
|
|
|
|
} else {
|
|
|
|
$directory = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
my @components;
|
|
|
|
foreach my $component (split(/\//, $directory)) {
|
|
|
|
if($component eq "wine") {
|
|
|
|
@components = ();
|
|
|
|
} else {
|
|
|
|
push @components, $component;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$directory = join("/", @components);
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^(.*?) is older than (.*?), please rerun (.*?)\$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^Nothing to be done for \`(.*?)\'\.$/) {
|
2001-07-26 23:42:12 +02:00
|
|
|
# Nothing
|
|
|
|
} elsif(s/^warning:\s+//) {
|
|
|
|
if(/^Clock skew detected. Your build may be incomplete.$/) {
|
|
|
|
# Nothing
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("make_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
2001-09-11 01:16:05 +02:00
|
|
|
} elsif(/^Stop in (.*?)\.$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^\s*$/) {
|
|
|
|
# Nothing
|
2001-07-26 23:42:12 +02:00
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("make_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ar_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub ar_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/rc\s+(\S+)(\s+\S+)+$/) {
|
|
|
|
$write_files = [$1];
|
|
|
|
$read_files = $2;
|
|
|
|
$read_files =~ s/^\s*//;
|
|
|
|
$read_files = [split(/\s+/, $read_files)];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("ar_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# as_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub as_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/-o\s+(\S+)\s+(\S+)$/) {
|
|
|
|
$write_files = [$1];
|
|
|
|
$read_files = [$2];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("as_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# bision_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub bison_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# cd_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub cd_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# cd_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub cd_output($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
if(/^(.*?): No such file or directory/) {
|
|
|
|
$message = "directory '$1' doesn't exist";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# flex_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub flex_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# for_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub for_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# gcc_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub gcc_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/-o\s+(\S+)\s+(\S+)$/) {
|
2001-09-11 01:16:05 +02:00
|
|
|
my $write_file = $1;
|
|
|
|
my $read_file = $2;
|
|
|
|
|
|
|
|
$write_file =~ s%^\./%%;
|
|
|
|
$read_file =~ s%^\./%%;
|
|
|
|
|
|
|
|
$write_files = [$write_file];
|
|
|
|
$read_files = [$read_file];
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/-o\s+(\S+)/) {
|
2001-09-11 01:16:05 +02:00
|
|
|
my $write_file = $1;
|
|
|
|
|
|
|
|
$write_file =~ s%^\./%%;
|
|
|
|
|
|
|
|
$write_files = [$write_file];
|
2001-07-26 23:42:12 +02:00
|
|
|
$read_files = ["<???>"];
|
|
|
|
} elsif(/^-shared.*?-o\s+(\S+)/) {
|
2001-09-11 01:16:05 +02:00
|
|
|
my $write_file = $1;
|
|
|
|
|
|
|
|
$write_file =~ s%^\./%%;
|
|
|
|
|
|
|
|
$write_files = [$write_file];
|
2001-07-26 23:42:12 +02:00
|
|
|
$read_files = ["<???>"];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("gcc_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# gcc_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub gcc_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$file = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
if(s/^(\d+):\s+//) {
|
|
|
|
$line = $1;
|
|
|
|
if(s/^warning:\s+//) {
|
2005-01-26 22:09:04 +01:00
|
|
|
my $suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
|
2007-02-20 15:49:17 +01:00
|
|
|
if(/^((?:signed |unsigned )?(?:int|long)) format, (different type|\S+) arg \(arg (\d+)\)$/) {
|
2001-07-30 20:49:10 +02:00
|
|
|
my $type = $2;
|
2001-08-22 20:09:15 +02:00
|
|
|
if($type =~ /^(?:
|
|
|
|
HACCEL|HACMDRIVER|HANDLE|HBITMAP|HBRUSH|HCALL|HCURSOR|HDC|HDRVR|HDESK|HDRAWDIB
|
|
|
|
HGDIOBJ|HKL|HGLOBAL|HIMC|HINSTANCE|HKEY|HLOCAL|
|
2001-07-30 20:49:10 +02:00
|
|
|
HMENU|HMIDISTRM|HMIDIIN|HMIDIOUT|HMIXER|HMIXEROBJ|HMMIO|HMODULE|
|
2001-08-22 20:09:15 +02:00
|
|
|
HLINE|HPEN|HPHONE|HPHONEAPP|
|
|
|
|
HRASCONN|HRGN|HRSRC|HWAVEIN|HWAVEOUT|HWINSTA|HWND|
|
2002-06-01 04:55:48 +02:00
|
|
|
SC_HANDLE|WSAEVENT|handle_t|pointer)$/x)
|
2001-07-30 20:49:10 +02:00
|
|
|
{
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 1;
|
2001-07-30 20:49:10 +02:00
|
|
|
} else {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-30 20:49:10 +02:00
|
|
|
}
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^\(near initialization for \`(.*?)\'\)$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^\`(.*?)\' defined but not used$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^\`(.*?)\' is not at beginning of declaration$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^\`%x\' yields only last 2 digits of year in some locales$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 1;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^assignment makes integer from pointer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^assignment makes pointer from integer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^assignment from incompatible pointer type$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^cast from pointer to integer of different size$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^comparison between pointer and integer$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^comparison between signed and unsigned$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^comparison of unsigned expression < 0 is always false$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^comparison of unsigned expression >= 0 is always true$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^conflicting types for built-in function \`(.*?)\'$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^empty body in an if-statement$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^empty body in an else-statement$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^implicit declaration of function \`(.*?)\'$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^initialization from incompatible pointer type$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^initialization makes pointer from integer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^missing initializer$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^ordered comparison of pointer with integer zero$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') from incompatible pointer type$/) {
|
2009-12-29 01:16:26 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes integer from pointer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^passing arg (\d+) of (?:pointer to function|\`(\S+)\') makes pointer from integer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^return makes integer from pointer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^return makes pointer from integer without a cast$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^type of \`(.*?)\' defaults to \`(.*?)\'$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^unused variable \`(.*?)\'$/) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(!$options->pedantic) {
|
2005-01-26 22:09:04 +01:00
|
|
|
$suppress = 0;
|
2001-07-26 23:42:12 +02:00
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("gcc_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
2005-01-26 22:09:04 +01:00
|
|
|
if(!$suppress) {
|
2001-07-26 23:42:12 +02:00
|
|
|
if($function) {
|
2001-07-30 20:49:10 +02:00
|
|
|
$message = "function $function: warning: $_";
|
2001-07-26 23:42:12 +02:00
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
$message = "warning: $_";
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$message = "";
|
|
|
|
}
|
|
|
|
} elsif(/^\`(.*?)\' undeclared \(first use in this function\)$/) {
|
|
|
|
$message = "$_";
|
|
|
|
} elsif(/^\(Each undeclared identifier is reported only once$/) {
|
|
|
|
$message = "$_";
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^conflicting types for \`(.*?)\'$/) {
|
|
|
|
$message = "$_";
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^for each function it appears in.\)$/) {
|
|
|
|
$message = "$_";
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(/^too many arguments to function$/) {
|
|
|
|
$message = "$_";
|
|
|
|
} elsif(/^previous declaration of \`(.*?)\'$/) {
|
|
|
|
$message = "$_";
|
2001-07-26 23:42:12 +02:00
|
|
|
} elsif(/^parse error before `(.*?)'$/) {
|
|
|
|
$message = "$_";
|
2001-07-29 22:19:14 +02:00
|
|
|
} elsif(!$options->pedantic) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$message = "$_";
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("gcc_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
} elsif(/^In function \`(.*?)\':$/) {
|
|
|
|
$function = $1;
|
|
|
|
} elsif(/^At top level:$/) {
|
|
|
|
$function = "";
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("gcc_output");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# install_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub install_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ld_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub ld_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/-r\s+(.*?)\s+-o\s+(\S+)$/) {
|
|
|
|
$write_files = [$2];
|
|
|
|
$read_files = [split(/\s+/, $1)];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("ld_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ld_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub ld_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$file = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
|
2007-02-20 15:49:17 +01:00
|
|
|
if(/^In function \`(.*?)\':$/) {
|
2001-08-22 20:09:15 +02:00
|
|
|
$function = $1;
|
2001-09-11 01:16:05 +02:00
|
|
|
} elsif(/^more undefined references to \`(.*?)\' follow$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^the use of \`(.+?)\' is dangerous, better use \`(.+?)\'$/) {
|
2001-08-22 20:09:15 +02:00
|
|
|
# Nothing
|
2001-09-11 01:16:05 +02:00
|
|
|
} elsif(/^undefined reference to \`(.*?)\'$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^warning: (.*?)\(\) possibly used unsafely; consider using (.*?)\(\)$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^warning: type and size of dynamic symbol \`(.*?)\' are not defined$/) {
|
|
|
|
$message = "$_";
|
2001-08-22 20:09:15 +02:00
|
|
|
} else {
|
|
|
|
$message = "$_";
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ldconfig_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub ldconfig_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# makedep_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub makedep_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# mkdir_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub mkdir_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# ranlib_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub ranlib_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
$read_files = [split(/\s+/)];
|
|
|
|
$write_files = [];
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# rm_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub rm_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
s/^-f\s*//;
|
|
|
|
return ([], [], [split(/\s+/, $_)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# sed_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub sed_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# strip_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub strip_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# winebuild_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub winebuild_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
return ([], []);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# winebuild_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub winebuild_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$file = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
$message = $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# wmc_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub wmc_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/\s+(\S+)$/) {
|
|
|
|
my $mc_file = $1;
|
|
|
|
|
|
|
|
my $rc_file = $mc_file;
|
|
|
|
$rc_file =~ s/\.mc$/.rc/;
|
|
|
|
|
|
|
|
$write_files = [$rc_file];
|
|
|
|
$read_files = [$mc_file];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("wmc_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# wmc_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub wmc_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$file = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# wrc_command
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub wrc_command($) {
|
2001-07-26 23:42:12 +02:00
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $read_files;
|
|
|
|
my $write_files;
|
|
|
|
|
|
|
|
if(/\s+(\S+)$/) {
|
|
|
|
my $rc_file = $1;
|
|
|
|
|
|
|
|
my $o_file = $rc_file;
|
|
|
|
$o_file =~ s/\.rc$/.o/;
|
|
|
|
|
|
|
|
$write_files = [$o_file];
|
|
|
|
$read_files = [$rc_file];
|
|
|
|
} else {
|
2001-07-30 20:49:10 +02:00
|
|
|
error("wrc_command");
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ($read_files, $write_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# wrc_output
|
|
|
|
########################################################################
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub wrc_output($$) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$file = shift;
|
|
|
|
local $_ = shift;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
########################################################################
|
|
|
|
# command
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
sub command($) {
|
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
my $tool;
|
|
|
|
my $file;
|
|
|
|
my $read_files = ["<???>"];
|
|
|
|
my $write_files = ["<???>"];
|
|
|
|
my $remove_files = [];
|
|
|
|
|
|
|
|
s/^\s*(.*?)\s*$/$1/;
|
|
|
|
|
|
|
|
if(s/^\[\s+-d\s+(.*?)\s+\]\s+\|\|\s+//) {
|
|
|
|
# Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
if(s/^ar\s+//) {
|
|
|
|
$tool = "ar";
|
|
|
|
($read_files, $write_files) = ar_command($_);
|
|
|
|
} elsif(s/^as\s+//) {
|
|
|
|
$tool = "as";
|
|
|
|
($read_files, $write_files) = as_command($_);
|
|
|
|
} elsif(s/^bison\s+//) {
|
|
|
|
$tool = "bison";
|
|
|
|
($read_files, $write_files) = bison_command($_);
|
|
|
|
} elsif(s/^cd\s+//) {
|
|
|
|
$tool = "cd";
|
|
|
|
($read_files, $write_files) = cd_command($_);
|
|
|
|
} elsif(s/^flex\s+//) {
|
|
|
|
$tool = "flex";
|
|
|
|
($read_files, $write_files) = flex_command($_);
|
|
|
|
} elsif(s/^for\s+//) {
|
|
|
|
$tool = "for";
|
|
|
|
($read_files, $write_files) = for_command($_);
|
|
|
|
} elsif(s/^\/usr\/bin\/install\s+//) {
|
|
|
|
$tool = "install";
|
|
|
|
($read_files, $write_files) = install_command($_);
|
|
|
|
} elsif(s/^ld\s+//) {
|
|
|
|
$tool = "ld";
|
|
|
|
($read_files, $write_files) = ld_command($_);
|
|
|
|
} elsif(s/^\/sbin\/ldconfig\s+//) {
|
|
|
|
$tool = "ldconfig";
|
|
|
|
($read_files, $write_files) = ldconfig_command();
|
|
|
|
} elsif(s/^gcc\s+//) {
|
|
|
|
$tool = "gcc";
|
|
|
|
($read_files, $write_files) = gcc_command($_);
|
|
|
|
} elsif(s/^(?:(?:\.\.\/)+|\.\/)tools\/makedep\s+//) {
|
|
|
|
$tool = "makedep";
|
|
|
|
($read_files, $write_files) = makedep_command($_);
|
|
|
|
} elsif(s/^mkdir\s+//) {
|
|
|
|
$tool = "mkdir";
|
|
|
|
($read_files, $write_files) = mkdir_command($_);
|
|
|
|
} elsif(s/^ranlib\s+//) {
|
|
|
|
$tool = "ranlib";
|
|
|
|
($read_files, $write_files) = ranlib_command($_);
|
|
|
|
} elsif(s/^rm\s+//) {
|
|
|
|
$tool = "rm";
|
|
|
|
($read_files, $write_files, $remove_files) = rm_command($_);
|
|
|
|
} elsif(s/^sed\s+//) {
|
|
|
|
$tool = "sed";
|
|
|
|
($read_files, $write_files) = sed_command($_);
|
|
|
|
} elsif(s/^strip\s+//) {
|
|
|
|
$tool = "sed";
|
|
|
|
($read_files, $write_files) = strip_command($_);
|
|
|
|
} elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/winebuild\/winebuild\s+//) {
|
|
|
|
$tool = "winebuild";
|
|
|
|
($read_files, $write_files) = winebuild_command($_);
|
|
|
|
} elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wmc\/wmc\s+//) {
|
|
|
|
$tool = "wmc";
|
|
|
|
($read_files, $write_files) = wmc_command($_);
|
|
|
|
} elsif(s/^LD_LIBRARY_PATH="(?:(?:\.\.\/)*unicode)?:\$LD_LIBRARY_PATH"\s+(?:\.\.\/)*tools\/wrc\/wrc\s+//) {
|
|
|
|
$tool = "wrc";
|
|
|
|
($read_files, $write_files) = wrc_command($_);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ($tool, $read_files, $write_files, $remove_files);
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# line
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
sub line($) {
|
|
|
|
local $_ = shift;
|
|
|
|
|
|
|
|
$file = "";
|
|
|
|
$line = "";
|
|
|
|
$message = "";
|
|
|
|
|
|
|
|
$current = $_;
|
|
|
|
|
|
|
|
my ($new_tool, $read_files, $write_files, $remove_files) = command($_);
|
|
|
|
if(defined($new_tool)) {
|
|
|
|
$tool = $new_tool;
|
|
|
|
|
|
|
|
$function = "";
|
|
|
|
|
|
|
|
my $progress = "";
|
|
|
|
if($directory && $directory ne ".") {
|
|
|
|
$progress .= "$directory: ";
|
|
|
|
}
|
|
|
|
if($tool) {
|
|
|
|
$progress .= "$tool: ";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($tool =~ /^(?:cd|make)$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif($tool eq "ld"/) {
|
|
|
|
foreach my $file (@{$read_files}) {
|
|
|
|
$output->lazy_progress("${progress}reading '$file'");
|
|
|
|
}
|
|
|
|
my $file = $$write_files[0];
|
|
|
|
$output->progress("$progress: writing '$file'");
|
|
|
|
} elsif($tool eq "rm") {
|
|
|
|
foreach my $file (@{$remove_files}) {
|
|
|
|
$output->lazy_progress("${progress}removing '$file'");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if($#$read_files >= 0) {
|
|
|
|
$progress .= "read[" . join(" ", @{$read_files}) . "]";
|
|
|
|
}
|
|
|
|
if($#$write_files >= 0) {
|
|
|
|
if($#$read_files >= 0) {
|
|
|
|
$progress .= ", ";
|
|
|
|
}
|
|
|
|
$progress .= "write[" . join(" ", @{$write_files}) . "]";
|
|
|
|
}
|
|
|
|
if($#$remove_files >= 0) {
|
|
|
|
if($#$read_files >= 0 || $#$write_files >= 0) {
|
|
|
|
$progress .= ", ";
|
|
|
|
}
|
|
|
|
$progress .= "remove[" . join(" ", @{$remove_files}) . "]";
|
|
|
|
}
|
|
|
|
|
|
|
|
$output->progress($progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $make = $options->make;
|
|
|
|
|
|
|
|
if(/^Wine build complete\.$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(/^(.*?) is newer than (.*?), please rerun (.*?)\!$/) {
|
|
|
|
$message = "$_";
|
|
|
|
} elsif(/^(.*?) is older than (.*?), please rerun (.*?)$/) {
|
|
|
|
$message = "$_";
|
|
|
|
} elsif(/^\`(.*?)\' is up to date.$/) {
|
|
|
|
$tool = "make";
|
|
|
|
make_output($1, $_);
|
|
|
|
} elsif(s/^$make(?:\[(\d+)\])?:\s*//) {
|
|
|
|
$tool = "make";
|
|
|
|
make_output($1, $_);
|
|
|
|
} elsif(!defined($tool)) {
|
|
|
|
error("line");
|
|
|
|
} elsif($tool eq "make") {
|
|
|
|
make_output($1, $_);
|
|
|
|
} elsif($tool eq "bison" && /^conflicts:\s+\d+\s+shift\/reduce$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif($tool eq "gcc" && /^(?:In file included |\s*)from (.+?):(\d+)[,:]$/) {
|
|
|
|
# Nothing
|
|
|
|
} elsif($tool =~ /^(?:gcc|ld)$/ && s/^(.+?\.s?o)(?:\(.*?\))?:\s*//) {
|
|
|
|
$tool = "ld";
|
|
|
|
ld_output($1, $_)
|
|
|
|
} elsif($tool =~ /^(?:gcc|ld)$/ && s/^(.*?)ld:\s*//) {
|
|
|
|
$tool = "ld";
|
|
|
|
ld_output("", $_)
|
|
|
|
} elsif($tool =~ /^(?:gcc|ld)$/ && s/^collect2:\s*//) {
|
|
|
|
$tool = "ld";
|
|
|
|
ld_output("collect2", $_);
|
|
|
|
} elsif($tool eq "gcc" && s/^(.+?\.[chly]):\s*//) {
|
|
|
|
gcc_output($1, $_);
|
|
|
|
} elsif($tool eq "ld" && s/^(.+?\.c):(?:\d+:)?\s*//) {
|
|
|
|
ld_output($1, $_);
|
|
|
|
} elsif($tool eq "winebuild" && s/^(.+?\.spec):\s*//) {
|
|
|
|
winebuild_output($1, $_);
|
|
|
|
} elsif($tool eq "wmc" && s/^(.+?\.mc):\s*//) {
|
|
|
|
wmc_output($1, $_);
|
|
|
|
} elsif($tool eq "wrc" && s/^(.+?\.rc):\s*//) {
|
|
|
|
wrc_output($1, $_);
|
|
|
|
} elsif($tool eq "cd" && s/^\/bin\/sh:\s*cd:\s*//) {
|
|
|
|
parse_cd_output($_);
|
|
|
|
} elsif(/^\s*$/) {
|
|
|
|
# Nothing
|
|
|
|
} else {
|
|
|
|
error("line");
|
|
|
|
}
|
|
|
|
|
|
|
|
$file =~ s/^\.\///;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
1;
|