Add a comment for GETMAGIC in accessors
[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 install_headers('mop.h'); # need Module::Install::XSUtil
29
30 #extra_tests();
31
32 makemaker_args( CCFLAGS => $ccflags );
33
34 {
35     my (@clean, @OBJECT, %XS);
36
37     for my $xs (<xs/*.xs>) {
38         (my $c = $xs) =~ s/\.xs$/.c/i;
39         (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
40
41         $XS{$xs} = $c;
42         push @OBJECT, $o;
43         push @clean, $o;
44     }
45
46     for my $c (<*.c>) {
47         (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
48         push @OBJECT, $o;
49         push @clean, $o;
50     }
51
52     makemaker_args(
53         clean  => { FILES => join(q{ }, @clean) },
54         OBJECT => join (q{ }, @OBJECT),
55         XS     => \%XS,
56     );
57 }
58
59 postamble(<<'EOM');
60 $(OBJECT) : mop.h
61 EOM
62
63 WriteAll();
64
65 # Use the cpan-smolder-stable script in the Moose svn root to figure
66 # out what on CPAN will break with the latest Moose, then update this
67 # before a release.
68 sub check_conflicts {
69     my %conflicts = (
70         'Moose' => '0.85',
71     );
72
73     my $found = 0;
74     for my $mod ( sort keys %conflicts ) {
75         eval "require $mod";
76         next if $@;
77
78         my $installed = $mod->VERSION();
79         if ( $installed le $conflicts{$mod} ) {
80
81             print <<"EOF";
82
83 ***
84     This version of Class::MOP conflicts with the version of
85     $mod ($installed) you have installed.
86
87     You will need to upgrade $mod after installing
88     this version of Class::MOP.
89 ***
90
91 EOF
92
93             $found = 1;
94         }
95     }
96
97     return unless $found;
98
99     # More or less copied from Module::Build
100     return if $ENV{PERL_MM_USE_DEFAULT};
101     return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
102
103     sleep 4;
104 }
105
106 package MY;
107
108 use Config;
109
110 sub const_cccmd {
111     my $ret = shift->SUPER::const_cccmd(@_);
112     return q{} unless $ret;
113
114     if ($Config{cc} =~ /^cl\b/i) {
115         warn 'you are using MSVC... my condolences.';
116         $ret .= ' /Fo$@';
117     }
118     else {
119         $ret .= ' -o $@';
120     }
121
122     return $ret;
123 }