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