1b39c5158Smillertpackage ExtUtils::MM_Cygwin; 2b39c5158Smillert 3b39c5158Smillertuse strict; 4eac174f2Safresh1use warnings; 5b39c5158Smillert 6b39c5158Smillertuse ExtUtils::MakeMaker::Config; 7b39c5158Smillertuse File::Spec; 8b39c5158Smillert 9b39c5158Smillertrequire ExtUtils::MM_Unix; 10b39c5158Smillertrequire ExtUtils::MM_Win32; 11b39c5158Smillertour @ISA = qw( ExtUtils::MM_Unix ); 12b39c5158Smillert 13*e0680481Safresh1our $VERSION = '7.70'; 1456d68f1eSafresh1$VERSION =~ tr/_//d; 15b39c5158Smillert 16b39c5158Smillert 17b39c5158Smillert=head1 NAME 18b39c5158Smillert 19b39c5158SmillertExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker 20b39c5158Smillert 21b39c5158Smillert=head1 SYNOPSIS 22b39c5158Smillert 23b39c5158Smillert use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed 24b39c5158Smillert 25b39c5158Smillert=head1 DESCRIPTION 26b39c5158Smillert 2756d68f1eSafresh1See L<ExtUtils::MM_Unix> for a documentation of the methods provided there. 28b39c5158Smillert 29b39c5158Smillert=over 4 30b39c5158Smillert 31b39c5158Smillert=item os_flavor 32b39c5158Smillert 33b39c5158SmillertWe're Unix and Cygwin. 34b39c5158Smillert 35b39c5158Smillert=cut 36b39c5158Smillert 37b39c5158Smillertsub os_flavor { 38b39c5158Smillert return('Unix', 'Cygwin'); 39b39c5158Smillert} 40b39c5158Smillert 41b39c5158Smillert=item cflags 42b39c5158Smillert 43b39c5158Smillertif configured for dynamic loading, triggers #define EXT in EXTERN.h 44b39c5158Smillert 45b39c5158Smillert=cut 46b39c5158Smillert 47b39c5158Smillertsub cflags { 48b39c5158Smillert my($self,$libperl)=@_; 49b39c5158Smillert return $self->{CFLAGS} if $self->{CFLAGS}; 50b39c5158Smillert return '' unless $self->needs_linking(); 51b39c5158Smillert 52b39c5158Smillert my $base = $self->SUPER::cflags($libperl); 53b39c5158Smillert foreach (split /\n/, $base) { 54b39c5158Smillert /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; 55b39c5158Smillert }; 56b39c5158Smillert $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true'); 57b39c5158Smillert 58b39c5158Smillert return $self->{CFLAGS} = qq{ 59b39c5158SmillertCCFLAGS = $self->{CCFLAGS} 60b39c5158SmillertOPTIMIZE = $self->{OPTIMIZE} 61b39c5158SmillertPERLTYPE = $self->{PERLTYPE} 62b39c5158Smillert}; 63b39c5158Smillert 64b39c5158Smillert} 65b39c5158Smillert 66b39c5158Smillert 67b39c5158Smillert=item replace_manpage_separator 68b39c5158Smillert 69b39c5158Smillertreplaces strings '::' with '.' in MAN*POD man page names 70b39c5158Smillert 71b39c5158Smillert=cut 72b39c5158Smillert 73b39c5158Smillertsub replace_manpage_separator { 74b39c5158Smillert my($self, $man) = @_; 75b39c5158Smillert $man =~ s{/+}{.}g; 76b39c5158Smillert return $man; 77b39c5158Smillert} 78b39c5158Smillert 79b39c5158Smillert=item init_linker 80b39c5158Smillert 81b39c5158Smillertpoints to libperl.a 82b39c5158Smillert 83b39c5158Smillert=cut 84b39c5158Smillert 85b39c5158Smillertsub init_linker { 86b39c5158Smillert my $self = shift; 87b39c5158Smillert 88b39c5158Smillert if ($Config{useshrplib} eq 'true') { 89b39c5158Smillert my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; 9056d68f1eSafresh1 if( "$]" >= 5.006002 ) { 919f11ffb7Safresh1 $libperl =~ s/(dll\.)?a$/dll.a/; 92b39c5158Smillert } 93b39c5158Smillert $self->{PERL_ARCHIVE} = $libperl; 94b39c5158Smillert } else { 95b39c5158Smillert $self->{PERL_ARCHIVE} = 96b39c5158Smillert '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); 97b39c5158Smillert } 98b39c5158Smillert 99b8851fccSafresh1 $self->{PERL_ARCHIVEDEP} ||= ''; 100b39c5158Smillert $self->{PERL_ARCHIVE_AFTER} ||= ''; 101b39c5158Smillert $self->{EXPORT_LIST} ||= ''; 102b39c5158Smillert} 103b39c5158Smillert 104eac174f2Safresh1sub init_others { 105eac174f2Safresh1 my $self = shift; 106eac174f2Safresh1 107eac174f2Safresh1 $self->SUPER::init_others; 108eac174f2Safresh1 109eac174f2Safresh1 $self->{LDLOADLIBS} ||= $Config{perllibs}; 110eac174f2Safresh1 111eac174f2Safresh1 return; 112eac174f2Safresh1} 113eac174f2Safresh1 114b39c5158Smillert=item maybe_command 115b39c5158Smillert 1166fb12b70Safresh1Determine whether a file is native to Cygwin by checking whether it 1176fb12b70Safresh1resides inside the Cygwin installation (using Windows paths). If so, 11856d68f1eSafresh1use L<ExtUtils::MM_Unix> to determine if it may be a command. 11956d68f1eSafresh1Otherwise use the tests from L<ExtUtils::MM_Win32>. 120b39c5158Smillert 121b39c5158Smillert=cut 122b39c5158Smillert 123b39c5158Smillertsub maybe_command { 124b39c5158Smillert my ($self, $file) = @_; 125b39c5158Smillert 1266fb12b70Safresh1 my $cygpath = Cygwin::posix_to_win_path('/', 1); 1276fb12b70Safresh1 my $filepath = Cygwin::posix_to_win_path($file, 1); 128b39c5158Smillert 1296fb12b70Safresh1 return (substr($filepath,0,length($cygpath)) eq $cygpath) 1306fb12b70Safresh1 ? $self->SUPER::maybe_command($file) # Unix 1316fb12b70Safresh1 : ExtUtils::MM_Win32->maybe_command($file); # Win32 132b39c5158Smillert} 133b39c5158Smillert 134898184e3Ssthen=item dynamic_lib 135898184e3Ssthen 136898184e3SsthenUse the default to produce the *.dll's. 137898184e3SsthenBut for new archdir dll's use the same rebase address if the old exists. 138898184e3Ssthen 139898184e3Ssthen=cut 140898184e3Ssthen 141898184e3Ssthensub dynamic_lib { 142898184e3Ssthen my($self, %attribs) = @_; 143898184e3Ssthen my $s = ExtUtils::MM_Unix::dynamic_lib($self, %attribs); 1449f11ffb7Safresh1 return '' unless $s; 1459f11ffb7Safresh1 return $s unless %{$self->{XS}}; 1469f11ffb7Safresh1 1479f11ffb7Safresh1 # do an ephemeral rebase so the new DLL fits to the current rebase map 1489f11ffb7Safresh1 $s .= "\t/bin/find \$\(INST_ARCHLIB\)/auto -xdev -name \\*.$self->{DLEXT} | /bin/rebase -sOT -" if (( $Config{myarchname} eq 'i686-cygwin' ) and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} )); 1499f11ffb7Safresh1 $s; 150898184e3Ssthen} 1519f11ffb7Safresh1 1529f11ffb7Safresh1=item install 1539f11ffb7Safresh1 1549f11ffb7Safresh1Rebase dll's with the global rebase database after installation. 1559f11ffb7Safresh1 1569f11ffb7Safresh1=cut 1579f11ffb7Safresh1 1589f11ffb7Safresh1sub install { 1599f11ffb7Safresh1 my($self, %attribs) = @_; 1609f11ffb7Safresh1 my $s = ExtUtils::MM_Unix::install($self, %attribs); 1619f11ffb7Safresh1 return '' unless $s; 1629f11ffb7Safresh1 return $s unless %{$self->{XS}}; 1639f11ffb7Safresh1 1649f11ffb7Safresh1 my $INSTALLDIRS = $self->{INSTALLDIRS}; 1659f11ffb7Safresh1 my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")}; 1669f11ffb7Safresh1 my $dop = "\$\(DESTDIR\)$INSTALLLIB/auto/"; 1679f11ffb7Safresh1 my $dll = "$dop/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}"; 1689f11ffb7Safresh1 $s =~ s|^(pure_install :: pure_\$\(INSTALLDIRS\)_install\n\t)\$\(NOECHO\) \$\(NOOP\)\n|$1\$(CHMOD) \$(PERM_RWX) $dll\n\t/bin/find $dop -xdev -name \\*.$self->{DLEXT} \| /bin/rebase -sOT -\n|m if (( $Config{myarchname} eq 'i686-cygwin') and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} )); 169898184e3Ssthen $s; 170898184e3Ssthen} 171898184e3Ssthen 172b39c5158Smillert=back 173b39c5158Smillert 174b39c5158Smillert=cut 175b39c5158Smillert 176b39c5158Smillert1; 177