Perl's ExtUtils::MakeMaker fails and proposed fix

Marco Moreno
Thu Jul 7 18:46:00 GMT 2011


After doing a little debugging, I discovered why installing ExtUtils::MakeMaker
was failing for me. contains:

=item maybe_command

If our path begins with F</cygdrive/> then we use C<ExtUtils::MM_Win32>
to determine if it may be a command.  Otherwise we use the tests
from C<ExtUtils::MM_Unix>.


sub maybe_command {
    my ($self, $file) = @_;

    if ($file =~ m{^/cygdrive/}i) {
        return ExtUtils::MM_Win32->maybe_command($file);

    return $self->SUPER::maybe_command($file);

Obviously, if your cygdrive prefix is something else (e.g. '/'), then
this will fail.

What do you think of this instead:

=item maybe_command

Determine whether a file is native to Cygwin by checking whether it
resides inside the Cygwin installation (using Windows paths).  If so,
use C<ExtUtils::MM_Unix> to determine if it may be a command.
Otherwise use the tests from C<ExtUtils::MM_Win32>.


sub maybe_command {
    my ($self, $file) = @_;

    my $cygwin_winpath = Cygwin::posix_to_win_path('/', 1);
    my $file_winpath = Cygwin::posix_to_win_path($file, 1);

    return ($file_winpath =~ /^${cygwin_winpath}/)
        ? $self->SUPER::maybe_command($file)
        : ExtUtils::MM_Win32->maybe_command($file);

This passed all the tests and installed ok for me.  Does this look
ok to you and is it reasonable to assume that native Cygwin
commands will always be inside the Cygwin installation directory?
If this proposed change is worthy of implementing, what is the best
way to do it?

Marco Moreno

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list