forked from Test-More/test-more
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
142 lines (103 loc) · 3.33 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/perl -w
use 5.006;
use Config;
use ExtUtils::MakeMaker;
my $PACKAGE = 'Test::Simple';
($PACKAGE_FILE = $PACKAGE) =~ s|::|/|g;
my $LAST_API_CHANGE = 0.48;
my $LAST_THREAD_CHANGE = 0.48;
eval "require $PACKAGE";
my $PACKAGE_VERSION = ${$PACKAGE.'::VERSION'};
unless ($@) { # Make sure we did find the module.
if( $PACKAGE_VERSION < $LAST_API_CHANGE ) {
printf <<"CHANGE_WARN", $LAST_API_CHANGE;
NOTE: There have been API changes between this version and any older
than version %s! Please see the Changes file for details.
CHANGE_WARN
sleep 5;
}
if( $] >= 5.008001 && $Config{useithreads} &&
$PACKAGE_VERSION < $LAST_THREAD_CHANGE
)
{
printf <<"THREAD_WARN", $LAST_THREAD_CHANGE;
NOTE: The behavior of Test::More and threads has changed between this
version and any older than version %s! Please see the Changes file
for details.
THREAD_WARN
sleep 5;
}
}
my $mm_ver = $ExtUtils::MakeMaker::VERSION;
if ($mm_ver =~ /_/) { # dev version
$mm_ver = eval $mm_ver;
die $@ if $@;
}
# Windows does not expand *.t and MakeMaker only started working around
# that for TESTS in 6.27. This does not introduce a circular dep
# because MakeMaker ships with its own Test::More.
my %Prereqs;
$Prereqs{'ExtUtils::MakeMaker'} = 6.27 if $^O eq 'MSWin32';
WriteMakefile(
NAME => $PACKAGE,
VERSION_FROM => "lib/$PACKAGE_FILE.pm",
ABSTRACT_FROM => "lib/$PACKAGE_FILE.pm",
AUTHOR => 'Michael G Schwern <[email protected]>',
($mm_ver >= 6.31 ? (LICENSE => 'perl') : ()),
PREREQ_PM => {
Test::Harness => 2.03,
%Prereqs
},
# Added to the core in 5.7.3 and also 5.6.2.
INSTALLDIRS => $] >= 5.006002 ? 'perl' : 'site',
test => {
TESTS => 't/*.t t/*/*.t',
},
($mm_ver < 6.48 ? () : (MIN_PERL_VERSION => 5.006)),
($mm_ver < 6.46 ? () : (META_MERGE => {
resources => {
license => 'http://dev.perl.org/licenses/',
homepage => 'http://test-more.googlecode.com',
bugtracker => 'http://github.com/schwern/test-more/issues',
repository => 'http://github.com/schwern/test-more/tree/master',
MailingList => 'http://groups.google.com/group/test-more-users',
},
}))
);
{
package MY;
sub postamble {
return <<'MAKE';
perltidy:
find . -name '*.pm' | xargs perltidy -b
find . -name '*.pm.bak' | xargs rm
MAKE
}
# Test with multiple versions of perl before releasing
sub dist_test {
my $self = shift;
my $make = $self->SUPER::dist_test(@_);
return $make unless $ENV{AUTHOR_TESTING} and $ENV{AUTHOR_TESTING} eq 'MSCHWERN';
# Strip off all the whitespace at the end, we'll put our own in.
$make =~ s{\s+\z}{\n};
my @perls = qw(
perl5.12.1
perl5.10.1
perl5.8.9
perl5.6.2
);
for my $perl (@perls) {
$make .= sprintf <<'END', $perl;
cd $(DISTVNAME) && $(MAKE) clean && %s Makefile.PL && PERL_RELEASING=0 $(MAKE) test $(PASTHRU)
END
}
# Rebuild so subsequent make commands work
$make .= <<'END';
$(MAKE) realclean
$(FULLPERLRUN) Makefile.PL
$(MAKE)
END
$make .= "\n";
return $make;
}
}