avoid needing . in @INC in dev mode
[p5sagit/Devel-GlobalDestruction-XS.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use 5.006;
4
5 my %META = (
6   name => 'Devel-GlobalDestruction-XS',
7   license => 'perl_5',
8   dynamic_config => 0,
9   prereqs => {},
10   resources => {
11     repository => {
12       url => 'git://github.com/p5sagit/Devel-GlobalDestruction-XS.git',
13       # git://git.shadowcat.co.uk/p5sagit/Devel-GlobalDestruction-XS.git
14       web => 'http://github.com/p5sagit/Devel-GlobalDestruction-XS',
15       type => 'git',
16     },
17     bugtracker => {
18       web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-GlobalDestruction-XS',
19       mailto => 'bug-Devel-GlobalDestruction-XS@rt.cpan.org',
20     },
21     x_IRC => 'irc://irc.perl.org/#toolchain',
22     license => [ 'http://dev.perl.org/licenses/' ],
23   },
24 );
25
26 my %MM_ARGS = ();
27
28 ## BOILERPLATE ###############################################################
29 require ExtUtils::MakeMaker;
30 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
31
32 # have to do this since old EUMM dev releases miss the eval $VERSION line
33 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
34 my $mymeta        = $eumm_version >= 6.57_02;
35 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
36
37 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
38 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
39 $META{license} = [ $META{license} ]
40   if $META{license} && !ref $META{license};
41 $MM_ARGS{LICENSE} = $META{license}[0]
42   if $META{license} && $eumm_version >= 6.30;
43 $MM_ARGS{NO_MYMETA} = 1
44   if $mymeta_broken;
45 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
46   unless -f 'META.yml';
47
48 for (qw(configure build test runtime)) {
49   my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
50   my $r = $MM_ARGS{$key} = {
51     %{$META{prereqs}{$_}{requires} || {}},
52     %{delete $MM_ARGS{$key} || {}},
53   };
54   defined $r->{$_} or delete $r->{$_} for keys %$r;
55 }
56
57 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
58
59 delete $MM_ARGS{MIN_PERL_VERSION}
60   if $eumm_version < 6.47_01;
61 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
62   if $eumm_version < 6.63_03;
63 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
64   if $eumm_version < 6.55_01;
65 delete $MM_ARGS{CONFIGURE_REQUIRES}
66   if $eumm_version < 6.51_03;
67
68 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
69 ## END BOILERPLATE ###########################################################