Make M::I::ExtraTests fail more obvious
[gitmo/Class-MOP.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install;
4 use Module::Install::ExtraTests;
5 use 5.008001;
6
7 check_conflicts();
8
9 name 'Class-MOP';
10 perl_version '5.008001';
11 all_from 'lib/Class/MOP.pm';
12 license 'perl';
13
14 require Config;
15 my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
16
17 if ( -d '.git' || $ENV{MAINTAINER_MODE} ) {
18     $ccflags .= ' -Wall -Wdeclaration-after-statement';
19 }
20
21 requires 'Carp';
22 requires 'Data::OptList';
23 requires 'Devel::GlobalDestruction';
24 requires 'List::MoreUtils' => '0.12';
25 requires 'MRO::Compat'  => '0.05';
26 requires 'Package::DeprecationManager' => '0.04';
27 requires 'Package::Stash';
28 requires 'Scalar::Util' => '1.18';
29 requires 'Sub::Name'    => '0.04';
30 requires 'Try::Tiny'    => '0.02';
31 requires 'Task::Weaken';
32
33 test_requires 'File::Spec';
34 test_requires 'Test::More'      => '0.88';
35 test_requires 'Test::Exception' => '0.27';
36
37 repository 'git://git.moose.perl.org/Class-MOP.git';
38 add_metadata(x_authority => 'cpan:STEVAN');
39
40 extra_tests();
41
42 makemaker_args( CCFLAGS => $ccflags );
43
44 {
45     my (@clean, @OBJECT, %XS);
46
47     for my $xs (<xs/*.xs>) {
48         (my $c = $xs) =~ s/\.xs$/.c/i;
49         (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
50
51         $XS{$xs} = $c;
52         push @OBJECT, $o;
53         push @clean, $o;
54     }
55
56     for my $c (<*.c>) {
57         (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
58         push @OBJECT, $o;
59         push @clean, $o;
60     }
61
62     makemaker_args(
63         clean  => { FILES => join(q{ }, @clean) },
64         OBJECT => join (q{ }, @OBJECT),
65         XS     => \%XS,
66     );
67 }
68
69 postamble(<<'EOM');
70 $(OBJECT) : mop.h
71 EOM
72
73 WriteAll();
74
75 # Use the cpan-smolder-stable script in the Moose svn root to figure
76 # out what on CPAN will break with the latest Moose, then update this
77 # before a release.
78 sub check_conflicts {
79     my %conflicts = (
80         'Moose' => '1.04',
81     );
82
83     my $found = 0;
84     for my $mod ( sort keys %conflicts ) {
85         eval "require $mod";
86         next if $@;
87
88         my $installed = $mod->VERSION();
89         if ( $installed le $conflicts{$mod} ) {
90
91             print <<"EOF";
92
93 ***
94     This version of Class::MOP conflicts with the version of
95     $mod ($installed) you have installed.
96
97     You will need to upgrade $mod after installing
98     this version of Class::MOP.
99 ***
100
101 EOF
102
103             $found = 1;
104         }
105     }
106
107     return unless $found;
108
109     # More or less copied from Module::Build
110     return if $ENV{PERL_MM_USE_DEFAULT};
111     return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
112
113     sleep 4;
114 }
115
116 package MY;
117
118 use Config;
119
120 sub const_cccmd {
121     my $ret = shift->SUPER::const_cccmd(@_);
122     return q{} unless $ret;
123
124     if ($Config{cc} =~ /^cl\b/i) {
125         warn 'you are using MSVC... my condolences.';
126         $ret .= ' /Fo$@';
127     }
128     else {
129         $ret .= ' -o $@';
130     }
131
132     return $ret;
133 }