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