line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::MakeMaker::PPPort; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
818
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:ATOOMIC'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: ExtUtils::MakeMaker when using Devel-PPPort |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
884
|
use ExtUtils::MakeMaker (); |
|
1
|
|
|
|
|
112367
|
|
|
1
|
|
|
|
|
44
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Makefile.PL |
16
|
|
|
|
|
|
|
use ExtUtils::MakeMaker::PPPort; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
WriteMakefile( |
19
|
|
|
|
|
|
|
NAME => 'Foo::Bar', |
20
|
|
|
|
|
|
|
... |
21
|
|
|
|
|
|
|
MIN_PPPORT_VERSION => 3.58, # optional |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module allows you to use an up to date version of ppport.h |
27
|
|
|
|
|
|
|
when using Devel-PPPort. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
You do not need to ship an old version of `ppport.h` with your codebase. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 Migration to ExtUtils::MakeMaker::PPPort |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
You want to remove `ppport.h` from your directory and ignore it in your version control. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
rm -f ppport.h |
37
|
|
|
|
|
|
|
echo 'ppport.h' >> .gitignore |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Then you can start using `ExtUtils::MakeMaker::PPPort` instead of `ExtUtils::MakeMaker`. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
10
|
use constant LAST_KNOWN_PPPORT_VERSION => 3.58; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
233
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
our $MIN_PPPORT_VERSION = LAST_KNOWN_PPPORT_VERSION; # last known version |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub import { |
48
|
1
|
|
|
1
|
|
13
|
my ( $class, @import_opts ) = @_; |
49
|
1
|
50
|
|
|
|
18
|
my $orig = 'ExtUtils::MakeMaker'->can('WriteMakefile') or die; |
50
|
1
|
|
|
|
|
88
|
ExtUtils::MakeMaker->export_to_level( 1, $class, @import_opts ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $writer = sub { |
53
|
0
|
|
|
0
|
|
0
|
my %params = @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Do nothing if not called from Makefile.PL |
56
|
|
|
|
|
|
|
#my ($caller, $file, $line) = caller; |
57
|
|
|
|
|
|
|
#(my $root = rel2abs($file)) =~ s/Makefile\.PL$//i or return; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
$MIN_PPPORT_VERSION = delete $params{MIN_PPPORT_VERSION}; |
60
|
0
|
0
|
|
|
|
0
|
$MIN_PPPORT_VERSION = LAST_KNOWN_PPPORT_VERSION unless defined $MIN_PPPORT_VERSION; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Build requires => BUILD_REQUIRES / PREREQ_PM |
63
|
0
|
0
|
|
|
|
0
|
_merge( |
64
|
|
|
|
|
|
|
\%params, |
65
|
|
|
|
|
|
|
{ 'Devel-PPPort' => $MIN_PPPORT_VERSION }, |
66
|
|
|
|
|
|
|
_eumm('6.56') ? 'BUILD_REQUIRES' : 'PREREQ_PM', |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
$orig->(%params); |
70
|
1
|
|
|
|
|
6
|
}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# redefine the WriteMakefile sub |
73
|
|
|
|
|
|
|
{ |
74
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
658
|
|
|
1
|
|
|
|
|
3
|
|
75
|
1
|
|
|
|
|
22
|
*main::WriteMakefile = *ExtUtils::MakeMaker::WriteMakefile = $writer; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _eumm { |
80
|
0
|
|
|
0
|
|
|
my $version = shift; |
81
|
0
|
0
|
|
|
|
|
eval { ExtUtils::MakeMaker->VERSION($version) } ? 1 : 0; |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _merge { |
85
|
0
|
|
|
0
|
|
|
my ( $params, $requires, $key ) = @_; |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
return unless $key; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
for ( keys %{ $requires || {} } ) { |
|
0
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $version = _normalize_version( $requires->{$_} ); |
91
|
0
|
0
|
|
|
|
|
next unless defined $version; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$params->{$key}{$_} = $version; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _normalize_version { |
98
|
0
|
|
|
0
|
|
|
my $version = shift; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# shortcuts |
101
|
0
|
0
|
|
|
|
|
return unless defined $version; |
102
|
0
|
0
|
|
|
|
|
return $version unless $version =~ /\s/; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# TODO: better range handling |
105
|
0
|
|
|
|
|
|
$version =~ s/(?:>=|==)\s*//; |
106
|
0
|
|
|
|
|
|
$version =~ s/,.+$//; |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
return $version unless $version =~ /\s/; |
109
|
0
|
|
|
|
|
|
return; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
{ |
113
|
|
|
|
|
|
|
package # hide from PAUSE |
114
|
|
|
|
|
|
|
MY; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub top_targets { |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
0
|
|
|
my $content = shift->SUPER::top_targets(@_); |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$content =~ s{^(pure_all\s*::\s*)}{${1}ppport }m; |
121
|
0
|
|
|
|
|
|
return $content; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub clean { |
125
|
0
|
|
|
0
|
|
|
my $content = shift->SUPER::clean(@_); |
126
|
0
|
|
|
|
|
|
$content =~ s{^(clean\s*::\s*)}{${1}ppport_clean }m; |
127
|
0
|
|
|
|
|
|
return $content; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub postamble { |
131
|
0
|
|
|
0
|
|
|
my ( $self, %extra ) = @_; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
my $post = $self->SUPER::postamble(%extra); |
134
|
0
|
|
0
|
|
|
|
my $min_version = $extra{MIN_DEVEL_PPPORT} || 0; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$post .= <<'POSTAMBLE'; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# ppport targets |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
.PHONY: ppport ppport_version ppport_clean |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
ppport: ppport_version ppport.h |
143
|
|
|
|
|
|
|
~TAB~$(NOECHO) $(NOOP) |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
ppport_version: |
146
|
|
|
|
|
|
|
~TAB~@$(PERL) -I$(INST_LIB) -MDevel::PPPort -e 'die qq[Needs Devel-PPPort version >= ~MIN_DEVEL_PPPORT~ # got $$Devel::PPPort::VERSION] unless $$Devel::PPPort::VERSION >= ~MIN_DEVEL_PPPORT~' |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
ppport_clean: |
149
|
|
|
|
|
|
|
~TAB~- $(RM_F) ppport.h |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
ppport.h : |
152
|
|
|
|
|
|
|
~TAB~@$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MDevel::PPPort -e'Devel::PPPort::WriteFile' |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
POSTAMBLE |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
$post =~ s{~MIN_DEVEL_PPPORT~}{$MIN_PPPORT_VERSION}g; |
157
|
0
|
|
|
|
|
|
$post =~ s{~TAB~}{\t}g; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
return $post; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub dynamic |
164
|
|
|
|
|
|
|
{ |
165
|
0
|
|
|
0
|
|
|
my $content = shift->SUPER::dynamic(@_); |
166
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
$content =~ s{^(dynamic\s*::\s*)}{${1}ppport }m; |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
return $content; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
__END__ |