add conflict for earlier namespace::autoclean, which uses deprecated method_map calls
[gitmo/Class-MOP.git] / Makefile.PL
CommitLineData
591a9381 1use strict;
2use warnings;
89dc39a9 3use inc::Module::Install;
3ba545a6 4use Module::Install::ExtraTests;
89dc39a9 5use 5.008001;
6
1a2f7db5 7check_conflicts();
8
89dc39a9 9name 'Class-MOP';
10perl_version '5.008001';
11all_from 'lib/Class/MOP.pm';
12license 'perl';
591a9381 13
72bc0a47 14require Config;
15my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
06e9254b 16
17if ( -d '.git' || $ENV{MAINTAINER_MODE} ) {
18 $ccflags .= ' -Wall -Wdeclaration-after-statement';
19}
f125b31e 20
89dc39a9 21requires 'Carp';
4154c4d0 22requires 'Data::OptList';
89dc39a9 23requires 'Devel::GlobalDestruction';
50de028e 24requires 'List::MoreUtils' => '0.12';
d065fbe6 25requires 'MRO::Compat' => '0.05';
2ea94f58 26requires 'Package::DeprecationManager' => '0.04';
407a4276 27requires 'Package::Stash';
d065fbe6 28requires 'Scalar::Util' => '1.18';
29requires 'Sub::Name' => '0.04';
a8344505 30requires 'Try::Tiny' => '0.02';
89dc39a9 31requires 'Task::Weaken';
32
33test_requires 'File::Spec';
7975280a 34test_requires 'Test::More' => '0.88';
4cd537dd 35test_requires 'Test::Exception' => '0.27';
0f352882 36test_requires 'Test::Requires' => '0.05';
89dc39a9 37
8c463274 38repository 'git://git.moose.perl.org/Class-MOP.git';
6b951296 39add_metadata(x_authority => 'cpan:STEVAN');
8c463274 40
3fd3a2ab 41extra_tests();
42
89dc39a9 43makemaker_args( CCFLAGS => $ccflags );
44
d846ade3 45{
46 my (@clean, @OBJECT, %XS);
47
48 for my $xs (<xs/*.xs>) {
49 (my $c = $xs) =~ s/\.xs$/.c/i;
50 (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
51
52 $XS{$xs} = $c;
53 push @OBJECT, $o;
54 push @clean, $o;
55 }
56
57 for my $c (<*.c>) {
58 (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
59 push @OBJECT, $o;
60 push @clean, $o;
61 }
62
63 makemaker_args(
64 clean => { FILES => join(q{ }, @clean) },
65 OBJECT => join (q{ }, @OBJECT),
66 XS => \%XS,
67 );
68}
69
8a9fe086 70postamble(<<'EOM');
71$(OBJECT) : mop.h
72EOM
73
89dc39a9 74WriteAll();
75
9b970254 76# Use the cpan-smolder-stable script in the Moose svn root to figure
77# out what on CPAN will break with the latest Moose, then update this
78# before a release.
79sub check_conflicts {
80 my %conflicts = (
0f762e30 81 'Moose' => '1.04',
82 'namespace::autoclean' => '0.08',
9b970254 83 );
84
85 my $found = 0;
86 for my $mod ( sort keys %conflicts ) {
87 eval "require $mod";
88 next if $@;
89
90 my $installed = $mod->VERSION();
91 if ( $installed le $conflicts{$mod} ) {
92
93 print <<"EOF";
94
95***
96 This version of Class::MOP conflicts with the version of
97 $mod ($installed) you have installed.
98
99 You will need to upgrade $mod after installing
100 this version of Class::MOP.
101***
102
103EOF
104
105 $found = 1;
106 }
107 }
108
109 return unless $found;
110
111 # More or less copied from Module::Build
112 return if $ENV{PERL_MM_USE_DEFAULT};
113 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
114
115 sleep 4;
116}
117
d846ade3 118package MY;
119
120use Config;
121
122sub const_cccmd {
123 my $ret = shift->SUPER::const_cccmd(@_);
124 return q{} unless $ret;
125
126 if ($Config{cc} =~ /^cl\b/i) {
127 warn 'you are using MSVC... my condolences.';
128 $ret .= ' /Fo$@';
129 }
130 else {
131 $ret .= ' -o $@';
132 }
133
134 return $ret;
135}