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