Permalink
Cannot retrieve contributors at this time
| #!perl | |
| use strict; | |
| use warnings; | |
| require 5.006; | |
| use ExtUtils::MakeMaker; | |
| my $have_compiler | |
| = ! parse_args()->{PUREPERL_ONLY} | |
| && can_xs(); | |
| my %RUN_DEPS = ( | |
| 'XSLoader' => 0, | |
| 'Exporter::Tiny' => '0.038', | |
| ); | |
| my %CONFIGURE_DEPS = ( | |
| 'ExtUtils::MakeMaker' => 0, | |
| ); | |
| my %BUILD_DEPS = (); | |
| my %TEST_DEPS = ( | |
| 'Test::More' => 0.96, | |
| ); | |
| WriteMakefile1( | |
| META_MERGE => { | |
| 'meta-spec' => { version => 2 }, | |
| resources => { | |
| homepage => 'https://metacpan.org/release/List-MoreUtils', | |
| repository => { | |
| url => 'https://github.com/perl5-utils/List-MoreUtils.git', | |
| web => 'https://github.com/perl5-utils/List-MoreUtils', | |
| type => 'git', | |
| }, | |
| bugtracker => { | |
| web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=List-MoreUtils', | |
| mailto => 'bug-List-MoreUtils@rt.cpan.org', | |
| }, | |
| license => 'http://dev.perl.org/licenses/', | |
| }, | |
| prereqs => { | |
| develop => { | |
| requires => { | |
| 'Test::CPAN::Changes' => 0, | |
| 'Test::CheckManifest' => 0, | |
| 'Module::CPANTS::Analyse' => '0.96', | |
| 'Test::Kwalitee' => 0, | |
| 'Test::Pod' => 0, | |
| 'Test::Pod::Coverage' => 0, | |
| 'Test::Pod::Spelling::CommonMistakes' => 0, | |
| 'Test::Spelling' => 0, | |
| }, | |
| }, | |
| configure => { | |
| requires => {%CONFIGURE_DEPS}, | |
| }, | |
| build => { requires => {%BUILD_DEPS} }, | |
| test => { | |
| requires => {%TEST_DEPS}, | |
| recommends => { 'Test::LeakTrace' => 0 } | |
| }, | |
| runtime => { | |
| requires => { %RUN_DEPS, }, | |
| }, | |
| }, | |
| }, | |
| NAME => 'List::MoreUtils', | |
| ABSTRACT => 'Provide the stuff missing in List::Util', | |
| VERSION_FROM => 'lib/List/MoreUtils.pm', | |
| AUTHOR => [ | |
| 'Tassilo von Parseval <tassilo.von.parseval@rwth-aachen.de>', | |
| 'Adam Kennedy <adamk@cpan.org>', | |
| 'Jens Rehsack <rehsack@cpan.org>' | |
| ], | |
| LICENSE => 'perl', | |
| CONFIGURE_REQUIRES => \%CONFIGURE_DEPS, | |
| PREREQ_PM => \%RUN_DEPS, | |
| BUILD_REQUIRES => \%BUILD_DEPS, | |
| TEST_REQUIRES => \%TEST_DEPS, | |
| test => { TESTS => join(' ', | |
| 't/pureperl/*.t', | |
| ( $have_compiler ? 't/xs/*.t' : () ), | |
| ) }, | |
| ( $] < 5.012 ? ( DEFINE => '-DPERL_EXT' ) : (), ), | |
| ); | |
| sub parse_args { | |
| # copied from EUMM | |
| require ExtUtils::MakeMaker; | |
| require Text::ParseWords; | |
| ExtUtils::MakeMaker::parse_args( | |
| my $tmp = {}, | |
| Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''), | |
| @ARGV, | |
| ); | |
| return $tmp->{ARGS} || {}; | |
| } | |
| BEGIN { if ( $^O eq 'cygwin' ) { | |
| require ExtUtils::MM_Cygwin; | |
| require ExtUtils::MM_Win32; | |
| if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { | |
| *ExtUtils::MM_Cygwin::maybe_command = sub { | |
| my ($self, $file) = @_; | |
| if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { | |
| ExtUtils::MM_Win32->maybe_command($file); | |
| } else { | |
| ExtUtils::MM_Unix->maybe_command($file); | |
| } | |
| } | |
| } | |
| }} | |
| # can we locate a (the) C compiler | |
| sub can_cc { | |
| my @chunks = split(/ /, $Config::Config{cc}) or return; | |
| # $Config{cc} may contain args; try to find out the program part | |
| while (@chunks) { | |
| return can_run("@chunks") || (pop(@chunks), next); | |
| } | |
| return; | |
| } | |
| # check if we can run some command | |
| sub can_run { | |
| my ($cmd) = @_; | |
| return $cmd if -x $cmd; | |
| if (my $found_cmd = MM->maybe_command($cmd)) { | |
| return $found_cmd; | |
| } | |
| require File::Spec; | |
| for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { | |
| next if $dir eq ''; | |
| my $abs = File::Spec->catfile($dir, $cmd); | |
| return $abs if (-x $abs or $abs = MM->maybe_command($abs)); | |
| } | |
| return; | |
| } | |
| # Can our C compiler environment build XS files | |
| sub can_xs { | |
| # Do we have the configure_requires checker? | |
| local $@; | |
| eval "require ExtUtils::CBuilder; ExtUtils::CBuilder->VERSION(0.27)"; | |
| if ( $@ ) { | |
| # They don't obey configure_requires, so it is | |
| # someone old and delicate. Try to avoid hurting | |
| # them by falling back to an older simpler test. | |
| return can_cc(); | |
| } | |
| # Do we have a working C compiler | |
| my $builder = ExtUtils::CBuilder->new( | |
| quiet => 1, | |
| ); | |
| unless ( $builder->have_compiler ) { | |
| # No working C compiler | |
| return 0; | |
| } | |
| # Write a C file representative of what XS becomes | |
| require File::Temp; | |
| my ( $FH, $tmpfile ) = File::Temp::tempfile( | |
| "compilexs-XXXXX", | |
| SUFFIX => '.c', | |
| ); | |
| binmode $FH; | |
| print $FH <<'END_C'; | |
| #include "EXTERN.h" | |
| #include "perl.h" | |
| #include "XSUB.h" | |
| int main(int argc, char **argv) { | |
| return 0; | |
| } | |
| int boot_sanexs() { | |
| return 1; | |
| } | |
| END_C | |
| close $FH; | |
| # Can the C compiler access the same headers XS does | |
| my @libs = (); | |
| my $object = undef; | |
| eval { | |
| local $^W = 0; | |
| $object = $builder->compile( | |
| source => $tmpfile, | |
| ); | |
| @libs = $builder->link( | |
| objects => $object, | |
| module_name => 'sanexs', | |
| ); | |
| }; | |
| my $result = $@ ? 0 : 1; | |
| # Clean up all the build files | |
| foreach ( $tmpfile, $object, @libs ) { | |
| next unless defined $_; | |
| 1 while unlink; | |
| } | |
| return $result; | |
| } | |
| sub WriteMakefile1 | |
| { # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade. | |
| my %params = @_; | |
| my $eumm_version = $ExtUtils::MakeMaker::VERSION; | |
| $eumm_version = eval $eumm_version; | |
| die "EXTRA_META is deprecated" if ( exists( $params{EXTRA_META} ) ); | |
| die "License not specified" if ( !exists( $params{LICENSE} ) ); | |
| $params{TEST_REQUIRES} | |
| and $eumm_version < 6.6303 | |
| and $params{BUILD_REQUIRES} = { %{ $params{BUILD_REQUIRES} || {} }, %{ delete $params{TEST_REQUIRES} } }; | |
| #EUMM 6.5502 has problems with BUILD_REQUIRES | |
| $params{BUILD_REQUIRES} | |
| and $eumm_version < 6.5503 | |
| and $params{PREREQ_PM} = { %{ $params{PREREQ_PM} || {} }, %{ delete $params{BUILD_REQUIRES} } }; | |
| ref $params{AUTHOR} | |
| and "ARRAY" eq ref $params{AUTHOR} | |
| and $eumm_version < 6.5702 | |
| and $params{AUTHOR} = join( ", ", @{ $params{AUTHOR} } ); | |
| delete $params{CONFIGURE_REQUIRES} if ( $eumm_version < 6.52 ); | |
| delete $params{MIN_PERL_VERSION} if ( $eumm_version < 6.48 ); | |
| delete $params{META_MERGE} if ( $eumm_version < 6.46 ); | |
| delete $params{META_ADD}{prereqs} if ( $eumm_version < 6.58 ); | |
| delete $params{META_ADD}{'meta-spec'} if ( $eumm_version < 6.58 ); | |
| delete $params{META_ADD} if ( $eumm_version < 6.46 ); | |
| delete $params{LICENSE} if ( $eumm_version < 6.31 ); | |
| delete $params{AUTHOR} if ( $] < 5.005 ); | |
| delete $params{ABSTRACT_FROM} if ( $] < 5.005 ); | |
| delete $params{BINARY_LOCATION} if ( $] < 5.005 ); | |
| # more or less taken from Moose' Makefile.PL | |
| if ( $params{CONFLICTS} ) | |
| { | |
| my $ok = CheckConflicts(%params); | |
| exit(0) if ( $params{PREREQ_FATAL} and not $ok ); | |
| my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV; | |
| unless ( $cpan_smoker || $ENV{PERL_MM_USE_DEFAULT} ) | |
| { | |
| sleep 4 unless ($ok); | |
| } | |
| delete $params{CONFLICTS}; | |
| } | |
| WriteMakefile(%params); | |
| } |