Switch to use_xshelper(), which is provided by M::I::XSUtil 0.30
[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;
533ed4d6 11use inc::Module::Install 1.00;
c3398f5b 12
884bf37f 13# for co-developpers
8e4a10a8 14use Module::Install::XSUtil 0.30;
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;
533ed4d6 28test_requires 'Test::Exception' => 0.29;
179ac6cc 29
3310ddf2 30my %suggests = (
af1c2a64 31 'Any::Moose' => 0.10,
8e4a10a8 32
3310ddf2 33 'MouseX::AttributeHelpers' => 0.06,
34);
3310ddf2 35while(my($mod, $least) = each %suggests){
6741954a 36 my $status = system $^X, '-e', <<"CHECK";
37if(eval q{ use $mod (); 1 }) {
38 if(eval q{ use $mod $least (); 1 }) {
c4f4f5e3 39 exit 0; # installd, and new enough
40 }
41 else {
42 exit 1; # installed, but too old
43 }
44}
45CHECK
46
47 if($status != 0){
48 my $ver = `$^X -e "use $mod (); print $mod->VERSION"`;
49 warn("\n",
50 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
51 " Please update $mod after installation of Mouse.\n",
52 "\n"
53 );
3310ddf2 54 }
55}
56
ec7a9423 57# cc_want deals with the '--pp' and '--xs' options
58my $use_xs = ($] >= 5.008_001 && want_xs());
0e81c55d 59
60if($use_xs){
7b92a82b 61 print "Mouse configured with XS.\n",
98f255c5 62 "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
bb543d7f 63
0e81c55d 64 cc_warnings();
fdee07cc 65 use_ppport(3.19);
8e4a10a8 66 use_xshelper();
0e81c55d 67 cc_src_paths('xs-src');
0e81c55d 68}
69else{
7b92a82b 70 print "Mouse configured with Pure Perl.\n";
0e81c55d 71}
72
125dc1a8 73
74tests 't/*.t t/*/*.t';
1e2f2888 75author_tests 'xt';
76
125dc1a8 77repository 'git://git.moose.perl.org/Mouse.git';
78
af1c2a64 79if ($Module::Install::AUTHOR) {
80 require 'lib/Mouse/Spec.pm'; # for the version
121acb8a 81 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 82
64f61124 83 if (eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 84 print "You have Moose ", Moose->VERSION, ".\n";
f47ebad0 85 if (eval { require Module::Install::AuthorTests }) {
86 do 'tool/create-moose-compatibility-tests.pl';
87 # repeat testing
88 # see also ExtUtils::MM_Any::test_via_harness()
89 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
90 .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
91 .q{ xt/compatibility/t/*/*.t } . "\n";
92
93 postamble qq{test_dynamic :: test_moose\n\n}
94 . qq{test_moose :: pure_all\n}
95 . qq{\t} . $t_moose;
96 } else {
97 print "You don't have a M::I::AuthorTests.\n";
98 }
314fe304 99 } else {
92ff14d0 100 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 101 }
4358792d 102
103 if($use_xs){
f47ebad0 104 # repeat testing
105 # see also ExtUtils::MM_Any::test_via_harness()
106 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
107 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
108 .q{ $(TEST_FILES)} . "\n";
109
110 postamble qq{test_dynamic :: test_pp\n\n}
111 . qq{test_pp :: pure_all\n}
112 . qq{\t} . $t_pp;
4358792d 113 }
314fe304 114}
115
af1c2a64 116clean_files q{
117 lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log
118 *.out
119 cover_db xs-src/*.gc{v,no,da}
120};
1e2f2888 121
eb88905f 122WriteAll check_nmake => 0;