This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
the uncontroversial doc patches
[perl5.git] / lib / ExtUtils / MM_Cygwin.pm
CommitLineData
f89d6eaa
FE
1package ExtUtils::MM_Cygwin;
2
b75c8c73
MS
3use strict;
4
5our $VERSION = '1.00';
6
f89d6eaa
FE
7use Config;
8#use Cwd;
9#use File::Basename;
10require Exporter;
11
b75c8c73
MS
12require ExtUtils::MakeMaker;
13ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue));
f89d6eaa
FE
14
15unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
16
17sub canonpath {
18 my($self,$path) = @_;
19 $path =~ s|\\|/|g;
20 return $self->ExtUtils::MM_Unix::canonpath($path);
21}
22
23sub cflags {
24 my($self,$libperl)=@_;
25 return $self->{CFLAGS} if $self->{CFLAGS};
26 my $base =$self->ExtUtils::MM_Unix::cflags($libperl);
27 foreach (split /\n/, $base) {
28 / *= */ and $self->{$`} = $';
29 };
30 $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
f89d6eaa
FE
31
32 return $self->{CFLAGS} = qq{
33CCFLAGS = $self->{CCFLAGS}
34OPTIMIZE = $self->{OPTIMIZE}
35PERLTYPE = $self->{PERLTYPE}
36LARGE = $self->{LARGE}
37SPLIT = $self->{SPLIT}
38};
39
40}
41
42sub manifypods {
43 my($self, %attribs) = @_;
44 return "\nmanifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
45 %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
46 my($dist);
47 my($pod2man_exe);
48 if (defined $self->{PERL_SRC}) {
49 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
50 } else {
51 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
52 }
53 unless ($self->perl_script($pod2man_exe)) {
54 # No pod2man but some MAN3PODS to be installed
55 print <<END;
56
57Warning: I could not locate your pod2man program. Please make sure,
58 your pod2man program is in your PATH before you execute 'make'
59
60END
61 $pod2man_exe = "-S pod2man";
62 }
63 my(@m);
64 push @m,
65qq[POD2MAN_EXE = $pod2man_exe\n],
66qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
67q[-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "],
68 $self->{MAKEFILE}, q[";' \\
69-e 'print "Manifying $$m{$$_}\n"; $$m{$$_} =~ s/::/./g;' \\
70-e 'system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2MAN_EXE) ].qq[$$_>$$m{$$_}])==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
71-e 'chmod(oct($(PERM_RW))), $$m{$$_} or warn "chmod $(PERM_RW) $$m{$$_}: $$!\n";}'
72];
73 push @m, "\nmanifypods : pure_all ";
74 push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
75
76 push(@m,"\n");
77 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
b53af0b8
EF
78 grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}};
79 grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}};
f89d6eaa
FE
80 push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t";
81 push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}};
82 }
83 join('', @m);
84}
85
86sub perl_archive
87{
88 return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
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
106=over
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