1package ExtUtils::MM_Cygwin; 2 3use strict; 4 5use ExtUtils::MakeMaker::Config; 6use File::Spec; 7 8require ExtUtils::MM_Unix; 9require ExtUtils::MM_Win32; 10our @ISA = qw( ExtUtils::MM_Unix ); 11 12our $VERSION = '6.66'; 13 14 15=head1 NAME 16 17ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker 18 19=head1 SYNOPSIS 20 21 use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed 22 23=head1 DESCRIPTION 24 25See ExtUtils::MM_Unix for a documentation of the methods provided there. 26 27=over 4 28 29=item os_flavor 30 31We're Unix and Cygwin. 32 33=cut 34 35sub os_flavor { 36 return('Unix', 'Cygwin'); 37} 38 39=item cflags 40 41if configured for dynamic loading, triggers #define EXT in EXTERN.h 42 43=cut 44 45sub cflags { 46 my($self,$libperl)=@_; 47 return $self->{CFLAGS} if $self->{CFLAGS}; 48 return '' unless $self->needs_linking(); 49 50 my $base = $self->SUPER::cflags($libperl); 51 foreach (split /\n/, $base) { 52 /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; 53 }; 54 $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true'); 55 56 return $self->{CFLAGS} = qq{ 57CCFLAGS = $self->{CCFLAGS} 58OPTIMIZE = $self->{OPTIMIZE} 59PERLTYPE = $self->{PERLTYPE} 60}; 61 62} 63 64 65=item replace_manpage_separator 66 67replaces strings '::' with '.' in MAN*POD man page names 68 69=cut 70 71sub replace_manpage_separator { 72 my($self, $man) = @_; 73 $man =~ s{/+}{.}g; 74 return $man; 75} 76 77=item init_linker 78 79points to libperl.a 80 81=cut 82 83sub init_linker { 84 my $self = shift; 85 86 if ($Config{useshrplib} eq 'true') { 87 my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; 88 if( $] >= 5.006002 ) { 89 $libperl =~ s/a$/dll.a/; 90 } 91 $self->{PERL_ARCHIVE} = $libperl; 92 } else { 93 $self->{PERL_ARCHIVE} = 94 '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); 95 } 96 97 $self->{PERL_ARCHIVE_AFTER} ||= ''; 98 $self->{EXPORT_LIST} ||= ''; 99} 100 101=item maybe_command 102 103If our path begins with F</cygdrive/> then we use C<ExtUtils::MM_Win32> 104to determine if it may be a command. Otherwise we use the tests 105from C<ExtUtils::MM_Unix>. 106 107=cut 108 109sub maybe_command { 110 my ($self, $file) = @_; 111 112 if ($file =~ m{^/cygdrive/}i) { 113 return ExtUtils::MM_Win32->maybe_command($file); 114 } 115 116 return $self->SUPER::maybe_command($file); 117} 118 119=item dynamic_lib 120 121Use the default to produce the *.dll's. 122But for new archdir dll's use the same rebase address if the old exists. 123 124=cut 125 126sub dynamic_lib { 127 my($self, %attribs) = @_; 128 my $s = ExtUtils::MM_Unix::dynamic_lib($self, %attribs); 129 my $ori = "$self->{INSTALLARCHLIB}/auto/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}"; 130 if (-e $ori) { 131 my $imagebase = `/bin/objdump -p $ori | /bin/grep ImageBase | /bin/cut -c12-`; 132 chomp $imagebase; 133 if ($imagebase gt "40000000") { 134 my $LDDLFLAGS = $self->{LDDLFLAGS}; 135 $LDDLFLAGS =~ s/-Wl,--enable-auto-image-base/-Wl,--image-base=0x$imagebase/; 136 $s =~ s/ \$\(LDDLFLAGS\) / $LDDLFLAGS /m; 137 } 138 } 139 $s; 140} 141 142=item all_target 143 144Build man pages, too 145 146=cut 147 148sub all_target { 149 ExtUtils::MM_Unix::all_target(shift); 150} 151 152=back 153 154=cut 155 1561; 157