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