Update Makefile.PL
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
e8c583d3 1# for developpers:
2BEGIN{
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
08f7a8db 9use strict;
10use warnings;
c3398f5b 11use inc::Module::Install;
12
884bf37f 13# for co-developpers
ec7a9423 14use Module::Install::XSUtil 0.24;
d202164d 15use Module::Install::AuthorTests;
884bf37f 16
bd0fe31f 17system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
3f9d4c2b 18 or warn "Cannot generate Mouse::Tiny: $!";
19
c3398f5b 20name 'Mouse';
21all_from 'lib/Mouse.pm';
22
ec53d678 23# Scalar::Util < 1.14 has a bug.
24# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
25requires 'Scalar::Util' => 1.14;
272a1930 26
eb88905f 27test_requires 'Test::More' => 0.88;
da1d264b 28test_requires 'Test::Exception' => 0.29;
31c33930 29test_requires 'Test::Requires' => 0.03;
f1c70cbe 30# test_requires 'Test::Output' => 0.16; # too many dependencies!
31
92ff14d0 32if($] < 5.010) {
33 recommends 'Class::C3';
34}
179ac6cc 35
3310ddf2 36my %suggests = (
37 'Class::Method::Modifiers::Fast' => 0.041,
38 'MouseX::AttributeHelpers' => 0.06,
39);
40
41while(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
a1d1c5cc 54require 'lib/Mouse/Spec.pm'; # for the version
98f255c5 55
5e3cb4c0 56#if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
57# require Carp::Always; Carp::Always->import();
58# include_deps 'Carp::Always';
59#}
60
ec7a9423 61# cc_want deals with the '--pp' and '--xs' options
62my $use_xs = ($] >= 5.008_001 && want_xs());
0e81c55d 63
64if($use_xs){
7b92a82b 65 print "Mouse configured with XS.\n",
98f255c5 66 "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
bb543d7f 67
0e81c55d 68 cc_warnings();
fdee07cc 69 use_ppport(3.19);
0e81c55d 70 cc_src_paths('xs-src');
0e81c55d 71}
72else{
7b92a82b 73 print "Mouse configured with Pure Perl.\n";
0e81c55d 74}
75
125dc1a8 76
77tests 't/*.t t/*/*.t';
1e2f2888 78author_tests 'xt';
79
125dc1a8 80
81repository 'git://git.moose.perl.org/Mouse.git';
82
2462603a 83clean_files 'lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log';
125dc1a8 84
85
83eab7b3 86if (author_context()) {
121acb8a 87 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 88
64f61124 89 if (eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 90 print "You have Moose ", Moose->VERSION, ".\n";
64f61124 91 if (eval { require Module::Install::AuthorTests }) {
bd0fe31f 92 do 'tool/create-moose-compatibility-tests.pl';
1e2f2888 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;
314fe304 102 } else {
92ff14d0 103 print "You don't have a M::I::AuthorTests.\n";
314fe304 104 }
105 } else {
92ff14d0 106 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 107 }
4358792d 108
109 if($use_xs){
110 # repeat testing
111 # see also ExtUtils::MM_Any::test_via_harness()
1e2f2888 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";
4358792d 115
116 postamble qq{test_dynamic :: test_pp\n\n}
117 . qq{test_pp :: pure_all\n}
1e2f2888 118 . qq{\t} . $t_pp;
4358792d 119 }
314fe304 120}
121
1e2f2888 122
eb88905f 123WriteAll check_nmake => 0;