| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::ModuleBuild::XSOrPP; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::ModuleBuild::XSOrPP::VERSION = '0.04'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
781
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
33
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
666
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Dist::Zilla 4.0 (); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
extends |
|
14
|
|
|
|
|
|
|
qw( Dist::Zilla::Plugin::ModuleBuild Dist::Zilla::Plugin::InlineFiles ); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $pp_check = <<'EOF'; |
|
17
|
|
|
|
|
|
|
my $skip_xs; |
|
18
|
|
|
|
|
|
|
if ( grep { $_ eq '--pp' } @ARGV ) { |
|
19
|
|
|
|
|
|
|
$skip_xs = 1; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
elsif ( ! $build->have_c_compiler() ) { |
|
22
|
|
|
|
|
|
|
$skip_xs = 1; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
if ($skip_xs) { |
|
26
|
|
|
|
|
|
|
$build->build_elements( |
|
27
|
|
|
|
|
|
|
[ grep { $_ ne 'xs' } @{ $build->build_elements() } ] ); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
EOF |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
after setup_installer => sub { |
|
32
|
|
|
|
|
|
|
my $self = shift; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my ($file) = grep { $_->name() eq 'Build.PL' } @{ $self->zilla()->files() }; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $content = $file->content(); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$content =~ s/(\$build->create_build_script;)/$pp_check$1/; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$file->content($content); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return; |
|
43
|
|
|
|
|
|
|
}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# ABSTRACT: Add a --pp option to your Build.PL to force an XS-less build |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ModuleBuild::XSOrPP - Add a --pp option to your Build.PL to force an XS-less build |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.04 |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
In your F<dist.ini>: |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
[ModuleBuild::XSOrPP] |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Use this plugin instead of the regular C<ModuleBuild> plugin. It generates a |
|
72
|
|
|
|
|
|
|
F<Build.PL> which is smart about building XS. It can accept a C<--pp> flag to |
|
73
|
|
|
|
|
|
|
forcibly disable XS compilation. If no flag is passed, it tests whether the |
|
74
|
|
|
|
|
|
|
installing machine has a working compiler, and disables XS if this test fails. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Obviously, this is only useful if your module can work without its XS |
|
77
|
|
|
|
|
|
|
component. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUPPORT |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
82
|
|
|
|
|
|
|
C<bug-dist-zilla-plugin-modulebuild-xsorpp@rt.cpan.org>, or through the web |
|
83
|
|
|
|
|
|
|
interface at L<http://rt.cpan.org>. I will be notified, and then you'll |
|
84
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 CREDITS |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Much of the compiler check code comes from the F<Makefile.PL> in the |
|
89
|
|
|
|
|
|
|
L<List::MoreUtils> distro. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DONATIONS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
If you'd like to thank me for the work I've done on this module, please |
|
94
|
|
|
|
|
|
|
consider making a "donation" to me via PayPal. I spend a lot of free time |
|
95
|
|
|
|
|
|
|
creating free software, and would appreciate any support you'd care to offer. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Please note that B<I am not suggesting that you must do this> in order for me |
|
98
|
|
|
|
|
|
|
to continue working on this particular software. I will continue to do so, |
|
99
|
|
|
|
|
|
|
inasmuch as I have in the past, for as long as it interests me. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Similarly, a donation made in this way will probably not make me work on this |
|
102
|
|
|
|
|
|
|
software much more, unless I get so many donations that I can consider working |
|
103
|
|
|
|
|
|
|
on free software full time, which seems unlikely at best. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
To donate, log into PayPal and send money to autarch@urth.org or use the |
|
106
|
|
|
|
|
|
|
button on this page: L<http://www.urth.org/~autarch/fs-donation.html> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Dave Rolsky. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is free software, licensed under: |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |
|
124
|
|
|
|
|
|
|
|