Cleanup Makefile.PL
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
e8c583d3 1# for developpers:
2BEGIN{
3 if(grep{ $_ eq '--author' } @ARGV){
01f38ab1 4 print "$^X -S cpanm < author/requires.cpanm\n";
e8c583d3 5 system "$^X -S cpanm < author/requires.cpanm";
6 }
7}
8
08f7a8db 9use strict;
10use warnings;
37008311 11use inc::Module::Install 0.99;
c3398f5b 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;
179ac6cc 28
3310ddf2 29my %suggests = (
af1c2a64 30 'Any::Moose' => 0.10,
cabc9331 31 'Data::Util' => 0.55,
3310ddf2 32 'MouseX::AttributeHelpers' => 0.06,
33);
34
35while(my($mod, $least) = each %suggests){
36 if(can_use($mod)){
37 if(!eval { $mod->VERSION($least) }){
38 my $ver = $mod->VERSION;
39 warn("\n",
40 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
41 " Please update $mod after installation of Mouse.\n",
42 "\n"
43 );
44 }
45 }
46}
47
ec7a9423 48# cc_want deals with the '--pp' and '--xs' options
49my $use_xs = ($] >= 5.008_001 && want_xs());
0e81c55d 50
51if($use_xs){
7b92a82b 52 print "Mouse configured with XS.\n",
98f255c5 53 "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
bb543d7f 54
0e81c55d 55 cc_warnings();
fdee07cc 56 use_ppport(3.19);
0e81c55d 57 cc_src_paths('xs-src');
0e81c55d 58}
59else{
7b92a82b 60 print "Mouse configured with Pure Perl.\n";
0e81c55d 61}
62
125dc1a8 63
64tests 't/*.t t/*/*.t';
1e2f2888 65author_tests 'xt';
66
125dc1a8 67repository 'git://git.moose.perl.org/Mouse.git';
68
af1c2a64 69if ($Module::Install::AUTHOR) {
70 require 'lib/Mouse/Spec.pm'; # for the version
121acb8a 71 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 72
64f61124 73 if (eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 74 print "You have Moose ", Moose->VERSION, ".\n";
f47ebad0 75 if (eval { require Module::Install::AuthorTests }) {
76 do 'tool/create-moose-compatibility-tests.pl';
77 # repeat testing
78 # see also ExtUtils::MM_Any::test_via_harness()
79 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
80 .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
81 .q{ xt/compatibility/t/*/*.t } . "\n";
82
83 postamble qq{test_dynamic :: test_moose\n\n}
84 . qq{test_moose :: pure_all\n}
85 . qq{\t} . $t_moose;
86 } else {
87 print "You don't have a M::I::AuthorTests.\n";
88 }
314fe304 89 } else {
92ff14d0 90 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 91 }
4358792d 92
93 if($use_xs){
f47ebad0 94 # repeat testing
95 # see also ExtUtils::MM_Any::test_via_harness()
96 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
97 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
98 .q{ $(TEST_FILES)} . "\n";
99
100 postamble qq{test_dynamic :: test_pp\n\n}
101 . qq{test_pp :: pure_all\n}
102 . qq{\t} . $t_pp;
4358792d 103 }
314fe304 104}
105
af1c2a64 106clean_files q{
107 lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log
108 *.out
109 cover_db xs-src/*.gc{v,no,da}
110};
1e2f2888 111
eb88905f 112WriteAll check_nmake => 0;