1require 5.00503;
2use strict;
3use ExtUtils::MakeMaker;
4
5use lib qw( ./lib );
6
7my %prereq = $] < 5.006 ? ( 'JSON::PP::Compat5005' => 0 )
8           : $] < 5.008 ? ( 'JSON::PP::Compat5006' => 0 )
9           : ( 'Scalar::Util' => 1.08 )  # for 5.8.0 only
10           ;
11
12# ensure old versions installed from bundled copy in ExtUtils::MakeMaker
13# are removed when installing this; this will warn on old EU::MM but
14# still works
15my $needs_uninst = $] < 5.012
16    && ! $ENV{PERL_NO_HIGHLANDER}
17    && ! ( $ENV{PERL_MM_OPT} && $ENV{PERL_MM_OPT} =~ /(?:INSTALL_BASE|PREFIX)/ )
18    && ! grep { /INSTALL_BASE/ || /PREFIX/ } @ARGV;
19
20WriteMakefile(
21    'NAME'          => 'JSON::PP',
22    'VERSION_FROM'  => 'lib/JSON/PP.pm', # finds $VERSION
23    'PREREQ_PM'     => {
24              'Test::More'  => 0,
25              %prereq,
26    },
27    'EXE_FILES' => [ 'bin/p5json_pp' ],
28    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
29      (ABSTRACT_FROM => 'lib/JSON/PP.pm', # retrieve abstract from module
30       AUTHOR     => 'Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>') : ()),
31    ( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE' => 'perl', ) : () ),
32
33    ( $ExtUtils::MakeMaker::VERSION >= 6.46 ? (
34        'META_MERGE' => {
35            resources => {
36                repository  =>  'https://github.com/makamaka/JSON-PP',
37                bugtracker  =>  'https://github.com/makamaka/JSON-PP/issues',
38            },
39        } ) : ()
40    ),
41    ( $needs_uninst ? ( UNINST => 1 ) : () ),
42);
43
44
45if ($] < 5.006) { # I saw to http://d.hatena.ne.jp/asakusabashi/20051231/p1
46    open(IN, "Makefile");
47    open(OUT,">Makefile.tmp") || die;
48    while(<IN>) {
49        s/PERL_DL_NONLAZY=1//g;
50        print OUT;
51    }
52    close(OUT);
53    close(IN);
54    rename("Makefile.tmp" => "Makefile");
55}
56
57