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