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