This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pod nits from Simon Cozens <simon@brecon.co.uk> and others
[perl5.git] / lib / ExtUtils / MM_Cygwin.pm
1 package ExtUtils::MM_Cygwin;
2
3 use Config;
4 #use Cwd;
5 #use File::Basename;
6 require Exporter;
7
8 Exporter::import('ExtUtils::MakeMaker',
9        qw( $Verbose &neatvalue));
10
11 unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
12
13 sub canonpath {
14     my($self,$path) = @_;
15     $path =~ s|\\|/|g;
16     return $self->ExtUtils::MM_Unix::canonpath($path);
17 }
18
19 sub 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} .= " -DCYGWIN" unless ($self->{CCFLAGS} =~ /\-DCYGWIN/);
28
29     return $self->{CFLAGS} = qq{
30 CCFLAGS = $self->{CCFLAGS}
31 OPTIMIZE = $self->{OPTIMIZE}
32 PERLTYPE = $self->{PERLTYPE}
33 LARGE = $self->{LARGE}
34 SPLIT = $self->{SPLIT}
35 };
36
37 }
38
39 sub 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
54 Warning: I could not locate your pod2man program. Please make sure,
55          your pod2man program is in your PATH before you execute 'make'
56
57 END
58         $pod2man_exe = "-S pod2man";
59     }
60     my(@m);
61     push @m,
62 qq[POD2MAN_EXE = $pod2man_exe\n],
63 qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
64 q[-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
81 sub perl_archive
82 {
83  return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
84 }
85
86 1;
87 __END__
88
89 =head1 NAME
90
91 ExtUtils::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
99 See ExtUtils::MM_Unix for a documentation of the methods provided there.
100
101 =over
102
103 =item canonpath
104
105 replaces backslashes with forward ones.  then acts as *nixish.
106
107 =item cflags
108
109 if configured for dynamic loading, triggers #define EXT in EXTERN.h
110
111 =item manifypods
112
113 replaces strings '::' with '.' in man page names
114
115 =item perl_archive
116
117 points to libperl.a
118
119 =back
120
121 =cut
122