Commit | Line | Data |
f89d6eaa |
1 | package ExtUtils::MM_Cygwin; |
2 | |
b75c8c73 |
3 | use strict; |
4 | |
5 | our $VERSION = '1.00'; |
6 | |
f89d6eaa |
7 | use Config; |
8 | #use Cwd; |
9 | #use File::Basename; |
10 | require Exporter; |
11 | |
b75c8c73 |
12 | require ExtUtils::MakeMaker; |
13 | ExtUtils::MakeMaker->import(qw( $Verbose &neatvalue)); |
f89d6eaa |
14 | |
ecf68df6 |
15 | use File::Spec; |
16 | |
f89d6eaa |
17 | unshift @MM::ISA, 'ExtUtils::MM_Cygwin'; |
18 | |
19 | sub canonpath { |
ecf68df6 |
20 | shift; |
21 | return File::Spec->canonpath(@_); |
f89d6eaa |
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'); |
f89d6eaa |
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}) { |
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 |
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}}) { |
b53af0b8 |
79 | grep { $self->{MAN1PODS}{$_} =~ s/::/./g } keys %{$self->{MAN1PODS}}; |
80 | grep { $self->{MAN3PODS}{$_} =~ s/::/./g } keys %{$self->{MAN3PODS}}; |
f89d6eaa |
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 | { |
b53432e4 |
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 |
97 | } |
98 | |
99 | 1; |
100 | __END__ |
101 | |
102 | =head1 NAME |
103 | |
104 | ExtUtils::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 | |
112 | See ExtUtils::MM_Unix for a documentation of the methods provided there. |
113 | |
bbc7dcd2 |
114 | =over 4 |
f89d6eaa |
115 | |
116 | =item canonpath |
117 | |
118 | replaces backslashes with forward ones. then acts as *nixish. |
119 | |
120 | =item cflags |
121 | |
122 | if configured for dynamic loading, triggers #define EXT in EXTERN.h |
123 | |
124 | =item manifypods |
125 | |
126 | replaces strings '::' with '.' in man page names |
127 | |
128 | =item perl_archive |
129 | |
130 | points to libperl.a |
1cab015a |
131 | |
132 | =back |
133 | |
134 | =cut |
135 | |