Depend on a known good version of Package::Stash
[gitmo/Class-MOP.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install;
4 use Module::Install::ExtraTests;
5 use 5.008001;
6
7 check_conflicts();
8
9 name 'Class-MOP';
10 perl_version '5.008001';
11 all_from 'lib/Class/MOP.pm';
12 license 'perl';
13
14 require Config;
15 my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
16
17 if ( -d '.git' || $ENV{MAINTAINER_MODE} ) {
18     $ccflags .= ' -Wall -Wdeclaration-after-statement';
19 }
20
21 requires 'Carp';
22 requires 'Data::OptList';
23 requires 'Devel::GlobalDestruction';
24 requires 'List::MoreUtils' => '0.12';
25 requires 'MRO::Compat'  => '0.05';
26 requires 'Package::DeprecationManager' => '0.04';
27 requires 'Package::Stash' => '0.08';
28 requires 'Scalar::Util' => '1.18';
29 requires 'Sub::Name'    => '0.04';
30 requires 'Try::Tiny'    => '0.02';
31 requires 'Task::Weaken';
32
33 test_requires 'File::Spec';
34 test_requires 'Test::More'      => '0.88';
35 test_requires 'Test::Exception' => '0.27';
36 test_requires 'Test::Requires'  => '0.05';
37
38 repository 'git://git.moose.perl.org/Class-MOP.git';
39 add_metadata(x_authority => 'cpan:STEVAN');
40
41 extra_tests();
42
43 makemaker_args( CCFLAGS => $ccflags );
44
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
70 postamble(<<'EOM');
71 $(OBJECT) : mop.h
72 EOM
73
74 WriteAll();
75
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.
79 sub check_conflicts {
80     my %conflicts = (
81         'Moose'                         => '1.04',
82         'namespace::autoclean'          => '0.08',
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
103 EOF
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
118 package MY;
119
120 use Config;
121
122 sub 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 }