Commit | Line | Data |
591a9381 |
1 | use strict; |
2 | use warnings; |
89dc39a9 |
3 | use inc::Module::Install; |
4 | use 5.008001; |
5 | |
89dc39a9 |
6 | name 'Class-MOP'; |
7 | perl_version '5.008001'; |
8 | all_from 'lib/Class/MOP.pm'; |
9 | license 'perl'; |
591a9381 |
10 | |
72bc0a47 |
11 | require Config; |
12 | my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.'; |
06e9254b |
13 | |
14 | if ( -d '.git' || $ENV{MAINTAINER_MODE} ) { |
15 | $ccflags .= ' -Wall -Wdeclaration-after-statement'; |
16 | } |
f125b31e |
17 | |
89dc39a9 |
18 | requires 'Carp'; |
4154c4d0 |
19 | requires 'Data::OptList'; |
89dc39a9 |
20 | requires 'Devel::GlobalDestruction'; |
50de028e |
21 | requires 'List::MoreUtils' => '0.12'; |
d065fbe6 |
22 | requires 'MRO::Compat' => '0.05'; |
2ea94f58 |
23 | requires 'Package::DeprecationManager' => '0.04'; |
407a4276 |
24 | requires 'Package::Stash'; |
d065fbe6 |
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'; |
6b951296 |
35 | add_metadata(x_authority => 'cpan:STEVAN'); |
8c463274 |
36 | |
3fd3a2ab |
37 | extra_tests(); |
38 | |
89dc39a9 |
39 | makemaker_args( CCFLAGS => $ccflags ); |
40 | |
d846ade3 |
41 | { |
42 | my (@clean, @OBJECT, %XS); |
43 | |
44 | for my $xs (<xs/*.xs>) { |
45 | (my $c = $xs) =~ s/\.xs$/.c/i; |
46 | (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i; |
47 | |
48 | $XS{$xs} = $c; |
49 | push @OBJECT, $o; |
50 | push @clean, $o; |
51 | } |
52 | |
53 | for my $c (<*.c>) { |
54 | (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i; |
55 | push @OBJECT, $o; |
56 | push @clean, $o; |
57 | } |
58 | |
59 | makemaker_args( |
60 | clean => { FILES => join(q{ }, @clean) }, |
61 | OBJECT => join (q{ }, @OBJECT), |
62 | XS => \%XS, |
63 | ); |
64 | } |
65 | |
8a9fe086 |
66 | postamble(<<'EOM'); |
67 | $(OBJECT) : mop.h |
68 | EOM |
69 | |
89dc39a9 |
70 | WriteAll(); |
71 | |
9b970254 |
72 | # Use the cpan-smolder-stable script in the Moose svn root to figure |
73 | # out what on CPAN will break with the latest Moose, then update this |
74 | # before a release. |
75 | sub check_conflicts { |
76 | my %conflicts = ( |
77 | 'Moose' => '1.04', |
78 | ); |
79 | |
80 | my $found = 0; |
81 | for my $mod ( sort keys %conflicts ) { |
82 | eval "require $mod"; |
83 | next if $@; |
84 | |
85 | my $installed = $mod->VERSION(); |
86 | if ( $installed le $conflicts{$mod} ) { |
87 | |
88 | print <<"EOF"; |
89 | |
90 | *** |
91 | This version of Class::MOP conflicts with the version of |
92 | $mod ($installed) you have installed. |
93 | |
94 | You will need to upgrade $mod after installing |
95 | this version of Class::MOP. |
96 | *** |
97 | |
98 | EOF |
99 | |
100 | $found = 1; |
101 | } |
102 | } |
103 | |
104 | return unless $found; |
105 | |
106 | # More or less copied from Module::Build |
107 | return if $ENV{PERL_MM_USE_DEFAULT}; |
108 | return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); |
109 | |
110 | sleep 4; |
111 | } |
112 | |
d846ade3 |
113 | package MY; |
114 | |
115 | use Config; |
116 | |
117 | sub const_cccmd { |
118 | my $ret = shift->SUPER::const_cccmd(@_); |
119 | return q{} unless $ret; |
120 | |
121 | if ($Config{cc} =~ /^cl\b/i) { |
122 | warn 'you are using MSVC... my condolences.'; |
123 | $ret .= ' /Fo$@'; |
124 | } |
125 | else { |
126 | $ret .= ' -o $@'; |
127 | } |
128 | |
129 | return $ret; |
130 | } |