Optimize coercion
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
08f7a8db 1use strict;
2use warnings;
c3398f5b 3use inc::Module::Install;
4
884bf37f 5# for co-developpers
3e073ebb 6use Module::Install::XSUtil 0.21;
884bf37f 7
bd0fe31f 8system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
3f9d4c2b 9 or warn "Cannot generate Mouse::Tiny: $!";
10
c3398f5b 11name 'Mouse';
12all_from 'lib/Mouse.pm';
13
ec53d678 14# Scalar::Util < 1.14 has a bug.
15# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
16requires 'Scalar::Util' => 1.14;
272a1930 17
eb88905f 18test_requires 'Test::More' => 0.88;
19test_requires 'Test::Exception' => 0.27;
f1c70cbe 20# test_requires 'Test::Output' => 0.16; # too many dependencies!
21
c6cb4ba0 22include_deps 'Test::Exception'; # work around 0.27_0x (its use of diehook might be wrong)
c3398f5b 23
92ff14d0 24if($] < 5.010) {
25 recommends 'Class::C3';
26}
179ac6cc 27
3310ddf2 28my %suggests = (
29 'Class::Method::Modifiers::Fast' => 0.041,
30 'MouseX::AttributeHelpers' => 0.06,
31);
32
33while(my($mod, $least) = each %suggests){
34 if(can_use($mod)){
35 if(!eval { $mod->VERSION($least) }){
36 my $ver = $mod->VERSION;
37 warn("\n",
38 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
39 " Please update $mod after installation of Mouse.\n",
40 "\n"
41 );
42 }
43 }
44}
45
a1d1c5cc 46require 'lib/Mouse/Spec.pm'; # for the version
98f255c5 47
5e3cb4c0 48#if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
49# require Carp::Always; Carp::Always->import();
50# include_deps 'Carp::Always';
51#}
52
fdee07cc 53# cc_available recognizes the '--pp' and '--xs' options
54my $use_xs = ($] >= 5.008_001 && cc_available());
0e81c55d 55
56if($use_xs){
7b92a82b 57 print "Mouse configured with XS.\n",
98f255c5 58 "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
bb543d7f 59
0e81c55d 60 cc_warnings();
fdee07cc 61 use_ppport(3.19);
0e81c55d 62 cc_src_paths('xs-src');
0e81c55d 63}
64else{
7b92a82b 65 print "Mouse configured with Pure Perl.\n";
0e81c55d 66}
67
125dc1a8 68
69tests 't/*.t t/*/*.t';
1e2f2888 70author_tests 'xt';
71
125dc1a8 72
73repository 'git://git.moose.perl.org/Mouse.git';
74
75clean_files 'lib/Mouse/Tiny.pm $(O_FILES)';
76
77
83eab7b3 78if (author_context()) {
121acb8a 79 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 80
64f61124 81 if (eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 82 print "You have Moose ", Moose->VERSION, ".\n";
64f61124 83 if (eval { require Module::Install::AuthorTests }) {
bd0fe31f 84 do 'tool/create-moose-compatibility-tests.pl';
1e2f2888 85 # repeat testing
86 # see also ExtUtils::MM_Any::test_via_harness()
87 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
88 .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
89 .q{ xt/compatibility/t/*/*.t } . "\n";
90
91 postamble qq{test_dynamic :: test_moose\n\n}
92 . qq{test_moose :: pure_all\n}
93 . qq{\t} . $t_moose;
314fe304 94 } else {
92ff14d0 95 print "You don't have a M::I::AuthorTests.\n";
314fe304 96 }
97 } else {
92ff14d0 98 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 99 }
4358792d 100
101 if($use_xs){
102 # repeat testing
103 # see also ExtUtils::MM_Any::test_via_harness()
1e2f2888 104 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
105 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
106 .q{ $(TEST_FILES)} . "\n";
4358792d 107
108 postamble qq{test_dynamic :: test_pp\n\n}
109 . qq{test_pp :: pure_all\n}
1e2f2888 110 . qq{\t} . $t_pp;
4358792d 111 }
314fe304 112}
113
1e2f2888 114
eb88905f 115WriteAll check_nmake => 0;