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