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