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.'; |
d846ade3 |
15 | $ccflags .= ' -Wall' if -d '.svn' || -d '.git' || $ENV{MAINTAINER_MODE}; |
f125b31e |
16 | |
89dc39a9 |
17 | requires 'Carp'; |
18 | requires 'Devel::GlobalDestruction'; |
d065fbe6 |
19 | requires 'MRO::Compat' => '0.05'; |
20 | requires 'Scalar::Util' => '1.18'; |
21 | requires 'Sub::Name' => '0.04'; |
89dc39a9 |
22 | requires 'Task::Weaken'; |
23 | |
24 | test_requires 'File::Spec'; |
25 | test_requires 'Test::More' => '0.77'; |
4cd537dd |
26 | test_requires 'Test::Exception' => '0.27'; |
89dc39a9 |
27 | |
3fd3a2ab |
28 | extra_tests(); |
29 | |
89dc39a9 |
30 | makemaker_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 |
57 | postamble(<<'EOM'); |
58 | $(OBJECT) : mop.h |
59 | EOM |
60 | |
89dc39a9 |
61 | WriteAll(); |
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. |
66 | sub 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 | |
89 | EOF |
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 | |
104 | package MY; |
105 | |
106 | use Config; |
107 | |
108 | sub 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 | } |