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