X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=a872582be71c84f2e053b7ae6ffe8a5efbd6dd85;hb=e347ce3fe9e40dc060e73e07f282729f4191c878;hp=3ae0fb49c31040938cd78962a36f1e2feb179ac5;hpb=70ad065503e9bd1793cbc107741830d0dcb52a65;p=gitmo%2FClass-MOP.git diff --git a/Makefile.PL b/Makefile.PL index 3ae0fb4..a872582 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,20 +1,121 @@ use strict; use warnings; use inc::Module::Install; +use 5.008001; + +check_conflicts(); name 'Class-MOP'; +perl_version '5.008001'; all_from 'lib/Class/MOP.pm'; license 'perl'; -requires 'Scalar::Util' => '1.18'; -requires 'Sub::Name' => '0.02'; -requires 'Sub::Identify' => '0.03'; -requires 'MRO::Compat' => '0.05'; -requires 'Carp' => '0'; +require Config; +my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.'; +$ccflags .= ' -Wall' if -d '.svn' || -d '.git' || $ENV{MAINTAINER_MODE}; + +requires 'Carp'; +requires 'Devel::GlobalDestruction'; +requires 'MRO::Compat' => '0.05'; +requires 'Scalar::Util' => '1.18'; +requires 'Sub::Name' => '0.04'; +requires 'Task::Weaken'; + +test_requires 'File::Spec'; +test_requires 'Test::More' => '0.88'; +test_requires 'Test::Exception' => '0.27'; + +extra_tests(); + +makemaker_args( CCFLAGS => $ccflags ); + +{ + my (@clean, @OBJECT, %XS); + + for my $xs () { + (my $c = $xs) =~ s/\.xs$/.c/i; + (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i; -build_requires 'Test::More' => '0.62'; -build_requires 'Test::Exception' => '0.21'; -build_requires 'File::Spec' => '0'; + $XS{$xs} = $c; + push @OBJECT, $o; + push @clean, $o; + } + + for my $c (<*.c>) { + (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i; + push @OBJECT, $o; + push @clean, $o; + } + + makemaker_args( + clean => { FILES => join(q{ }, @clean) }, + OBJECT => join (q{ }, @OBJECT), + XS => \%XS, + ); +} + +postamble(<<'EOM'); +$(OBJECT) : mop.h +EOM -auto_provides; WriteAll(); + +# 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.85', + ); + + my $found = 0; + for my $mod ( sort keys %conflicts ) { + eval "require $mod"; + next if $@; + + my $installed = $mod->VERSION(); + if ( $installed le $conflicts{$mod} ) { + + print <<"EOF"; + +*** + This version of Class::MOP conflicts with the version of + $mod ($installed) you have installed. + + You will need to upgrade $mod after installing + this version of Class::MOP. +*** + +EOF + + $found = 1; + } + } + + return unless $found; + + # More or less copied from Module::Build + return if $ENV{PERL_MM_USE_DEFAULT}; + return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); + + sleep 4; +} + +package MY; + +use Config; + +sub const_cccmd { + my $ret = shift->SUPER::const_cccmd(@_); + return q{} unless $ret; + + if ($Config{cc} =~ /^cl\b/i) { + warn 'you are using MSVC... my condolences.'; + $ret .= ' /Fo$@'; + } + else { + $ret .= ' -o $@'; + } + + return $ret; +}