2 use warnings FATAL => 'all';
6 name => 'Devel-GlobalDestruction',
9 configure => { requires => {
10 'ExtUtils::MakeMaker' => 0,
11 'ExtUtils::CBuilder' => 0.27,
15 'Sub::Exporter::Progressive' => '0.001011',
21 homepage => 'https://metacpan.org/release/Devel-GlobalDestruction',
23 url => 'git://git.shadowcat.co.uk/p5sagit/Devel-GlobalDestruction.git',
24 web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Devel-GlobalDestruction.git',
28 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-GlobalDestruction',
29 mailto => 'bug-Devel-GlobalDestruction@rt.cpan.org',
31 license => [ 'http://dev.perl.org/licenses/' ],
34 directory => [ 't', 'xt' ]
40 ( (defined ${^GLOBAL_PHASE} or parse_args()->{PUREPERL_ONLY} or !can_xs() )
42 : ('Devel::GlobalDestruction::XS' => 0)
47 use ExtUtils::MakeMaker;
48 BEGIN { if ( $^O eq 'cygwin' ) {
49 require ExtUtils::MM_Cygwin;
50 require ExtUtils::MM_Win32;
51 if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
52 *ExtUtils::MM_Cygwin::maybe_command = sub {
53 my ($self, $file) = @_;
54 if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
55 ExtUtils::MM_Win32->maybe_command($file);
57 ExtUtils::MM_Unix->maybe_command($file);
67 ExtUtils::MakeMaker::parse_args(
69 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
72 return $tmp->{ARGS} || {};
75 if (eval { require Devel::GlobalDestruction }
76 && Devel::GlobalDestruction->VERSION < 0.10) {
84 $(NOECHO) $(RM_F) ' . $self->quote_literal(
85 $self->catfile('$(DESTINSTALLSITEARCH)', 'Devel', 'GlobalDestruction.pm')
86 ) . "\n" . $self->SUPER::install;
90 # can we locate a (the) C compiler
92 my @chunks = split(/ /, $Config::Config{cc}) or return;
94 # $Config{cc} may contain args; try to find out the program part
96 return can_run("@chunks") || (pop(@chunks), next);
102 # check if we can run some command
106 return $cmd if -x $cmd;
107 if (my $found_cmd = MM->maybe_command($cmd)) {
112 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
114 my $abs = File::Spec->catfile($dir, $cmd);
115 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
121 # Can our C compiler environment build XS files
123 # Do we have the configure_requires checker?
125 eval "require ExtUtils::CBuilder; ExtUtils::CBuilder->VERSION(0.27)";
127 # They don't obey configure_requires, so it is
128 # someone old and delicate. Try to avoid hurting
129 # them by falling back to an older simpler test.
133 # Do we have a working C compiler
134 my $builder = ExtUtils::CBuilder->new(
137 unless ( $builder->have_compiler ) {
138 # No working C compiler
142 # Write a C file representative of what XS becomes
144 my ( $FH, $tmpfile ) = File::Temp::tempfile(
154 int main(int argc, char **argv) {
165 # Can the C compiler access the same headers XS does
170 $object = $builder->compile(
173 @libs = $builder->link(
175 module_name => 'sanexs',
178 my $result = $@ ? 0 : 1;
180 # Clean up all the build files
181 foreach ( $tmpfile, $object, @libs ) {
182 next unless defined $_;
189 ## BOILERPLATE ###############################################################
190 require ExtUtils::MakeMaker;
191 (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
193 # have to do this since old EUMM dev releases miss the eval $VERSION line
194 my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
195 my $mymeta = $eumm_version >= 6.57_02;
196 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
198 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
199 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
200 $META{license} = [ $META{license} ]
201 if $META{license} && !ref $META{license};
202 $MM_ARGS{LICENSE} = $META{license}[0]
203 if $META{license} && $eumm_version >= 6.30;
204 $MM_ARGS{NO_MYMETA} = 1
206 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
207 unless -f 'META.yml';
209 for (qw(configure build test runtime)) {
210 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
211 my $r = $MM_ARGS{$key} = {
212 %{$META{prereqs}{$_}{requires} || {}},
213 %{delete $MM_ARGS{$key} || {}},
215 defined $r->{$_} or delete $r->{$_} for keys %$r;
218 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
220 delete $MM_ARGS{MIN_PERL_VERSION}
221 if $eumm_version < 6.47_01;
222 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
223 if $eumm_version < 6.63_03;
224 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
225 if $eumm_version < 6.55_01;
226 delete $MM_ARGS{CONFIGURE_REQUIRES}
227 if $eumm_version < 6.51_03;
229 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
230 ## END BOILERPLATE ###########################################################