Attached patch fixes most tests for me,
remaining is a failure in C/t/07typemap_multi.t:
Can't locate auto/Soldier/new.al
...
Fixes for spaces in current dir (Windows and cygwin mostly)
diff -u ./C/C.pm.orig
--- ./C/C.pm.orig 2011-02-21 08:46:27.000000000 +0100
+++ ./C/C.pm 2011-03-29 14:51:10.502111300 +0200
@@ -43,7 +43,7 @@
$o->{ILSM}{MAKEFILE} ||= {};
if (not $o->UNTAINT) {
require FindBin;
- $o->{ILSM}{MAKEFILE}{INC} = "-I$FindBin::Bin";
+ $o->{ILSM}{MAKEFILE}{INC} = "-I\"$FindBin::Bin\"";
}
$o->{ILSM}{AUTOWRAP} = 0 if not defined $o->{ILSM}{AUTOWRAP};
$o->{ILSM}{XSMODE} = 0 if not defined $o->{ILSM}{XSMODE};
@@ -79,8 +79,11 @@
$o->add_list($o->{ILSM}{MAKEFILE}, $key, $value, []);
next;
}
- if ($key eq 'INC' or
- $key eq 'MYEXTLIB' or
+ if ($key eq 'INC') {
+ $o->add_string($o->{ILSM}{MAKEFILE}, $key, quote_space($value), '');
+ next;
+ }
+ if ($key eq 'MYEXTLIB' or
$key eq 'OPTIMIZE' or
$key eq 'CCFLAGS' or
$key eq 'LDDLFLAGS') {
@@ -91,17 +94,17 @@
unless(ref($value) eq 'ARRAY') {
croak "TYPEMAPS file '$value' not found"
unless -f $value;
- $value = File::Spec->rel2abs($value);
+ $value = fix_space(File::Spec->rel2abs($value));
}
else {
- for (my $i = 0; $i < scalar(@$value); $i++) {
+ for (my $i = 0; $i < scalar(@$value); $i++) {
croak "TYPEMAPS file '${$value}[$i]' not found"
unless -f ${$value}[$i];
- ${$value}[$i] = File::Spec->rel2abs(${$value}[$i]);
+ ${$value}[$i] = fix_space(File::Spec->rel2abs(${$value}[$i]));
}
}
- $o->add_list($o->{ILSM}{MAKEFILE}, $key, $value, []);
- next;
+ $o->add_list($o->{ILSM}{MAKEFILE}, $key, $value, []);
+ next;
}
if ($key eq 'AUTO_INCLUDE') {
$o->add_text($o->{ILSM}, $key, $value, '');
@@ -348,12 +351,14 @@
warn "Can't find the default system typemap file"
if (not $typemap and $^W);
- unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap;
+ unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, quote_space($typemap)) if $typemap;
if (not $o->UNTAINT) {
require FindBin;
$file = File::Spec->catfile($FindBin::Bin,"typemap");
- push(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $file) if -f $file;
+ if ( -f $file ) {
+ push(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, quote_space($file));
+ }
}
}
@@ -847,7 +852,9 @@
if (/^(\w+)\s*=\s*\S+.*$/ and
$fix = $fixes{$1}
) {
- print MAKEFILE "$1 = $o->{ILSM}{$fix}\n"
+ my $fixed = $o->{ILSM}{$fix};
+ $fixed = fix_space($fixed) if $fix eq 'install_lib';
+ print MAKEFILE "$1 = $fixed\n";
}
else {
print MAKEFILE;
@@ -856,6 +863,16 @@
close MAKEFILE;
}
+sub quote_space {
+ $_[0] = '"'.$_[0].'"' if $_[0] and $_[0] =~ /\s/;
+ $_[0];
+}
+
+sub fix_space {
+ $_[0] =~ s/ /\\ /g if $_[0] =~ / /;
+ $_[0];
+}
+
#==============================================================================
# This routine used by C/t/09parser to test that the expected parser is in use
#==============================================================================