On 02/02/06 11:52 -0800, Eric Wilhelm wrote:
> Hi all,
> 
> Finally got this guess worked into a patch and test (attached.)
> 
> Patrick:  does Inline::Java call fix_make() from Inline::C or do any 
> similar munging of the makefile?  If so, you would need to apply some 
> similar fixes.  The original entry point of the bug is in Inline.pm and 
> therefore applies to all inline-derived modules.  The test I wrote is 
> just for Inline::C.  Maybe Ingy can say how to write a 
> language-agnostic test.
> 
> Ingy:  do you have a repository for Inline.pm?  May I see it? :-)

Eric, the repos is here, but I'm not sure of its current state. Best to just
work with Inline-0.44.

    http://svn.kwiki.org/ingy/Inline/

Patrick, if this patch looks good to you, I'll apply and release it.

Cheers, Ingy

> 
> --Eric
> -- 
> Like a lot of people, I was mathematically abused as a child.
> --Paul Graham
> ---------------------------------------------------
>     http://scratchcomputing.com
> ---------------------------------------------------

> === C.pm
> ==================================================================
> --- C.pm  (revision 6)
> +++ C.pm  (revision 8)
> @@ -800,7 +800,11 @@
>       if (/^(\w+)\s*=\s*\S+.*$/ and
>           $fix = $fixes{$1}
>          ) {
> -         print MAKEFILE "$1 = $o->{ILSM}{$fix}\n"
> +              my $target = $1;
> +              my $f = $o->{ILSM}{$fix};
> +              ($fix =~ m/^install_/) and ($f = "'$f'");
> +              print MAKEFILE "$target = $f\n"
> +
>       }
>       else {
>           print MAKEFILE;
> === Inline.pm
> ==================================================================
> --- Inline.pm  (revision 6)
> +++ Inline.pm  (revision 8)
> @@ -740,13 +740,13 @@
>          my($v,$d,$f) = File::Spec->splitpath($inline);
>          $f = "" if $f eq 'Inline.pm';
>          $inline = File::Spec->catpath($v,$d,$f);
> -        my $INC = "-I$inline -I" . 
> -                  join(" -I", grep {(-d File::Spec->catdir($_,"Inline") or 
> +        my @inc = ("-I$inline", "-I" .
> +                  map({"-I$_"} grep {(-d File::Spec->catdir($_,"Inline") or
>                                       -d 
> File::Spec->catdir($_,"auto","Inline")
> -                                 )} @INC);
> -     system "$perl $INC -MInline=_CONFIG_ -e1 $dir"
> -       and croak M20_config_creation_failed($dir);
> -     return;
> +                                    )} @INC));
> +        system($perl, @inc, qw(-MInline=_CONFIG_ -e1), $dir)
> +          and croak M20_config_creation_failed($dir);
> +        return;
>      }
>  
>      my ($lib, $mod, $register, %checked,
> === 06spaces.t
> ==================================================================
> --- 06spaces.t  (revision 6)
> +++ 06spaces.t  (revision 8)
> @@ -0,0 +1,43 @@
> +use File::Spec;
> +use lib (File::Spec->catdir(File::Spec->updir(),'blib','lib'), 
> File::Spec->catdir(File::Spec->curdir(),'blib','lib'));
> +use strict;
> +use Test;
> +use diagnostics;
> +
> +BEGIN {
> +    plan(tests => 2,
> +     todo => [2],
> +     onfail => sub {},
> +    );
> +    my $dir = "_Inline_test";
> +    for(0..1) {
> +        unless(-d $dir) {
> +            mkdir($dir) or die "create $dir failed";
> +        }
> +        $dir .= "/inline dir";
> +    }
> +}
> +
> +# test 1 - make sure directories with spaces work
> +BEGIN {
> +    eval <<'END';
> +    use Inline(C => "void foo(){}",
> +           DIRECTORY => '_Inline_test/inline dir',
> +          );
> +END
> +    ok((not $@));
> +}
> +
> +# XXX maybe some more holes in that directories which don't exist but
> +# contain spaces don't work?
> +BEGIN {
> +    eval <<'END';
> +    use Inline(C => "void foo(){}",
> +           DIRECTORY => '_Inline_test/inline dir/_Inline',
> +          );
> +END
> +    ok(not $@);
> +    # ok((not $@)) or warn $@;
> +}
> +
> +

Reply via email to