This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Leftovers from Encode 0.99.
[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 14
ecf68df6
DR
15use File::Spec;
16
f89d6eaa
FE
17unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
18
19sub canonpath {
ecf68df6
DR
20 shift;
21 return File::Spec->canonpath(@_);
f89d6eaa
FE
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
FE
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
FE
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
FE
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{
b53432e4
GH
89 if ($Config{useshrplib} eq 'true')
90 {
91 my $libperl = '$(PERL_INC)' .'/'. "$Config{libperl}";
92 $libperl =~ s/a$/dll.a/;
93 return $libperl;
94 } else {
f89d6eaa 95 return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
b53432e4 96 }
f89d6eaa
FE
97}
98
991;
100__END__
101
102=head1 NAME
103
104ExtUtils::MM_Cygwin - methods to override UN*X behaviour in ExtUtils::MakeMaker
105
106=head1 SYNOPSIS
107
108 use ExtUtils::MM_Cygwin; # Done internally by ExtUtils::MakeMaker if needed
109
110=head1 DESCRIPTION
111
112See ExtUtils::MM_Unix for a documentation of the methods provided there.
113
bbc7dcd2 114=over 4
f89d6eaa
FE
115
116=item canonpath
117
118replaces backslashes with forward ones. then acts as *nixish.
119
120=item cflags
121
122if configured for dynamic loading, triggers #define EXT in EXTERN.h
123
124=item manifypods
125
126replaces strings '::' with '.' in man page names
127
128=item perl_archive
129
130points to libperl.a
1cab015a
FE
131
132=back
133
134=cut
135