blib/lib/ExtUtils/MM_Cygwin.pm untested

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