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
1 package ExtUtils::MM_Cygwin;
2
3 use strict;
4
5 our $VERSION = '1.00';
6
7 use Config;
8 #use Cwd;
9 #use File::Basename;
10 require Exporter;
11
12 require ExtUtils::MakeMaker;
13 ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue));
14
15 use File::Spec;
16
17 unshift @MM::ISA, 'ExtUtils::MM_Cygwin';
18
19 sub canonpath {
20     shift;
21     return File::Spec->canonpath(@_);
22 }
23
24 sub 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');
32
33     return $self->{CFLAGS} = qq{
34 CCFLAGS = $self->{CCFLAGS}
35 OPTIMIZE = $self->{OPTIMIZE}
36 PERLTYPE = $self->{PERLTYPE}
37 LARGE = $self->{LARGE}
38 SPLIT = $self->{SPLIT}
39 };
40
41 }
42
43 sub 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}) {
50         $pod2man_exe = File::Spec->catfile($self->{PERL_SRC},'pod','pod2man');
51     } else {
52         $pod2man_exe = File::Spec->catfile($Config{scriptdirexp},'pod2man');
53     }
54     unless ($self->perl_script($pod2man_exe)) {
55         # No pod2man but some MAN3PODS to be installed
56         print <<END;
57
58 Warning: I could not locate your pod2man program. Please make sure,
59          your pod2man program is in your PATH before you execute 'make'
60
61 END
62         $pod2man_exe = "-S pod2man";
63     }
64     my(@m);
65     push @m,
66 qq[POD2MAN_EXE = $pod2man_exe\n],
67 qq[POD2MAN = \$(PERL) -we '%m=\@ARGV;for (keys %m){' \\\n],
68 q[-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}}) {
79         grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}};
80         grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}};
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
87 sub perl_archive
88 {
89  return '$(PERL_INC)' .'/'. ("$Config{libperl}" or "libperl.a");
90 }
91
92 1;
93 __END__
94
95 =head1 NAME
96
97 ExtUtils::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
105 See ExtUtils::MM_Unix for a documentation of the methods provided there.
106
107 =over 4
108
109 =item canonpath
110
111 replaces backslashes with forward ones.  then acts as *nixish.
112
113 =item cflags
114
115 if configured for dynamic loading, triggers #define EXT in EXTERN.h
116
117 =item manifypods
118
119 replaces strings '::' with '.' in man page names
120
121 =item perl_archive
122
123 points to libperl.a
124
125 =back
126
127 =cut
128