X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=47397e988c9b6c854d537a212b8514de0f7a76a1;hb=4e1aac0188d89d4afb188988d33b4ec84c329c37;hp=cd4a289609de8719f1d16b2ab312c3f1af0a75dd;hpb=f125b31ebf5eead9cb712aad3ea4a29f7ce3d611;p=gitmo%2FClass-MOP.git diff --git a/Makefile.PL b/Makefile.PL index cd4a289..47397e9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,117 +1,69 @@ -# The perl/C checking voodoo is mostly stolen from Graham Barr's -# Scalar-List-Utils distribution. use strict; use warnings; +use inc::Module::Install; +use 5.008001; -use ExtUtils::MakeMaker; -use Config qw(%Config); -use File::Spec; +check_conflicts(); -# If undefined, try our best, if true, require XS, if false, never do -# XS -my $force_xs; +name 'Class-MOP'; +perl_version '5.008001'; +all_from 'lib/Class/MOP.pm'; +license 'perl'; -for (@ARGV) { - /^--pm/ and $force_xs = 0; - /^--xs/ and $force_xs = 1; -} +my $ccflags = -d '.svn' || -d '.git' || $ENV{MAINTAINER_MODE} ? '-Wall' : ''; -my $has_compiler = $force_xs; -unless ( defined $force_xs ) { - $has_compiler = check_for_compiler() - or no_cc(); -} +requires 'Carp'; +requires 'Devel::GlobalDestruction'; +requires 'MRO::Compat' => '0.05'; +requires 'Scalar::Util' => '1.18'; +requires 'Sub::Name' => '0.04'; +requires 'Task::Weaken'; -write_makefile(); - -sub write_makefile { - my $ccflags = -d '.svn' || $ENV{MAINTAINER_MODE} ? '-Wall' : ''; - - WriteMakefile( - VERSION_FROM => 'lib/Class/MOP.pm', - NAME => 'Class::MOP', - PREREQ_PM => { - 'Scalar::Util' => '1.18', - 'Sub::Name' => '0.02', - 'Sub::Identify' => '0.03', - 'MRO::Compat' => '0.05', - 'Carp' => 0, - }, - CONFIGURE => \&init, - CCFLAGS => $ccflags, - clean => { FILES => 'test.c test.o' }, - ABSTRACT_FROM => 'lib/Class/MOP.pm', - AUTHOR => 'Stevan Little ', - LICENSE => 'perl', - ); -} +test_requires 'File::Spec'; +test_requires 'Test::More' => '0.77'; +test_requires 'Test::Exception' => '0.21'; -sub no_cc { - print <<'EOF'; +makemaker_args( CCFLAGS => $ccflags ); - I cannot determine if you have a C compiler - so I will install a perl-only implementation +WriteAll(); - You can force installation of the XS version with +# Use the cpan-smolder-stable script in the Moose svn root to figure +# out what on CPAN will break with the latest Moose, then update this +# before a release. +sub check_conflicts { + my %conflicts = ( + 'Moose' => '0.71', + ); - perl Makefile.PL --xs + my $found = 0; + for my $mod ( sort keys %conflicts ) { + eval "require $mod"; + next if $@; -EOF -} + my $installed = $mod->VERSION(); + if ( $installed le $conflicts{$mod} ) { -sub check_for_compiler { - print "Testing if you have a C compiler\n"; + print <<"EOF"; - eval { require ExtUtils::CBuilder }; - if ($@) { - return _check_for_compiler_manually(); - } - else { - return _check_for_compiler_with_cbuilder(); - } -} +*** + This version of Class::MOP conflicts with the version of + $mod ($installed) you have installed. -sub _check_for_compiler_with_cbuilder { - my $cb = ExtUtils::CBuilder->new( quiet => 1 ); + You will need to upgrade $mod after installing + this version of Class::MOP. +*** - return $cb->have_compiler(); -} - -sub _check_for_compiler_manually { - unless ( open F, '>', 'test.c' ) { - warn - "Cannot write test.c, skipping test compilation and installing pure Perl version.\n"; - return 0; - } - - print F <<'EOF'; -int main() { return 0; } EOF - close F or return 0; - - my $cc = $Config{cc}; - if ( $cc =~ /cl(\.exe)?$/ ) { - - # stupid stupid MSVC compiler hack tacken from version.pm's - # Makefile.PL - $cc .= ' -c'; # prevent it from calling the linker + $found = 1; + } } - system("$cc -o test$Config{obj_ext} test.c") and return 0; + return unless $found; - unlink $_ for grep {-f} 'test.c', "test$Config{obj_ext}"; - - return 1; -} - -# This is EUMM voodoo -sub init { - my $hash = $_[1]; - - unless ($has_compiler) { - @{$hash}{ 'XS', 'C' } = ( {}, [] ); - } + # More or less copied from Module::Build + return if $ENV{PERL_MM_USE_DEFAULT}; + return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); - $hash; + sleep 4; }