support PUREPERL_ONLY
[p5sagit/strictures.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use ExtUtils::MakeMaker;
4
5 (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
6
7 my %extra_prereqs = (
8   indirect => 0,
9   multidimensional => 0,
10   'bareword::filehandles' => 0,
11 );
12
13 use Text::ParseWords;
14 sub parse_args {
15   # copied from EUMM
16   ExtUtils::MakeMaker::parse_args(
17     my $tmp = {},
18     Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
19     @ARGV,
20   );
21   return $tmp->{ARGS} || {};
22 }
23
24 my $have_compiler
25   = ! parse_args()->{PUREPERL_ONLY}
26   &&  eval { require ExtUtils::CBuilder; 1 }
27   && ExtUtils::CBuilder->new->have_compiler;
28
29 WriteMakefile(
30   NAME => 'strictures',
31   VERSION_FROM => 'lib/strictures.pm',
32   MIN_PERL_VERSION => '5.006',
33
34   META_MERGE => {
35     'meta-spec' => { version => 2 },
36     dynamic_config => 1,
37
38     resources => {
39       # r/w: p5sagit@git.shadowcat.co.uk:strictures.git
40       repository => {
41         url => 'git://git.shadowcat.co.uk/p5sagit/strictures.git',
42         web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git',
43         type => 'git',
44       },
45       bugtracker => {
46           mailto => 'bug-strictures@rt.cpan.org',
47           web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=strictures',
48       },
49     },
50
51     prereqs => {
52       configure => {
53         requires => {
54           'ExtUtils::CBuilder' => 0,
55         },
56       },
57       runtime => {
58         ( $] >= 5.008004 && !$have_compiler
59           ? ( recommends => \%extra_prereqs ) : () ),
60       },
61     },
62   },
63
64   ($] >= 5.008004 && $have_compiler
65     ? ( PREREQ_PM => \%extra_prereqs ) : () ),
66 );