Integrate with Sarathy.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Cygwin.pm
1 package ExtUtils::MM_Cygwin;
2
3 use Config;
4 #use Cwd;
5 #use File::Basename;
6 require Exporter;
7
8 Exporter::import('ExtUtils::MakeMaker',
9        qw( $Verbose &neatvalue));
10
11 unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
12
13 sub canonpath {
14     my($self,$path) = @_;
15     $path =~ s|\\|/|g;
16     return $self->ExtUtils::MM_Unix::canonpath($path);
17 }
18
19 sub cflags {
20     my($self,$libperl)=@_;
21     return $self->{CFLAGS} if $self->{CFLAGS};
22     my $base =$self->ExtUtils::MM_Unix::cflags($libperl);
23     foreach (split /\n/, $base) {
24       / *= */ and $self->{$`} = $';
25     };
26     $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
27
28     return $self->{CFLAGS} = qq{
29 CCFLAGS = $self->{CCFLAGS}
30 OPTIMIZE = $self->{OPTIMIZE}
31 PERLTYPE = $self->{PERLTYPE}
32 LARGE = $self->{LARGE}
33 SPLIT = $self->{SPLIT}
34 };
35
36 }
37
38 sub manifypods {
39     my($self, %attribs) = @_;
40     return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
41         %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
42     my($dist);
43     my($pod2man_exe);
44     if (defined $self->{PERL_SRC}) {
45         $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
46     } else {
47         $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
48     }
49     unless ($self->perl_script($pod2man_exe)) {
50         # No pod2man but some MAN3PODS to be installed
51         print <<END;
52
53 Warning: I could not locate your pod2man program. Please make sure,
54          your pod2man program is in your PATH before you execute 'make'
55
56 END
57         $pod2man_exe = "-S pod2man";
58     }
59     my(@m);
60     push @m,
61 qq[POD2MAN_EXE = $pod2man_exe\n],
62 qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
63 q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "],
64  $self->{MAKEFILE}, q[";' \\
65 -e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \\
66 -e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
67 -e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
68 ];
69     push @m, "\nmanifypods : pure_all ";
70     push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
71
72     push(@m,"\n");
73     if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
74         push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
75         push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
76     }
77     join('', @m);
78 }
79
80 sub perl_archive
81 {
82  return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
83 }
84
85 1;
86 __END__
87
88 =head1 NAME
89
90 ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker
91
92 =head1 SYNOPSIS
93
94  use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed
95
96 =head1 DESCRIPTION
97
98 See ExtUtils::MM_Unix for a documentation of the methods provided there.
99
100 =over
101
102 =item canonpath
103
104 replaces backslashes with forward ones.  then acts as *nixish.
105
106 =item cflags
107
108 if configured for dynamic loading, triggers #define EXT in EXTERN.h
109
110 =item manifypods
111
112 replaces strings '::' with '.' in man page names
113
114 =item perl_archive
115
116 points to libperl.a
117
118 =back
119
120 =cut
121