Commit | Line | Data |
3a42a9c3 |
1 | use strict; |
9ed74472 |
2 | use warnings FATAL => 'all'; |
3 | use 5.006; |
caf20b64 |
4 | use lib 'inc'; |
5 | use ExtUtils::HasCompiler qw(can_compile_loadable_object); |
9ed74472 |
6 | |
7 | my %META = ( |
8 | name => 'Devel-GlobalDestruction', |
9 | license => 'perl_5', |
10 | prereqs => { |
11 | configure => { requires => { |
12 | 'ExtUtils::MakeMaker' => 0, |
13 | 'ExtUtils::CBuilder' => 0.27, |
14 | } }, |
15 | runtime => { |
16 | requires => { |
17 | 'Sub::Exporter::Progressive' => '0.001011', |
18 | 'perl' => 5.006, |
19 | }, |
20 | }, |
21 | }, |
22 | resources => { |
23 | homepage => 'https://metacpan.org/release/Devel-GlobalDestruction', |
24 | repository => { |
25 | url => 'git://git.shadowcat.co.uk/p5sagit/Devel-GlobalDestruction.git', |
26 | web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Devel-GlobalDestruction.git', |
27 | type => 'git', |
28 | }, |
29 | bugtracker => { |
30 | web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-GlobalDestruction', |
31 | mailto => 'bug-Devel-GlobalDestruction@rt.cpan.org', |
32 | }, |
33 | license => [ 'http://dev.perl.org/licenses/' ], |
34 | }, |
35 | no_index => { |
36 | directory => [ 't', 'xt' ] |
37 | }, |
38 | ); |
9aaf3646 |
39 | |
9ed74472 |
40 | my %MM_ARGS = ( |
41 | PREREQ_PM => { |
caf20b64 |
42 | ( (defined ${^GLOBAL_PHASE} or parse_args()->{PUREPERL_ONLY} |
43 | or !can_compile_loadable_object(quiet => 1) ) |
9ed74472 |
44 | ? () |
45 | : ('Devel::GlobalDestruction::XS' => 0) |
46 | ), |
47 | }, |
48 | ); |
3a42a9c3 |
49 | |
e00dea6c |
50 | use Text::ParseWords; |
51 | |
52 | sub parse_args { |
53 | # copied from EUMM |
54 | ExtUtils::MakeMaker::parse_args( |
55 | my $tmp = {}, |
56 | Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''), |
57 | @ARGV, |
58 | ); |
59 | return $tmp->{ARGS} || {}; |
219ca4f9 |
60 | } |
61 | |
3d084a8c |
62 | if (eval { require Devel::GlobalDestruction } |
63 | && Devel::GlobalDestruction->VERSION < 0.10) { |
64 | package MY; |
65 | no warnings 'once'; |
66 | |
67 | *install = sub { |
68 | my $self = shift; |
69 | return ' |
70 | pure_site_install :: |
71 | $(NOECHO) $(RM_F) ' . $self->quote_literal( |
72 | $self->catfile('$(DESTINSTALLSITEARCH)', 'Devel', 'GlobalDestruction.pm') |
73 | ) . "\n" . $self->SUPER::install; |
74 | }; |
75 | } |
76 | |
734ce277 |
77 | ## BOILERPLATE ############################################################### |
9ed74472 |
78 | require ExtUtils::MakeMaker; |
79 | (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; |
80 | |
81 | # have to do this since old EUMM dev releases miss the eval $VERSION line |
82 | my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; |
83 | my $mymeta = $eumm_version >= 6.57_02; |
84 | my $mymeta_broken = $mymeta && $eumm_version < 6.57_07; |
85 | |
86 | ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g; |
87 | ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g; |
734ce277 |
88 | $META{license} = [ $META{license} ] |
89 | if $META{license} && !ref $META{license}; |
90 | $MM_ARGS{LICENSE} = $META{license}[0] |
91 | if $META{license} && $eumm_version >= 6.30; |
9ed74472 |
92 | $MM_ARGS{NO_MYMETA} = 1 |
93 | if $mymeta_broken; |
94 | $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META } |
95 | unless -f 'META.yml'; |
96 | |
97 | for (qw(configure build test runtime)) { |
98 | my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES'; |
99 | my $r = $MM_ARGS{$key} = { |
100 | %{$META{prereqs}{$_}{requires} || {}}, |
101 | %{delete $MM_ARGS{$key} || {}}, |
102 | }; |
103 | defined $r->{$_} or delete $r->{$_} for keys %$r; |
104 | } |
105 | |
106 | $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0; |
107 | |
108 | delete $MM_ARGS{MIN_PERL_VERSION} |
109 | if $eumm_version < 6.47_01; |
110 | $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}} |
111 | if $eumm_version < 6.63_03; |
112 | $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}} |
113 | if $eumm_version < 6.55_01; |
114 | delete $MM_ARGS{CONFIGURE_REQUIRES} |
115 | if $eumm_version < 6.51_03; |
116 | |
117 | ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS); |
734ce277 |
118 | ## END BOILERPLATE ########################################################### |