Add ARM files
[dh-make-perl] / dev / arm / libwww-perl / libwww-perl-5.813 / Makefile.PL
1 # This -*- perl -*- script writes the Makefile for libwww-perl
2
3 require 5.005;
4 use strict;
5 use ExtUtils::MakeMaker qw(WriteMakefile prompt);
6 use Config qw(%Config);
7
8 #--- Configuration section ---
9
10 my @programs_to_install = qw(lwp-request lwp-mirror lwp-rget lwp-download);
11 my @request_aliases     = qw(GET HEAD POST);
12
13 #--- End Configuration - You should not have to change anything below this line
14
15
16 # Allow us to suppress all program installation with the -n (library only)
17 # option.  This is for those that don't want to mess with the configuration
18 # section of this file.
19 use Getopt::Std;
20 use vars qw($opt_n);
21 unless (getopts("n")) {
22     die "Usage: $0 [-n]\n";
23 }
24 @programs_to_install = () if $opt_n || grep /^LIB=/, @ARGV;
25
26 # Check if we should try to run tests that talk to ourself
27 system(qq("$^X" talk-to-ourself));
28 if ($?) {
29     print <<EOT;
30
31 You appear to have a misconfigured system, so I will disable tests
32 that try to talk HTTP to a local server.
33 EOT
34     unlink("t/CAN_TALK_TO_OURSELF");
35 }
36 else {
37     open(CAN_TALK_TO_OURSELF, ">t/CAN_TALK_TO_OURSELF") || die "Can't create CAN_TALK_TO_OURSELF: $!";
38     close(CAN_TALK_TO_OURSELF);
39 }
40
41 # Check if we should try to run the live tests
42 open(CHANGES, "Changes") || die "Can't open Changes: $!";
43 my $release_date;
44 while (<CHANGES>) {
45     if (/^(\d{4}-\d{2}-\d{2})\D/) {
46         $release_date = $1;
47         last;
48     }
49 }
50 close(CHANGES);
51 die "Can't figure out release date" unless $release_date;
52 #print "Release date: $release_date\n";
53
54 my $some_time_ago = sprintf "%04d-%02d-%02d",
55           sub { ($_[5]+1900, $_[4]+1, $_[3])}->(localtime(time - 45 * 24*60*60));
56 if ($some_time_ago lt $release_date) {
57     # Check if we have internet connection
58     require IO::Socket;
59     my $s = IO::Socket::INET->new(PeerAddr => "www.google.com:80",
60                                   Timeout  => 10,
61                                  );
62     if ($s) {
63         # XXX could try to send a GET to it???
64         close($s);
65
66         print <<EOT;
67
68 You appear to be directly connected to the Internet.  I have some tests
69 that tries to access some sites on the net to verify that the new HTTP/1.1
70 support works as it should.
71
72 EOT
73
74         if (prompt("Do you want to enable these tests?", "y") =~ /^y/i) {
75             open(ENABLED, ">t/live/ENABLED") || die "Can't enable: $!";
76             close(ENABLED);
77
78             # Figure out if the compress lib works and signal that with
79             # a file for the test suite to find.  We don't want the
80             # test script to do this 'require' itself because we want
81             # to test that the module loads it on demand as it should.
82             eval {
83                 require Compress::Zlib;
84                 Compress::Zlib->VERSION(1.10);
85                 open(ZLIB_OK, ">t/live/ZLIB_OK") || die "Can't create ZLIB_OK: $!";
86                 print ZLIB_OK "$Compress::Zlib::VERSION\n";
87                 close(ZLIB_OK);
88             };
89             if ($@) {
90                 #warn $@;
91                 unlink("t/live/ZLIB_OK");
92             }
93         }
94         else {
95             unlink("t/live/ENABLED");
96         }
97     }
98 }
99
100 if (@programs_to_install) {
101     print <<EOT;
102
103 This package comes with some sample programs that I can try
104 to install in $Config{installscript}.
105
106    Note that you can avoid these questions by passing
107    the '-n' option to 'Makefile.PL'.
108
109 EOT
110     my @tmp;
111     for (@programs_to_install) {
112         if (prompt("Do you want to install $_?", "y") =~ /^y/) {
113             push(@tmp, $_);
114         }
115     }
116     @programs_to_install = @tmp;
117 }
118
119 if (grep($_ eq 'lwp-request', @programs_to_install) && @request_aliases) {
120     print <<EOT;
121
122 The lwp-request program will use the name it is invoked with to
123 determine what HTTP method to use.  I can set up alias for the most
124 common HTTP methods.  These alias are also installed in
125 $Config{installscript}.
126
127 EOT
128     my @tmp;
129     for my $alias (@request_aliases) {
130         my $default = "n";
131         if (prompt("Do you want to install the $alias alias?", $default) =~ /^y/) {
132             push(@tmp, $alias);
133         }
134     }
135     @request_aliases = @tmp;
136 }
137 else {
138     @request_aliases = ();
139 }
140
141 # Check for non-standard modules that are used by this library.
142 $| = 1;
143 my $missing_modules = 0;
144
145 print "\nChecking for URI...........";
146 eval {
147     require URI;
148     URI->VERSION(1.10);
149 };
150 if ($@) {
151     print " failed\n";
152     $missing_modules++;
153     print <<EOT;
154 $@
155 The URI module must be installed.  WWW without URIs would not
156 be that great :-)
157
158 EOT
159     sleep(2);  # Don't hurry too much
160 }
161 else {
162     print " ok\n";
163 }
164 print "Checking for HTML::Parser..";
165 eval {
166     require HTML::HeadParser;
167     HTML::Parser->VERSION(3.33);
168 };
169 if ($@) {
170     print " failed\n";
171     $missing_modules++;
172     print <<EOT;
173 $@
174 The HTML::Parser is needed to extract correct base URI information from
175 HTML so that we can resolve relative links correctly.  The HTML::Form
176 module also needs HTML::TokeParser to work.
177
178 EOT
179     sleep(2);  # Don't hurry too much
180 }
181 else {
182     print " ok\n";
183 }
184
185 print "Checking for MIME::Base64..";
186 eval {
187     require MIME::Base64;
188     #MIME::Base64->VERSION('2.00');
189 };
190 if ($@) {
191     print " failed\n";
192     $missing_modules++;
193     print <<EOT;
194 $@
195 The Base64 encoding is used in authentication headers in HTTP.
196
197 EOT
198     sleep(2);  # Don't hurry too much
199 }
200 else {
201     print " ok\n";
202 }
203
204 print "Checking for Net::FTP......";
205 eval {
206     require Net::FTP;
207     Net::FTP->VERSION('2.58');
208 };
209 if ($@) {
210     print " failed\n";
211     $missing_modules++;
212     print <<EOT;
213 $@
214 The libwww-perl library normally use the Net::FTP module when
215 accessing ftp servers.  You would have to install this package or
216 configure your application to use a proxy server for making ftp
217 requests work.  Net::FTP is part of the 'libnet' distribution.
218
219 EOT
220     sleep(2);  # Don't hurry too much
221 }
222 else {
223     print " ok\n";
224 }
225
226 print "Checking for Digest::MD5 ..";
227 eval {
228     require Digest::MD5;
229 };
230 if ($@) {
231     print " failed\n";
232     $missing_modules++;
233     print <<EOT;
234 $@
235 The Digest::MD5 library is needed if you want to be able use the
236 experimental "Digest Access Authentication" scheme.  Since very few
237 servers implement this authentication scheme, you should normally not
238 worry too much about this.
239
240 EOT
241 }
242 else {
243     print " ok\n";
244 }
245
246 print <<EOT if $missing_modules;
247 The missing modules can be obtained from CPAN.  Visit
248 <URL:http://www.perl.com/CPAN/> to find a CPAN site near you.
249
250 EOT
251
252 print "\n";
253
254 if (@request_aliases) {
255     require File::Copy;
256     for (@request_aliases) {
257         File::Copy::copy("bin/lwp-request", "bin/$_") || die "Can't copy bin/$_";
258         chmod(0755, "bin/$_");
259         push(@programs_to_install, $_);
260     }
261 }
262
263
264 # Ok, now it is time to really generate the Makefile
265
266 WriteMakefile(
267    NAME          => 'LWP',
268    DISTNAME      => 'libwww-perl',
269    VERSION_FROM  => 'lib/LWP.pm',
270    EXE_FILES     => [ map "bin/$_", @programs_to_install ],
271    PREREQ_PM     => { 'URI'              => "1.10",
272                       'MIME::Base64'     => "2.1",
273                       'Net::FTP'         => "2.58",
274                       'HTML::Tagset'     => 0,
275                       'HTML::Parser'     => "3.33",
276                       'Digest::MD5'      => 0,
277                       'Compress::Zlib'   => "1.10",
278                      },
279    'clean'       => { FILES => join(" ", map "bin/$_", @request_aliases) },
280    'dist'        => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
281 );
282
283
284
285 package MY;
286
287 # What happens when we say 'make test'
288 sub test
289 {
290     q(
291 TEST_VERBOSE=0
292
293 test: all
294         $(FULLPERL) t/TEST $(TEST_VERBOSE)
295
296 );
297 }
298
299
300 # Determine things that should *not* be installed
301 sub libscan
302 {
303     my($self, $path) = @_;
304     return '' if $path =~ m/\.(pl|dtd|sgml)$/;
305     return '' if $path =~ m:\bCVS/:;
306     return '' if $path =~ m/~$/;
307     $path;
308 }
309
310 # Pass libwww-perl version number to pod2man
311 sub manifypods
312 {
313     my $self = shift;
314     my $ver = $self->{VERSION} || "";
315     local($_) = $self->SUPER::manifypods(@_);
316     s/pod2man\s*$/pod2man --release libwww-perl-$ver/m;
317     $_;
318 }