File Coverage

lib/ExtUtils/MM_Cygwin.pm
Criterion Covered Total %
statement 12 60 20.0
branch 0 28 0.0
condition 0 17 0.0
subroutine 4 12 33.3
pod 8 8 100.0
total 24 125 19.2


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