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