1 | # -*-perl-*-
|
---|
2 | # Makefile.PL for w3mir.
|
---|
3 | # Note that the file 'MANIFEST' is quite significant in this context
|
---|
4 | #
|
---|
5 | # Notes: Should unpack any tar.gz files in current directory and install
|
---|
6 | # them with identical arguments to Makefile.PL to this invocation.
|
---|
7 | # This is especially for making installation of w3mir easy
|
---|
8 | # by installing libwww-perl and mime-base64 for the user before
|
---|
9 | # installing w3mir. Cool eh? That would require some changes.
|
---|
10 | #
|
---|
11 | # - janl 18/4/1997
|
---|
12 | #
|
---|
13 | # 19/04/99 janl: Added 'clean' target on tip from Lupe Christoph
|
---|
14 | # and LWP max-version check to the LWP detection.
|
---|
15 | #
|
---|
16 |
|
---|
17 | # First just write the Makefile
|
---|
18 | use ExtUtils::MakeMaker;
|
---|
19 |
|
---|
20 | WriteMakefile(
|
---|
21 | NAME => 'w3mir',
|
---|
22 | VERSION_FROM => 'w3mir.PL', # finds $VERSION
|
---|
23 | EXE_FILES => [ 'w3mir', 'w3mfix' ],
|
---|
24 | clean => { FILES => 'w3mir w3mfix' },
|
---|
25 | dist => { COMPRESS => 'gzip -f9', SUFFIX => 'gz' },
|
---|
26 | );
|
---|
27 |
|
---|
28 | print "\n";
|
---|
29 |
|
---|
30 | # Find value of INSTALLSITELIB
|
---|
31 |
|
---|
32 | &read_makefile;
|
---|
33 | $islib = resolve_make_var('INSTALLSITELIB');
|
---|
34 |
|
---|
35 | # Check for prerequisites
|
---|
36 |
|
---|
37 | $| = 1;
|
---|
38 | my $missing_modules = 0;
|
---|
39 |
|
---|
40 | # libwww-perl
|
---|
41 | print "Checking for libwww-perl:";
|
---|
42 |
|
---|
43 | eval "use lib '$islib'; require LWP;";
|
---|
44 |
|
---|
45 | if (!defined($LWP::VERSION)) {
|
---|
46 | print ' failed
|
---|
47 |
|
---|
48 | libwww seems to be missing.
|
---|
49 |
|
---|
50 | ';
|
---|
51 | $missing_modules++;
|
---|
52 | sleep(2);
|
---|
53 | } elsif ($LWP::VERSION<5.08 or $LWP::VERSION>=5.40) {
|
---|
54 | print ' failed
|
---|
55 |
|
---|
56 | libwww is version ',$LWP::VERSION,', I need version 5.08 to 5.39.
|
---|
57 | Please see the INSTALL file.
|
---|
58 |
|
---|
59 | ';
|
---|
60 | $missing_modules++;
|
---|
61 | sleep(2);
|
---|
62 | } else {
|
---|
63 | print " ok\n\n";
|
---|
64 | }
|
---|
65 |
|
---|
66 | # MIME::Base64
|
---|
67 | print "Checking for MIME::Base64:";
|
---|
68 |
|
---|
69 | eval "use lib '$islib'; require MIME::Base64;";
|
---|
70 |
|
---|
71 | if (!defined(&MIME::Base64::encode)) {
|
---|
72 | print ' failed
|
---|
73 |
|
---|
74 | MIME::Base64 seems to be missing.
|
---|
75 |
|
---|
76 | ';
|
---|
77 | $missing_modules++;
|
---|
78 | sleep(2);
|
---|
79 | } else {
|
---|
80 | print " ok\n\n";
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | print 'Please see the INSTALL file for instructions on how to get the
|
---|
85 | missing/too old modules.
|
---|
86 |
|
---|
87 | ' if $missing_modules;
|
---|
88 |
|
---|
89 |
|
---|
90 | sub resolve_make_var ($) {
|
---|
91 |
|
---|
92 | my($var) = shift @_;
|
---|
93 | my($val) = $make{$var};
|
---|
94 |
|
---|
95 | # print "Resolving: ",$var,"=",$val,"\n";
|
---|
96 |
|
---|
97 | while ($val =~ s~\$\((\S+)\)~$make{$1}~g) {}
|
---|
98 | # print "Resolved: $var: $make{$var} -> $val\n";
|
---|
99 | $val;
|
---|
100 | }
|
---|
101 |
|
---|
102 |
|
---|
103 | sub read_makefile {
|
---|
104 |
|
---|
105 | open(MAKEFILE, 'Makefile') ||
|
---|
106 | die "Could not open Makefile for reading: $!\n";
|
---|
107 |
|
---|
108 | while (<MAKEFILE>) {
|
---|
109 | chomp;
|
---|
110 | next unless m/^([A-Z]+)\s*=\s*(\S+)$/;
|
---|
111 | $make{$1}=$2;
|
---|
112 | # print "Makevar: $1 = $2\n";
|
---|
113 | }
|
---|
114 |
|
---|
115 | close(MAKEFILE)
|
---|
116 | }
|
---|