line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.024; |
3
|
2
|
|
|
2
|
|
264641
|
use Moose; |
|
2
|
|
|
|
|
14
|
|
4
|
2
|
|
|
2
|
|
945
|
use List::Util qw( first ); |
|
2
|
|
|
|
|
778370
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
13093
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1220
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Add FFI::Build to your Makefile.PL |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# TODO: also add build and test prereqs for aliens |
10
|
|
|
|
|
|
|
# TODO: release as separate CPAN dist |
11
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger', |
12
|
|
|
|
|
|
|
'Dist::Zilla::Role::MetaProvider', |
13
|
|
|
|
|
|
|
'Dist::Zilla::Role::PrereqSource', |
14
|
|
|
|
|
|
|
'Dist::Zilla::Role::FilePruner', |
15
|
|
|
|
|
|
|
; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $mm_code_prereqs = <<'EOF1'; |
18
|
|
|
|
|
|
|
use FFI::Build::MM 0.83; |
19
|
|
|
|
|
|
|
my $fbmm = FFI::Build::MM->new; |
20
|
|
|
|
|
|
|
%WriteMakefileArgs = $fbmm->mm_args(%WriteMakefileArgs); |
21
|
|
|
|
|
|
|
EOF1 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $mm_code_postamble = <<'EOF2'; |
24
|
|
|
|
|
|
|
BEGIN { |
25
|
|
|
|
|
|
|
# append to any existing postamble. |
26
|
|
|
|
|
|
|
if(my $old = MY->can('postamble')) |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
no warnings 'redefine'; |
29
|
|
|
|
|
|
|
*MY::postamble = sub { |
30
|
|
|
|
|
|
|
$old->(@_) . |
31
|
|
|
|
|
|
|
"\n" . |
32
|
|
|
|
|
|
|
$fbmm->mm_postamble; |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
*MY::postamble = sub { |
38
|
|
|
|
|
|
|
$fbmm->mm_postamble; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
EOF2 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $comment_begin = "# BEGIN code inserted by @{[ __PACKAGE__ ]}\n"; |
45
|
|
|
|
|
|
|
my $comment_end = "# END code inserted by @{[ __PACKAGE__ ]}\n"; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
my($self) = @_; |
49
|
|
|
|
|
|
|
my $file = first { $_->name eq 'Makefile.PL' } @{ $self->zilla->files }; |
50
|
1
|
|
|
1
|
0
|
1162
|
$self->log_fatal("unable to find Makefile.PL") |
51
|
1
|
|
|
3
|
|
6
|
unless $file; |
|
3
|
|
|
|
|
104
|
|
|
1
|
|
|
|
|
26
|
|
52
|
1
|
50
|
|
|
|
40
|
my $content = $file->content; |
53
|
|
|
|
|
|
|
my $ok = $content =~ s/(unless \( eval \{ ExtUtils::MakeMaker)/"$comment_begin$mm_code_prereqs$comment_end\n\n$1"/e; |
54
|
1
|
|
|
|
|
7
|
$self->log_fatal('unable to find the correct location to insert prereqs') |
55
|
1
|
|
|
|
|
74
|
unless $ok; |
|
1
|
|
|
|
|
9
|
|
56
|
1
|
50
|
|
|
|
3
|
$content .= "\n\n$comment_begin$mm_code_postamble$comment_end\n"; |
57
|
|
|
|
|
|
|
$file->content($content); |
58
|
1
|
|
|
|
|
6
|
} |
59
|
1
|
|
|
|
|
5
|
|
60
|
|
|
|
|
|
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
$self->zilla->register_prereqs( +{ |
62
|
|
|
|
|
|
|
phase => 'configure', |
63
|
1
|
|
|
1
|
0
|
1866
|
type => 'requires', |
64
|
1
|
|
|
|
|
24
|
}, |
65
|
|
|
|
|
|
|
'FFI::Build::MM' => '0.83', |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
my($self) = @_; |
71
|
|
|
|
|
|
|
my %meta = ( dynamic_config => 1 ); |
72
|
|
|
|
|
|
|
\%meta; |
73
|
|
|
|
|
|
|
} |
74
|
1
|
|
|
1
|
0
|
4750
|
|
75
|
1
|
|
|
|
|
4
|
{ |
76
|
1
|
|
|
|
|
5
|
my($self) = @_; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
foreach my $file (@{ $self->zilla->files }) |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
next unless $file->name =~ m!^ffi/_build/!; |
81
|
1
|
|
|
1
|
0
|
137536
|
$self->log_debug([ 'pruning %s', $file->name ]); |
82
|
|
|
|
|
|
|
$self->zilla->prune_file($file); |
83
|
1
|
|
|
|
|
2
|
} |
|
1
|
|
|
|
|
58
|
|
84
|
|
|
|
|
|
|
} |
85
|
4
|
50
|
|
|
|
174
|
|
86
|
0
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
87
|
0
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=pod |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=encoding UTF-8 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 NAME |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Dist::Zilla::Plugin::FFI::Build - Add FFI::Build to your Makefile.PL |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 VERSION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
version 1.05 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SYNOPSIS |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
[FFI::Build] |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This plugin makes the appropriate modifications to your dist to allow |
111
|
|
|
|
|
|
|
you to bundle code with L<FFI::Platypus::Bundle>. It works with |
112
|
|
|
|
|
|
|
L<FFI::Build::MM>, and only works with L<ExtUtils::MakeMaker>, so |
113
|
|
|
|
|
|
|
don't try to use it with L<Module::Build>. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
It specifically: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item Updates C<Makefile.PL> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
To call L<FFI::Build::MM> to add the necessary hooks to build and install |
122
|
|
|
|
|
|
|
your bundled code. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item Sets configure-time prereqs |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
For L<FFI::Build::MM>. It also makes the prereqs for your distribution |
127
|
|
|
|
|
|
|
dynamic, which is required for L<FFI::Build::MM>. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item Prunes any build files |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Removes any files in C<ffi/_build> which may be created when developing |
132
|
|
|
|
|
|
|
an FFI module using the bundle interface. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This plugin adds the appropriate hooks for L<FFI::Build::MM> into your |
137
|
|
|
|
|
|
|
C<Makefile.PL>. It does not work with L<Module::Build>. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Graham Ollis. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
148
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |