17cdb7e3593e7d2ffdd1f0aa448b10ecc5a3e0dd
[gitmo/Mouse.git] / Makefile.PL
1 # for developpers:
2 BEGIN{
3     if(grep{ $_ eq '--author' } @ARGV){
4         print "^X -S cpanm < author/requires.cpanm\n";
5         system "$^X -S cpanm < author/requires.cpanm";
6     }
7 }
8
9 use strict;
10 use warnings;
11 use inc::Module::Install 0.99;
12
13 # for co-developpers
14 use Module::Install::XSUtil 0.24;
15 use Module::Install::AuthorTests;
16
17 system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
18     or warn "Cannot generate Mouse::Tiny: $!";
19
20 name     'Mouse';
21 all_from 'lib/Mouse.pm';
22
23 # Scalar::Util < 1.14 has a bug.
24 # > Fixed looks_like_number(undef) to return false for perl >= 5.009002
25 requires 'Scalar::Util' => 1.14;
26
27 test_requires 'Test::More'      => 0.88;
28 test_requires 'Test::Exception' => 0.29;
29 test_requires 'Test::Requires'  => 0.03;
30 # test_requires 'Test::Output'    => 0.16; # too many dependencies!
31
32 if($] < 5.010) {
33     recommends 'Class::C3';
34 }
35
36 my %suggests = (
37     'Data::Util'                     => 0.55,
38     'MouseX::AttributeHelpers'       => 0.06,
39 );
40
41 while(my($mod, $least) = each %suggests){
42     if(can_use($mod)){
43         if(!eval { $mod->VERSION($least) }){
44             my $ver = $mod->VERSION;
45             warn("\n",
46                 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
47                 "         Please update $mod after installation of Mouse.\n",
48                 "\n"
49             );
50         }
51     }
52 }
53
54 require 'lib/Mouse/Spec.pm'; # for the version
55
56 #if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
57 #    require Carp::Always; Carp::Always->import();
58 #    include_deps 'Carp::Always';
59 #}
60
61 # cc_want deals with the '--pp' and '--xs' options
62 my $use_xs = ($] >= 5.008_001 && want_xs());
63
64 if($use_xs){
65     print "Mouse configured with XS.\n",
66           "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
67
68     cc_warnings();
69     use_ppport(3.19);
70     cc_src_paths('xs-src');
71 }
72 else{
73     print "Mouse configured with Pure Perl.\n";
74 }
75
76
77 tests 't/*.t t/*/*.t';
78 author_tests 'xt';
79
80
81 repository 'git://git.moose.perl.org/Mouse.git';
82
83 clean_files 'lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log';
84
85
86 if (author_context()) {
87     my $require_version = Mouse::Spec->MooseVersion;
88
89     if (eval { require Moose; Moose->VERSION($require_version) }) {
90         print "You have Moose ", Moose->VERSION, ".\n";
91         if (eval { require Module::Install::AuthorTests }) {
92             do 'tool/create-moose-compatibility-tests.pl';
93             # repeat testing
94             # see also ExtUtils::MM_Any::test_via_harness()
95             my $t_moose =  q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
96                           .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
97                           .q{ xt/compatibility/t/*/*.t } . "\n";
98
99             postamble qq{test_dynamic :: test_moose\n\n}
100                     . qq{test_moose :: pure_all\n}
101                     . qq{\t} . $t_moose;
102         } else {
103             print "You don't have a M::I::AuthorTests.\n";
104         }
105     } else {
106         print "You don't have Moose $require_version. skipping moose compatibility test\n";
107     }
108
109     if($use_xs){
110         # repeat testing
111         # see also ExtUtils::MM_Any::test_via_harness()
112         my $t_pp =  q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
113                    .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
114                    .q{ $(TEST_FILES)} . "\n";
115
116         postamble qq{test_dynamic :: test_pp\n\n}
117                 . qq{test_pp :: pure_all\n}
118                 . qq{\t} . $t_pp;
119     }
120 }
121
122
123 WriteAll check_nmake => 0;