1 | # This -*- perl -*- script writes the Makefile for libwww-perl
|
---|
2 | # $Id: Makefile.PL 720 1999-10-19 03:17:57Z davidb $
|
---|
3 |
|
---|
4 | require 5.004;
|
---|
5 | use strict;
|
---|
6 |
|
---|
7 | #--- Configuration section ---
|
---|
8 |
|
---|
9 | my @programs_to_install = qw(lwp-request lwp-mirror lwp-rget lwp-download);
|
---|
10 | my @request_aliases = qw(GET HEAD POST);
|
---|
11 |
|
---|
12 | #--- End Configuration - You should not have to change anything below this line
|
---|
13 |
|
---|
14 |
|
---|
15 | # Allow us to suppress all program installation with the -n (library only)
|
---|
16 | # option. This is for those that don't want to mess with the configuration
|
---|
17 | # section of this file.
|
---|
18 | use Getopt::Std;
|
---|
19 | use vars qw($opt_n);
|
---|
20 | unless (getopts("n")) {
|
---|
21 | die "Usage: $0 [-n]\n";
|
---|
22 | }
|
---|
23 | @programs_to_install = () if $opt_n;
|
---|
24 |
|
---|
25 |
|
---|
26 | # Check for non-standard modules that are used by this library.
|
---|
27 | $| = 1;
|
---|
28 | my $missing_modules = 0;
|
---|
29 |
|
---|
30 | print "Checking for HTML::Parser..";
|
---|
31 | eval {
|
---|
32 | require HTML::HeadParser;
|
---|
33 | };
|
---|
34 | if ($@) {
|
---|
35 | print " failed\n";
|
---|
36 | $missing_modules++;
|
---|
37 | print <<EOT;
|
---|
38 | $@
|
---|
39 | The HTML::Parser is needed to extract correct <BASE> information from
|
---|
40 | HTML so that we can resolv relative links correctly.
|
---|
41 |
|
---|
42 | EOT
|
---|
43 | sleep(2); # Don't hurry too much
|
---|
44 | } else {
|
---|
45 | print " ok\n";
|
---|
46 | }
|
---|
47 |
|
---|
48 | print "Checking for MIME::Base64..";
|
---|
49 | eval {
|
---|
50 | require MIME::Base64;
|
---|
51 | #MIME::Base64->require_version('2.00');
|
---|
52 | };
|
---|
53 | if ($@) {
|
---|
54 | print " failed\n";
|
---|
55 | $missing_modules++;
|
---|
56 | print <<EOT;
|
---|
57 | $@
|
---|
58 | The Base64 encoding is used in authentication headers in HTTP.
|
---|
59 |
|
---|
60 | EOT
|
---|
61 | sleep(2); # Don't hurry too much
|
---|
62 | } else {
|
---|
63 | print " ok\n";
|
---|
64 | }
|
---|
65 |
|
---|
66 | print "Checking for Net::FTP......";
|
---|
67 | eval {
|
---|
68 | require Net::FTP;
|
---|
69 | Net::FTP->require_version('2.00');
|
---|
70 | };
|
---|
71 | if ($@) {
|
---|
72 | print " failed\n";
|
---|
73 | $missing_modules++;
|
---|
74 | print <<EOT;
|
---|
75 | $@
|
---|
76 | The libwww-perl library normally use the Net::FTP module when
|
---|
77 | accessing ftp servers. You would have to install this package or
|
---|
78 | configure your application to use a proxy server for making ftp
|
---|
79 | requests work. Net::FTP is part of the 'libnet' distribution.
|
---|
80 |
|
---|
81 | EOT
|
---|
82 | sleep(2); # Don't hurry too much
|
---|
83 | } else {
|
---|
84 | print " ok\n";
|
---|
85 | }
|
---|
86 |
|
---|
87 | print "Checking for MD5 ..........";
|
---|
88 | eval {
|
---|
89 | require MD5;
|
---|
90 | };
|
---|
91 | if ($@) {
|
---|
92 | print " failed\n";
|
---|
93 | $missing_modules++;
|
---|
94 | print <<EOT;
|
---|
95 | $@
|
---|
96 | The MD5 library is needed if you want to be able use the experimental
|
---|
97 | "Digest Access Authentication" scheme. Since very few servers
|
---|
98 | implement this authentication scheme, you should normally not worry
|
---|
99 | too much about this.
|
---|
100 |
|
---|
101 | EOT
|
---|
102 | } else {
|
---|
103 | print " ok\n";
|
---|
104 | }
|
---|
105 |
|
---|
106 | print <<EOT if $missing_modules;
|
---|
107 | The missing modules can be obtained from CPAN. Visit
|
---|
108 | <URL:http://www.perl.com/CPAN/> to find a CPAN site near you.
|
---|
109 |
|
---|
110 | EOT
|
---|
111 |
|
---|
112 |
|
---|
113 | # Ok, now it is time to really generate the Makefile
|
---|
114 | use ExtUtils::MakeMaker;
|
---|
115 |
|
---|
116 | WriteMakefile(
|
---|
117 | NAME => 'libwww-perl',
|
---|
118 | VERSION_FROM => 'lib/LWP.pm',
|
---|
119 | PL_FILES => { map {("bin/$_.PL" => "bin/$_")} @programs_to_install },
|
---|
120 | EXE_FILES => [ map {"bin/$_"} @programs_to_install ],
|
---|
121 | 'clean' => { FILES => '$(EXE_FILES)' },
|
---|
122 | 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
|
---|
123 | );
|
---|
124 |
|
---|
125 |
|
---|
126 |
|
---|
127 | package MY;
|
---|
128 |
|
---|
129 | sub postamble
|
---|
130 | {
|
---|
131 | my @m;
|
---|
132 | if (@request_aliases && grep($_ eq 'lwp-request', @programs_to_install)) {
|
---|
133 | push @m, "all ::\n";
|
---|
134 | if ($^O eq 'MSWin32') {
|
---|
135 | push @m, "\t\$(FULLPERL) -e \"use Config; chdir q[\$(INST_EXE)]; "
|
---|
136 | ."foreach (qw(@request_aliases)) { \" \\\n";
|
---|
137 | push @m, <<'EOT';
|
---|
138 | -e "unlink \"$$_\"; " \
|
---|
139 | -e "system(\"copy lwp-request $$_\") && die; }"
|
---|
140 | EOT
|
---|
141 | } else {
|
---|
142 | push @m, "\t\$(FULLPERL) -e 'use Config; chdir q{\$(INST_EXE)}; "
|
---|
143 | ."foreach (qw(@request_aliases)) {' \\\n";
|
---|
144 | push @m, <<'EOT';
|
---|
145 | -e 'unlink "$$_";' \
|
---|
146 | -e 'system("$$Config{\"lns\"} lwp-request $$_") && die; }'
|
---|
147 | EOT
|
---|
148 | }
|
---|
149 | }
|
---|
150 | join "", @m;
|
---|
151 | }
|
---|
152 |
|
---|
153 | # What happens when we say 'make test'
|
---|
154 | sub test
|
---|
155 | {
|
---|
156 | q(
|
---|
157 | TEST_VERBOSE=0
|
---|
158 |
|
---|
159 | test: all
|
---|
160 | $(FULLPERL) t/TEST $(TEST_VERBOSE)
|
---|
161 |
|
---|
162 | );
|
---|
163 | }
|
---|
164 |
|
---|
165 |
|
---|
166 | # Determine things that should *not* be installed
|
---|
167 | sub libscan
|
---|
168 | {
|
---|
169 | my($self, $path) = @_;
|
---|
170 | return '' if $path =~ m/.(pl|dtd|sgml)$/;
|
---|
171 | return '' if $path =~ m:\bCVS/:;
|
---|
172 | return '' if $path =~ m/~$/;
|
---|
173 | $path;
|
---|
174 | }
|
---|
175 |
|
---|
176 | # Pass libwww-perl version number to pod2man
|
---|
177 | sub manifypods
|
---|
178 | {
|
---|
179 | my $self = shift;
|
---|
180 | my $ver = $self->{VERSION} || "";
|
---|
181 | local($_) = $self->SUPER::manifypods(@_);
|
---|
182 | s/pod2man\s*$/pod2man --release libwww-perl-$ver/m;
|
---|
183 | $_;
|
---|
184 | }
|
---|