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