Merge commit 'origin/master'
[libwww-perl-eserte.git] / Makefile.PL
blob08d734fddfb1cdf22521fd0ea5c5c87740e828cf
1 #!perl -w
3 require 5.006;
4 use strict;
5 use ExtUtils::MakeMaker qw(WriteMakefile);
6 use Getopt::Long qw(GetOptions);
8 GetOptions(\my %opt,
9    'aliases',
10    'no-programs|n',
11    'live-tests',
12 ) or do {
13     die "Usage: $0 [--aliases] [--no-programs] [--live-tests]\n";
16 my @prog;
17 push(@prog, qw(lwp-request lwp-mirror lwp-rget lwp-download))
18     unless $opt{'no-programs'} || grep /^LIB=/, @ARGV;
20 if ($opt{'aliases'} && grep(/lwp-request/, @prog)) {
21     require File::Copy;
22     for (qw(GET HEAD POST)) {
23         File::Copy::copy("bin/lwp-request", "bin/$_") || die "Can't copy bin/$_";
24         chmod(0755, "bin/$_");
25         push(@prog, $_);
26     }
29 system($^X, "talk-to-ourself");
30 flag_file("t/CAN_TALK_TO_OURSELF", $? == 0);
31 flag_file("t/live/ENABLED", $opt{'live-tests'});
33 WriteMakefile(
34     NAME => 'LWP',
35     DISTNAME => 'libwww-perl',
36     VERSION_FROM => 'lib/LWP.pm',
37     EXE_FILES => [ map "bin/$_", @prog ],
38     PREREQ_PM => {
39         'URI'            => "1.10",
40         'MIME::Base64'   => "2.1",
41         'Net::FTP'       => "2.58",
42         'HTML::Tagset'   => 0,
43         'HTML::Parser'   => "3.33",
44         'Digest::MD5'    => 0,
45         'Compress::Zlib' => "1.10",
46     },
47     clean => { FILES => join(" ", map "bin/$_", grep /^[A-Z]+$/, @prog) },
49 exit;
52 sub MY::test
54     q(
55 TEST_VERBOSE=0
57 test : pure_all
58         $(FULLPERL) t/TEST $(TEST_VERBOSE)
64 sub flag_file {
65     my($file, $create) = @_;
66     if ($create) {
67         open(my $fh, ">", $file) || die "Can't create $file: $!";
68     }
69     else {
70         unlink($file);
71     }