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