forked from libwww-perl/libwww-perl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.PL
122 lines (106 loc) · 3.13 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
#!perl -w
require 5.006;
use strict;
use ExtUtils::MakeMaker;
use Getopt::Long qw(GetOptions);
GetOptions(\my %opt,
'aliases',
'no-programs|n',
'live-tests',
) or do {
die "Usage: $0 [--aliases] [--no-programs] [--live-tests]\n";
};
my @prog;
push(@prog, qw(lwp-request lwp-mirror lwp-rget lwp-download lwp-dump))
unless $opt{'no-programs'} || grep /^LIB=/, @ARGV;
if ($opt{'aliases'} && grep(/lwp-request/, @prog)) {
require File::Copy;
for (qw(GET HEAD POST)) {
File::Copy::copy("bin/lwp-request", "bin/$_") || die "Can't copy bin/$_";
chmod(0755, "bin/$_");
push(@prog, $_);
}
}
system($^X, "talk-to-ourself");
flag_file("t/CAN_TALK_TO_OURSELF", $? == 0);
flag_file("t/live/ENABLED", $opt{'live-tests'});
WriteMakefile(
NAME => 'LWP',
DISTNAME => 'libwww-perl',
VERSION_FROM => 'lib/LWP.pm',
ABSTRACT => 'The World-Wide Web library for Perl',
AUTHOR => 'Gisle Aas <[email protected]>',
EXE_FILES => [ map "bin/$_", @prog ],
LICENSE => "perl",
MIN_PERL_VERSION => 5.006,
PREREQ_PM => {
'URI' => "1.10",
'MIME::Base64' => "2.1",
'Net::FTP' => "2.58",
'HTML::Tagset' => 0,
'HTML::Parser' => "3.33",
'Digest::MD5' => 0,
'Compress::Raw::Zlib' => 0,
'IO::Compress::Gzip' => 0,
'IO::Compress::Deflate' => 0,
'IO::Uncompress::Gunzip' => 0,
'IO::Uncompress::Inflate' => 0,
'IO::Uncompress::RawInflate' => 0,
},
META_MERGE => {
recommends => {
'Crypt::SSLeay' => 0,
},
resources => {
repository => 'http://github.com/gisle/libwww-perl',
MailingList => 'mailto:[email protected]',
}
},
clean => { FILES => join(" ", map "bin/$_", grep /^[A-Z]+$/, @prog) },
);
if($] >= 5.008 && !(eval { require Encode; defined(Encode::decode("UTF-8", "\xff")) })) {
warn "\nYou lack a working Encode module, and so you will miss out on\n".
"lots of character set goodness from LWP. However, your perl is\n".
"sufficiently recent to support it. It is recommended that you\n".
"install the latest Encode from CPAN.\n\n";
}
sub MY::test
{
q(
TEST_VERBOSE=0
test : pure_all
$(FULLPERL) t/TEST $(TEST_VERBOSE)
test_hudson : pure_all
$(FULLPERL) t/TEST $(TEST_VERBOSE) --formatter=TAP::Formatter::JUnit
);
}
sub flag_file {
my($file, $create) = @_;
if ($create) {
open(my $fh, ">", $file) || die "Can't create $file: $!";
}
else {
unlink($file);
}
}
BEGIN {
# compatibility with older versions of MakeMaker
my $developer = -f "NOTES.txt";
my %mm_req = (
LICENCE => 6.31,
META_MERGE => 6.45,
META_ADD => 6.45,
MIN_PERL_VERSION => 6.48,
);
undef(*WriteMakefile);
*WriteMakefile = sub {
my %arg = @_;
for (keys %mm_req) {
unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
warn "$_ $@" if $developer;
delete $arg{$_};
}
}
ExtUtils::MakeMaker::WriteMakefile(%arg);
};
}