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