This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
/
Makefile.PL
116 lines (84 loc) · 2.28 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
# -*-perl-*-
# Makefile.PL for w3mir.
# Note that the file 'MANIFEST' is quite significant in this context
#
# Notes: Should unpack any tar.gz files in current directory and install
# them with identical arguments to Makefile.PL to this invocation.
# This is especially for making installation of w3mir easy
# by installing libwww-perl and mime-base64 for the user before
# installing w3mir. Cool eh? That would require some changes.
#
# - janl 18/4/1997
#
# 19/04/99 janl: Added 'clean' target on tip from Lupe Christoph
# and LWP max-version check to the LWP detection.
#
# First just write the Makefile
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'w3mir',
VERSION_FROM => 'w3mir.PL', # finds $VERSION
EXE_FILES => [ 'w3mir', 'w3mfix' ],
clean => { FILES => 'w3mir w3mfix' },
dist => { COMPRESS => 'gzip -f9', SUFFIX => 'gz' },
);
print "\n";
# Find value of INSTALLSITELIB
&read_makefile;
$islib = resolve_make_var('INSTALLSITELIB');
# Check for prerequisites
$| = 1;
my $missing_modules = 0;
# libwww-perl
print "Checking for libwww-perl:";
eval "use lib '$islib'; require LWP;";
if (!defined($LWP::VERSION)) {
print ' failed
libwww seems to be missing.
';
$missing_modules++;
sleep(2);
} elsif ($LWP::VERSION<5.08) {
print ' failed
libwww is version ',$LWP::VERSION,', I need version 5.08 or later
Please see the INSTALL file.
';
$missing_modules++;
sleep(2);
} else {
print " ok\n\n";
}
# MIME::Base64
print "Checking for MIME::Base64:";
eval "use lib '$islib'; require MIME::Base64;";
if (!defined(&MIME::Base64::encode)) {
print ' failed
MIME::Base64 seems to be missing.
';
$missing_modules++;
sleep(2);
} else {
print " ok\n\n";
}
print 'Please see the INSTALL file for instructions on how to get the
missing/too old modules.
' if $missing_modules;
sub resolve_make_var ($) {
my($var) = shift @_;
my($val) = $make{$var};
# print "Resolving: ",$var,"=",$val,"\n";
while ($val =~ s~\$\((\S+)\)~$make{$1}~g) {}
# print "Resolved: $var: $make{$var} -> $val\n";
$val;
}
sub read_makefile {
open(MAKEFILE, 'Makefile') ||
die "Could not open Makefile for reading: $!\n";
while (<MAKEFILE>) {
chomp;
next unless m/^([A-Z]+)\s*=\s*(\S+)$/;
$make{$1}=$2;
# print "Makevar: $1 = $2\n";
}
close(MAKEFILE)
}