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