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