| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package ExtUtils::MM_Cygwin; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 5134 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 43 |  | 
| 4 | 1 |  |  | 1 |  | 8 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 32 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 7 | use ExtUtils::MakeMaker::Config; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 7 | 1 |  |  | 1 |  | 5 | use File::Spec; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 1195 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | require ExtUtils::MM_Unix; | 
| 10 |  |  |  |  |  |  | require ExtUtils::MM_Win32; | 
| 11 |  |  |  |  |  |  | our @ISA = qw( ExtUtils::MM_Unix ); | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | our $VERSION = '7.66'; | 
| 14 |  |  |  |  |  |  | $VERSION =~ tr/_//d; | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head1 NAME | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | See L<ExtUtils::MM_Unix> for a documentation of the methods provided there. | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =over 4 | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =item os_flavor | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | We're Unix and Cygwin. | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =cut | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | sub os_flavor { | 
| 38 | 0 |  |  | 0 | 1 |  | return('Unix', 'Cygwin'); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =item cflags | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | if configured for dynamic loading, triggers #define EXT in EXTERN.h | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =cut | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | sub cflags { | 
| 48 | 0 |  |  | 0 | 1 |  | my($self,$libperl)=@_; | 
| 49 | 0 | 0 |  |  |  |  | return $self->{CFLAGS} if $self->{CFLAGS}; | 
| 50 | 0 | 0 |  |  |  |  | return '' unless $self->needs_linking(); | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 0 |  |  |  |  |  | my $base = $self->SUPER::cflags($libperl); | 
| 53 | 0 |  |  |  |  |  | foreach (split /\n/, $base) { | 
| 54 | 0 | 0 |  |  |  |  | /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; | 
| 55 |  |  |  |  |  |  | }; | 
| 56 | 0 | 0 |  |  |  |  | $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true'); | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 0 |  |  |  |  |  | return $self->{CFLAGS} = qq{ | 
| 59 |  |  |  |  |  |  | CCFLAGS = $self->{CCFLAGS} | 
| 60 |  |  |  |  |  |  | OPTIMIZE = $self->{OPTIMIZE} | 
| 61 |  |  |  |  |  |  | PERLTYPE = $self->{PERLTYPE} | 
| 62 |  |  |  |  |  |  | }; | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =item replace_manpage_separator | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | replaces strings '::' with '.' in MAN*POD man page names | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =cut | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | sub replace_manpage_separator { | 
| 74 | 0 |  |  | 0 | 1 |  | my($self, $man) = @_; | 
| 75 | 0 |  |  |  |  |  | $man =~ s{/+}{.}g; | 
| 76 | 0 |  |  |  |  |  | return $man; | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =item init_linker | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | points to libperl.a | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =cut | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | sub init_linker { | 
| 86 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 0 | 0 |  |  |  |  | if ($Config{useshrplib} eq 'true') { | 
| 89 | 0 |  |  |  |  |  | my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}"; | 
| 90 | 0 | 0 |  |  |  |  | if( "$]" >= 5.006002 ) { | 
| 91 | 0 |  |  |  |  |  | $libperl =~ s/(dll\.)?a$/dll.a/; | 
| 92 |  |  |  |  |  |  | } | 
| 93 | 0 |  |  |  |  |  | $self->{PERL_ARCHIVE} = $libperl; | 
| 94 |  |  |  |  |  |  | } else { | 
| 95 |  |  |  |  |  |  | $self->{PERL_ARCHIVE} = | 
| 96 | 0 |  | 0 |  |  |  | '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a"); | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 | 0 |  | 0 |  |  |  | $self->{PERL_ARCHIVEDEP} ||= ''; | 
| 100 | 0 |  | 0 |  |  |  | $self->{PERL_ARCHIVE_AFTER} ||= ''; | 
| 101 | 0 |  | 0 |  |  |  | $self->{EXPORT_LIST}  ||= ''; | 
| 102 |  |  |  |  |  |  | } | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | sub init_others { | 
| 105 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 |  |  |  |  |  | $self->SUPER::init_others; | 
| 108 |  |  |  |  |  |  |  | 
| 109 | 0 |  | 0 |  |  |  | $self->{LDLOADLIBS} ||= $Config{perllibs}; | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 0 |  |  |  |  |  | return; | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =item maybe_command | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | Determine whether a file is native to Cygwin by checking whether it | 
| 117 |  |  |  |  |  |  | resides inside the Cygwin installation (using Windows paths). If so, | 
| 118 |  |  |  |  |  |  | use L<ExtUtils::MM_Unix> to determine if it may be a command. | 
| 119 |  |  |  |  |  |  | Otherwise use the tests from L<ExtUtils::MM_Win32>. | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =cut | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | sub maybe_command { | 
| 124 | 0 |  |  | 0 | 1 |  | my ($self, $file) = @_; | 
| 125 |  |  |  |  |  |  |  | 
| 126 | 0 |  |  |  |  |  | my $cygpath = Cygwin::posix_to_win_path('/', 1); | 
| 127 | 0 |  |  |  |  |  | my $filepath = Cygwin::posix_to_win_path($file, 1); | 
| 128 |  |  |  |  |  |  |  | 
| 129 | 0 | 0 |  |  |  |  | return (substr($filepath,0,length($cygpath)) eq $cygpath) | 
| 130 |  |  |  |  |  |  | ? $self->SUPER::maybe_command($file) # Unix | 
| 131 |  |  |  |  |  |  | : ExtUtils::MM_Win32->maybe_command($file); # Win32 | 
| 132 |  |  |  |  |  |  | } | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =item dynamic_lib | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | Use the default to produce the *.dll's. | 
| 137 |  |  |  |  |  |  | But for new archdir dll's use the same rebase address if the old exists. | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =cut | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | sub dynamic_lib { | 
| 142 | 0 |  |  | 0 | 1 |  | my($self, %attribs) = @_; | 
| 143 | 0 |  |  |  |  |  | my $s = ExtUtils::MM_Unix::dynamic_lib($self, %attribs); | 
| 144 | 0 | 0 |  |  |  |  | return '' unless $s; | 
| 145 | 0 | 0 |  |  |  |  | return $s unless %{$self->{XS}}; | 
|  | 0 |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | # do an ephemeral rebase so the new DLL fits to the current rebase map | 
| 148 | 0 | 0 | 0 |  |  |  | $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} )); | 
| 149 | 0 |  |  |  |  |  | $s; | 
| 150 |  |  |  |  |  |  | } | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =item install | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | Rebase dll's with the global rebase database after installation. | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | =cut | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | sub install { | 
| 159 | 0 |  |  | 0 | 1 |  | my($self, %attribs) = @_; | 
| 160 | 0 |  |  |  |  |  | my $s = ExtUtils::MM_Unix::install($self, %attribs); | 
| 161 | 0 | 0 |  |  |  |  | return '' unless $s; | 
| 162 | 0 | 0 |  |  |  |  | return $s unless %{$self->{XS}}; | 
|  | 0 |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  |  | 
| 164 | 0 |  |  |  |  |  | my $INSTALLDIRS = $self->{INSTALLDIRS}; | 
| 165 | 0 | 0 |  |  |  |  | my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")}; | 
| 166 | 0 |  |  |  |  |  | my $dop = "\$\(DESTDIR\)$INSTALLLIB/auto/"; | 
| 167 | 0 |  |  |  |  |  | my $dll = "$dop/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}"; | 
| 168 | 0 | 0 | 0 |  |  |  | $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} )); | 
| 169 | 0 |  |  |  |  |  | $s; | 
| 170 |  |  |  |  |  |  | } | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =back | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | =cut | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | 1; |