Add a comment for GETMAGIC in accessors
[gitmo/Class-MOP.git] / Makefile.PL
CommitLineData
591a9381 1use strict;
2use warnings;
89dc39a9 3use inc::Module::Install;
4use 5.008001;
5
6check_conflicts();
7
8name 'Class-MOP';
9perl_version '5.008001';
10all_from 'lib/Class/MOP.pm';
11license 'perl';
591a9381 12
72bc0a47 13require Config;
14my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
d846ade3 15$ccflags .= ' -Wall' if -d '.svn' || -d '.git' || $ENV{MAINTAINER_MODE};
f125b31e 16
89dc39a9 17requires 'Carp';
18requires 'Devel::GlobalDestruction';
d065fbe6 19requires 'MRO::Compat' => '0.05';
20requires 'Scalar::Util' => '1.18';
21requires 'Sub::Name' => '0.04';
89dc39a9 22requires 'Task::Weaken';
23
24test_requires 'File::Spec';
7975280a 25test_requires 'Test::More' => '0.88';
4cd537dd 26test_requires 'Test::Exception' => '0.27';
89dc39a9 27
6dc52caa 28install_headers('mop.h'); # need Module::Install::XSUtil
353c6152 29
30#extra_tests();
3fd3a2ab 31
89dc39a9 32makemaker_args( CCFLAGS => $ccflags );
33
d846ade3 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
8a9fe086 59postamble(<<'EOM');
60$(OBJECT) : mop.h
61EOM
62
89dc39a9 63WriteAll();
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.
68sub check_conflicts {
69 my %conflicts = (
0dc00e2f 70 'Moose' => '0.85',
89dc39a9 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
91EOF
92
93 $found = 1;
94 }
95 }
96
97 return unless $found;
98
99 # More or less copied from Module::Build
d065fbe6 100 return if $ENV{PERL_MM_USE_DEFAULT};
101 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
89dc39a9 102
103 sleep 4;
104}
d846ade3 105
106package MY;
107
108use Config;
109
110sub 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}