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