use Test::Requires in tests
[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 = (
81 'Moose' => '1.04',
82 );
83
84 my $found = 0;
85 for my $mod ( sort keys %conflicts ) {
86 eval "require $mod";
87 next if $@;
88
89 my $installed = $mod->VERSION();
90 if ( $installed le $conflicts{$mod} ) {
91
92 print <<"EOF";
93
94***
95 This version of Class::MOP conflicts with the version of
96 $mod ($installed) you have installed.
97
98 You will need to upgrade $mod after installing
99 this version of Class::MOP.
100***
101
102EOF
103
104 $found = 1;
105 }
106 }
107
108 return unless $found;
109
110 # More or less copied from Module::Build
111 return if $ENV{PERL_MM_USE_DEFAULT};
112 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
113
114 sleep 4;
115}
116
d846ade3 117package MY;
118
119use Config;
120
121sub const_cccmd {
122 my $ret = shift->SUPER::const_cccmd(@_);
123 return q{} unless $ret;
124
125 if ($Config{cc} =~ /^cl\b/i) {
126 warn 'you are using MSVC... my condolences.';
127 $ret .= ' /Fo$@';
128 }
129 else {
130 $ret .= ' -o $@';
131 }
132
133 return $ret;
134}