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