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