This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stray n_a
[perl5.git] / lib / ExtUtils / MM_Cygwin.pm
CommitLineData
f89d6eaa
FE
1package ExtUtils::MM_Cygwin;
2
b75c8c73 3use strict;
f6d6199c 4use vars qw($VERSION @ISA);
b75c8c73 5
f89d6eaa 6use Config;
ecf68df6
DR
7use File::Spec;
8
f6d6199c
MS
9require ExtUtils::MM_Any;
10require ExtUtils::MM_Unix;
11@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
f89d6eaa 12
a884ca7c 13$VERSION = 1.04;
f89d6eaa
FE
14
15sub cflags {
16 my($self,$libperl)=@_;
17 return $self->{CFLAGS} if $self->{CFLAGS};
e0678a30 18 return '' unless $self->needs_linking();
f6d6199c
MS
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
FE
23 };
24 $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
f89d6eaa
FE
25
26 return $self->{CFLAGS} = qq{
27CCFLAGS = $self->{CCFLAGS}
28OPTIMIZE = $self->{OPTIMIZE}
29PERLTYPE = $self->{PERLTYPE}
f89d6eaa
FE
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
FE
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
FE
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
FE
63-e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
64];
65 push @m, "\nmanifypods : pure_all ";
f6d6199c
MS
66 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}},
67 keys %{$self->{MAN3PODS}};
f89d6eaa
FE
68
69 push(@m,"\n");
70 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
b53af0b8
EF
71 grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}};
72 grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}};
f89d6eaa
FE
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
MS
79sub perl_archive {
80 if ($Config{useshrplib} eq 'true') {
81 my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}";
a884ca7c
MS
82 if( $] >= 5.007 ) {
83 $libperl =~ s/a$/dll.a/;
84 }
f6d6199c
MS
85 return $libperl;
86 } else {
87 return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
88 }
f89d6eaa
FE
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
FE
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
FE
123
124=back
125
126=cut
127