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