-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.PL
364 lines (322 loc) · 10.5 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# -*- perl -*-
# Net::FTPServer A Perl FTP Server
# Copyright (C) 2000 Bibliotech Ltd., Unit 2-3, 50 Carnwath Road,
# London, SW6 3EG, United Kingdom.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use ExtUtils::MakeMaker;
# PREREQ_PM is crap! It doesn't enforce the prerequisites, and
# doesn't print an intelligible error message. Nor does it understand
# that some modules are optional, while others are absolutely
# required. Do our own prerequisite checking here. A lot of this
# code was borrowed from the Makefile.PL supplied with libwww-perl.
#
# NB. 'status' field is either 'required', for modules which are
# required, or anything else for modules which are optional.
# OS check
if( $^O eq 'MSWin32' ){
printf STDERR "No support for OS $^O.\n";
#This message should be exact: http://wiki.cpantesters.org/wiki/CPANAuthorNotes
exit 1;
}
my %modules
= (
'Archive::Zip' =>
{ status => "optional",
version => "0.11",
message =>
"Archive::Zip is missing. This module is required if you want to\n".
"enable archive mode, which allows users to create ZIP files on\n".
"the fly from directories on the server.\n"
},
'Authen::PAM' =>
{ status => "recommended",
version => "0.12",
message =>
"Authen::PAM is missing. This module is required in order to\n".
"perform user authentication against the full FTP server\n".
"personality on most Unix platforms. Therefore unless you install\n".
"this module, normal FTP server configurations will most likely\n".
"not work.\n"
},
'BSD::Resource' =>
{ status => "highly recommended",
message =>
"BSD::Resource is missing. This module is required in order to\n".
"place limits on the size of the FTP server process. Without this\n".
"module, the FTP server will still work, but it will be vulnerable\n".
"to certain sorts of denial of service (DoS) attacks.\n"
},
'Carp' => { status => "required" },
'Compress::Zlib' =>
{ status => "optional",
version => "1.14",
message =>
"Compress::Zlib is missing. This module is required if you want to\n".
"enable archive mode, which allows users to create ZIP files on\n".
"the fly from directories on the server.\n"
},
'DBI' =>
{ status => "optional",
message =>
"DBI is missing. if you want to run the FTP server against a\n".
"PostgreSQL database.\n"
},
'Digest::MD5' =>
{ status => "optional",
message =>
"Digest::MD5 is missing. This module is required in order for the\n".
"SITE CHECKSUM command to work.\n"
},
'DynaLoader' => { status => "required" },
'Fcntl' => { status => "required" },
'File::Sync' =>
{ status => "optional",
message =>
"File::Sync is missing. The SITE SYNC command will not work.\n"
},
'File::Temp' =>
{ status => "option",
message =>
"File::Temp is missing. This is required for the proxy server.\n"
},
'Getopt::Long' => { status => "required" },
'IO::Dir' => { status => "required", package => "IO" },
'IO::File' => { status => "required", package => "IO" },
'IO::Handle' => { status => "required", package => "IO" },
'IO::Scalar' => { status => "required", package => "IO-stringy",
version => "1.126" },
'IO::Seekable' => { status => "required" },
'IO::Select' => { status => "required", package => "IO" },
'IO::Socket' => { status => "required", package => "IO" },
'IPC::Open2' => { status => "required" },
'Net::FTP' =>
{ status => "optional",
message =>
"Net::FTP is missing. This is required for the proxy server.\n"
},
'POSIX' => { status => "required" },
'Socket' => { status => "required" },
'Sys::Hostname' => { status => "required" },
'Sys::Syslog' => { status => "required" },
'Test::More' => { status => "required" },
);
$| = 1;
# Check for modules.
my $missing_modules = 0;
my $missing_required_modules = 0;
foreach (sort keys %modules)
{
print "Checking for $modules{$_}{status} ";
print "module $_ ";
print ">= $modules{$_}{version} " if $modules{$_}{version};
print "... ";
my $eval = "require $_; ";
$eval .= "$_->VERSION >= $modules{$_}{version}" if $modules{$_}{version};
my $r = eval $eval;
if ($@ || !$r)
{
$missing_modules++;
$missing_required_modules++ if $modules{$_}{status} eq "required";
print "not found.\n\n";
if (exists $modules{$_}{package})
{
print
"This module is provided by the $modules{$_}{package} ",
"package.\n\n";
}
sleep 1 unless $ENV{NET_FTPSERVER_NO_SLEEP};
if (exists $modules{$_}{message})
{
print "*** ", $modules{$_}{message}, "\n";
sleep 5 unless $ENV{NET_FTPSERVER_NO_SLEEP};
}
}
else
{
print "ok.\n";
}
}
print "\n";
if ($missing_modules)
{
print <<EOT;
Obtain missing modules from CPAN [http://www.cpan.org/].
EOT
sleep 2 unless $ENV{NET_FTPSERVER_NO_SLEEP};
}
if ($missing_required_modules)
{
print <<EOT;
Required modules are missing. Install these first.
EOT
exit 1;
}
# The code has only been verified on versions of Perl >= than
# the following. If you find an earlier version of Perl on which
# Net::FTPServer runs, please tell me. - [email protected].
if ($] < 5.00405)
{
print <<EOT;
Perl version >= 5.00405 is required.
EOT
exit 1;
}
my @args = (
NAME => "Net::FTPServer",
VERSION_FROM => "lib/Net/FTPServer.pm",
# Install start-up scripts under /usr/sbin.
EXE_FILES => [ 'bin/dbeg1-ftpd.pl',
'bin/ftpd.pl',
'bin/inmem-ftpd.pl',
'bin/proxy-ftpd.pl',
'bin/ro-ftpd.pl' ],
INSTALLSCRIPT => $ExtUtils::MakeMaker::VERSION < 5.45 ?
'$(PREFIX)/sbin' : # No SITEPREFIX before Perl 5.6.0
'$(SITEPREFIX)/sbin',
dist =>
{
COMPRESS => 'gzip --force --best',
# PREOP => 'cp Net-FTPServer.spec $(DISTVNAME)',
},
clean =>
{
FILES => '*.bak *~',
},
realclean =>
{
# FILES => 'Net-FTPServer.spec',
},
depend =>
{
# dist => 'Net-FTPServer.spec',
#'Net-FTPServer.spec' => "lib/Net/FTPServer.pm",
#Makefile => "lib/Net/FTPServer.pm",
},
# Despite what I say about PREREQ_PM above, we need it to
# satisfy various automatic tools, eg. CPAN.
PREREQ_PM =>
{
'BSD::Resource' => '0',
'Carp' => '0',
'DynaLoader' => '0',
'Fcntl' => '0',
'Getopt::Long' => '0',
'IO::Dir' => '0',
'IO::File' => '0',
'IO::Handle' => '0',
'IO::Scalar' => 1.126,
'IO::Seekable' => '0',
'IO::Select' => '0',
'IO::Socket' => '0',
'IPC::Open2' => '0',
'POSIX' => '0',
'Socket' => '0',
'Sys::Hostname' => '0',
'Sys::Syslog' => '0',
},
BUILD_REQUIRES => {
'Test::More' => '0',
},
LICENSE => 'gpl',
MIN_PERL_VERSION => '5.005',
META_MERGE => {
resources => {
repository => 'https://github.com/ryochin/p5-net-ftpserver',
},
},
);
WriteMakefile1(@args);
sub WriteMakefile1 { #Compatibility code for old versions of EU::MM. Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade.
my %params=@_;
my $eumm_version=$ExtUtils::MakeMaker::VERSION;
$eumm_version=eval $eumm_version;
die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
die "License not specified" if not exists $params{LICENSE};
if ($params{AUTHOR} and ref($params{AUTHOR}) eq 'ARRAY' and $eumm_version < 6.58) {
$params{META_ADD}->{author}=$params{AUTHOR};
$params{AUTHOR}=join(', ',@{$params{AUTHOR}});
}
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
#EUMM 6.5502 has problems with BUILD_REQUIRES
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
delete $params{BUILD_REQUIRES};
}
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
delete $params{META_MERGE} if $eumm_version < 6.46;
delete $params{META_ADD} if $eumm_version < 6.46;
delete $params{LICENSE} if $eumm_version < 6.31;
delete $params{AUTHOR} if $] < 5.005;
delete $params{ABSTRACT_FROM} if $] < 5.005;
delete $params{BINARY_LOCATION} if $] < 5.005;
WriteMakefile(%params);
}
package MY;
sub processPL
{
my $self = shift;
my $block = $self->SUPER::processPL(@_);
# "Version:" in spec needs to match
# "$VERSION" from VERSION_FROM
$block =~ s%(spec.PL\s*)$%$1 \$\(VERSION_FROM\)%m;
$block;
}
sub libscan
{
my ($self, $path) = @_;
($path =~ /\~$/) ? undef : $path;
}
sub postamble
{
'
sysconfdir = $(DESTDIR)/etc
check-manifest:
@for d in `find -type d -name CVS`; \
do \
b=`dirname $$d`/; \
awk -F/ \'$$1 != "D" {print $$2}\' $$d/Entries | \
sed -e "s|^|$$b|" -e "s|^\./||"; \
done | sort > .check-manifest; \
sort MANIFEST > .orig-manifest; \
diff -u .orig-manifest .check-manifest; \
rm -f .orig-manifest .check-manifest
install ::
@if [ ! "${NOCONF}" ]; then \
if [ -w `dirname $(sysconfdir)` ]; then \
mkdir -p $(sysconfdir); \
if [ -w $(sysconfdir) ]; then \
if [ ! -f $(sysconfdir)/ftpd.conf ]; then \
install -c -m 0644 etc/ftpd.conf $(sysconfdir)/ftpd.conf; \
echo "Installing $(sysconfdir)/ftpd.conf"; \
else \
install -c -m 0644 etc/ftpd.conf $(sysconfdir)/ftpd.conf.dist; \
echo "Old configuration file $(sysconfdir)/ftpd.conf not overwritten."; \
echo "New configuration file installed as $(sysconfdir)/ftpd.conf.dist"; \
fi; \
fi; \
else \
echo "notice: ftpd.conf was not installed because you don\'t have write permission to $(sysconfdir)."; \
fi; \
fi
@echo
@echo "Net::FTPServer has been installed. Before proceeding please"
@echo "read the manual page. Type:"
@echo
@echo " man Net::FTPServer"
@echo
';
}
__END__