--- a
+++ b/perl/pl-CYG07-cygwin_vendorarchautorebase-2.patch
@@ -0,0 +1,129 @@
+difforig perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm
+
+diff -u perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm.orig perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm
+--- perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm.orig	2012-02-07 09:21:23.910375000 -0600
++++ perl-5.14.2/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm	2012-07-11 08:32:59.944125000 -0500
+@@ -9,7 +9,7 @@
+ require ExtUtils::MM_Win32;
+ our @ISA = qw( ExtUtils::MM_Unix );
+ 
+-our $VERSION = '6.57_05';
++our $VERSION = '6.57_07';
+ 
+ 
+ =head1 NAME
+@@ -100,41 +100,99 @@
+ 
+ =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>.
++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>.
+ 
+ =cut
+ 
+ sub maybe_command {
+     my ($self, $file) = @_;
+ 
+-    if ($file =~ m{^/cygdrive/}i) {
+-        return ExtUtils::MM_Win32->maybe_command($file);
+-    }
++    my $cygpath = Cygwin::posix_to_win_path('/', 1);
++    my $filepath = Cygwin::posix_to_win_path($file, 1);
+ 
+-    return $self->SUPER::maybe_command($file);
++    return (substr($filepath,0,length($cygpath)) eq $cygpath)
++        ? $self->SUPER::maybe_command($file) 	     # Unix
++        : ExtUtils::MM_Win32->maybe_command($file); # Win32
+ }
+ 
+ =item dynamic_lib
+ 
+ Use the default to produce the *.dll's.
+-But for new archdir dll's use the same rebase address if the old exists.
++Add the dll size to F<$vendorarch/auto/.rebase>, which stores the
++next available imagebase.
++
++If an old dll exists and .rebase is empty, use the same rebase address
++for new archdir dll's.
+ 
+ =cut
+ 
+ sub dynamic_lib {
+     my($self, %attribs) = @_;
+     my $s = ExtUtils::MM_Unix::dynamic_lib($self, %attribs);
++    return '' unless $s;
++    return $s unless %{$self->{XS}};
++
+     my $ori = "$self->{INSTALLARCHLIB}/auto/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}";
++    my $rebase = "$self->{INSTALLVENDORARCH}/auto/.rebase";
++    my $imagebase = '';
++    my $rebaseverstr = -f '/bin/rebase' ? `/bin/rebase -V 2>&1` : '0';
++    my ($rebasever) = $rebaseverstr =~ /rebase version ([0-9.]+)/;
++    $rebasever =~ s/(\d\.\d+)\./$1/;
++    if (-f $rebase and $rebasever < 3.02) {
++      $imagebase = `/bin/cat $rebase`;
++      chomp $imagebase;
++    }
+     if (-e $ori) {
+-        my $imagebase = `/bin/objdump -p $ori | /bin/grep ImageBase | /bin/cut -c12-`;
+-        chomp $imagebase;
+-        if ($imagebase gt "40000000") {
+-            my $LDDLFLAGS = $self->{LDDLFLAGS};
+-            $LDDLFLAGS =~ s/-Wl,--enable-auto-image-base/-Wl,--image-base=0x$imagebase/;
+-            $s =~ s/ \$\(LDDLFLAGS\) / $LDDLFLAGS /m;
+-        }
++      $imagebase = `/bin/objdump -p $ori | /bin/grep ImageBase | /bin/cut -c12-`;
++      chomp $imagebase;
++      if ($imagebase gt "40000000" and $imagebase lt "80000000") {
++        my $LDDLFLAGS = $self->{LDDLFLAGS};
++        $LDDLFLAGS =~ s/-Wl,--enable-auto-image-base/-Wl,--image-base=0x$imagebase/;
++        $s =~ s/ \$\(LDDLFLAGS\) / $LDDLFLAGS /m;
++      }
++    } elsif ($imagebase gt "40000000" and $imagebase lt "80000000") {
++      my $LDDLFLAGS = $self->{LDDLFLAGS};
++      $LDDLFLAGS =~ s/-Wl,--enable-auto-image-base/-Wl,--image-base=0x$imagebase/ or
++        $LDDLFLAGS .= " -Wl,--image-base=0x$imagebase";
++      $s =~ s/ \$\(INST_DYNAMIC_DEP\)/ \$(INST_DYNAMIC_DEP) _rebase/;
++      $s =~ s/ \$\(LDDLFLAGS\) / $LDDLFLAGS /m;
++      # Here we create all DLL's per project with the same imagebase. With rebase 3.0.2 we do better
++      $s .= "\t/bin/rebase -v -b 0x$imagebase \$@ | ";
++      $s .= "\$(FULLPERL) -n _rebase > \$(INSTALLVENDORARCH)/auto/.rebase\n";
++      # Need a tempfile, because gmake expands $_ in the perl cmdline
++      $s .= "\n_rebase : \$(OBJECT)\n";
++      $s .= "\t\$(NOECHO) \$(ECHO) '/new base = (.+), new size = (.+)/ && printf \"%x\\n\",hex(\$1)+hex(\$2);' > _rebase\n";
++    } else {
++      if ($rebasever < 3.02) {  # new rebase 3.0.2 with database
++        warn "Hint: run perlrebase to initialize $rebase or upgrade to rebase 3.0.2\n";
++      }
++    }
++    $s;
++}
++
++=item install
++
++Rebase dll's with the global rebase database after installation.
++
++=cut
++
++sub install {
++    my($self, %attribs) = @_;
++    my $s = ExtUtils::MM_Unix::install($self, %attribs);
++    return '' unless $s;
++    return $s unless %{$self->{XS}};
++
++    my $rebaseverstr = -f '/bin/rebase' ? `/bin/rebase -V 2>&1` : '0';
++    my ($rebasever) = $rebaseverstr =~ /rebase version ([0-9.]+)/;
++    $rebasever =~ s/(\d\.\d+)\./$1/;
++    if ($rebasever > 3.01) {  # new rebase 3.0.2 with database
++      my $INSTALLDIRS = $self->{INSTALLDIRS};
++      my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")};
++      my $dll = "$INSTALLLIB/auto/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}";
++      $s =~ s|^(pure_install :: pure_\$\(INSTALLDIRS\)_install\n\t)\$\(NOECHO\) \$\(NOOP\)\n|$1\$(CHMOD) \$(PERM_RWX) \$(DESTDIR)$dll\n\ttest -n "\$(DESTDIR)\" \|\| /bin/rebase -s $dll\n|m;
+     }
+     $s;
+ }