6
use ExtUtils::MakeMaker 5.16 ;
12
eval { require File::Spec::Functions ; File::Spec::Functions->import() } ;
15
*catfile = sub { return "$_[0]/$_[1]" }
19
require VMS::Filespec if $^O eq 'VMS';
25
my $EXTRA_DEFINE = '';
29
unless($ENV{PERL_CORE}) {
30
$ENV{PERL_CORE} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
33
# don't ask if MM_USE_DEFAULT is set -- enables perl core building on cygwin
34
if ($^O =~ /cygwin/i and not $ENV{PERL_MM_USE_DEFAULT} and not $ENV{PERL_CORE})
38
I see you are running Cygwin.
40
Please note that this module cannot be installed on Cygwin using the
41
CPAN shell. The CPAN Shell uses Compress::Zlib internally and it is not
42
possible to delete an active DLL.
44
If you are running the CPAN shell, please exit it and install this module
45
by hand by running 'make install' under the directory
47
~/.cpan/build/Compress-Zlib-VERSION
51
print "Do you want to continue? [Y/N]: " ;
52
my $answer = <STDIN> ;
54
if ($answer =~ /^yes|y/i)
56
print "continuing...\n"
60
print "exiting...\n" ;
69
my @files = ('Zlib.pm', glob("t/*.t"), grep(!/\.bak$/, glob("examples/*"))) ;
70
UpDowngrade(@files) unless $ENV{PERL_CORE} ;
73
NAME => 'Compress::Zlib',
74
VERSION_FROM => 'Zlib.pm',
75
INC => "-I$ZLIB_INCLUDE" ,
76
DEFINE => "$OLD_ZLIB $WALL $EXTRA_DEFINE" ,
77
XS => { 'Zlib.xs' => 'Zlib.c' },
78
'depend' => { 'Makefile' => 'config.in' },
79
'clean' => { FILES => '*.c constants.h constants.xs' },
80
'dist' => { COMPRESS => 'gzip',
82
DIST_DEFAULT => 'MyDoubleCheck Downgrade tardist',
85
? zlib_files($ZLIB_LIB)
86
: (LIBS => [ "-L$ZLIB_LIB -lz " ])
89
? (ABSTRACT_FROM => 'Zlib.pm',
90
AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
108
Z_DEFAULT_COMPRESSION
130
if (eval {require ExtUtils::Constant; 1}) {
131
# Check the constants above all appear in @EXPORT in Zlib.pm
132
my %names = map { $_, 1} @names, 'ZLIB_VERSION';
133
open F, "<Zlib.pm" or die "Cannot open Zlib.pm: $!\n";
136
last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
143
delete $names{$1} if defined $1 ;
149
my $missing = join ("\n\t", sort keys %names) ;
150
die "The following names are missing from \@EXPORT in Zlib.pm\n" .
154
push @names, {name => 'ZLIB_VERSION', type => 'PV' };
156
ExtUtils::Constant::WriteConstants(
159
C_FILE => 'constants.h',
160
XS_FILE => 'constants.xs',
165
copy ('fallback.h', 'constants.h')
166
or die "Can't copy fallback.h to constants.h: $!";
167
copy ('fallback.xs', 'constants.xs')
168
or die "Can't copy fallback.xs to constants.xs: $!";
177
if $path =~ /(~|\.bak|_bak)$/ ||
178
$path =~ /^\..*\.swp$/ ;
186
my $postamble = <<'EOM';
190
perl Makefile.PL -downgrade
193
@echo Checking config.in is setup for a release
194
@(grep '^LIB *= *./zlib' config.in && \
195
grep '^INCLUDE *= *./zlib' config.in && \
196
grep '^OLD_ZLIB *= *False' config.in && \
197
grep '^BUILD_ZLIB *= *True' config.in) >/dev/null || \
198
(echo config.in needs fixing ; exit 1)
199
@echo config.in is ok
202
@echo Checking for $$^W in files: '. "@files" . '
204
exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
205
\' ' . " @files || " . ' \
206
(echo found unexpected $$^W ; exit 1)
220
my @Options = qw( INCLUDE LIB BUILD_ZLIB OLD_ZLIB ) ;
221
my %ValidOption = map {$_, 1} @Options ;
222
my %Parsed = %ValidOption ;
223
my $CONFIG = 'config.in' ;
225
print "Parsing $CONFIG...\n" ;
227
open(F, "<$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
230
next if /^\s*$/ or /^\s*#/ ;
233
($k, $v) = split(/\s+=\s+/, $_, 2) ;
235
if ($ValidOption{$k}) {
245
print "Unknown keys in $CONFIG ignored [@badkey]\n"
248
# check parsed values
250
die "The following keys are missing from $CONFIG [@missing]\n"
251
if @missing = keys %Parsed ;
253
$ZLIB_INCLUDE = $ENV{'ZLIB_INCLUDE'} || $Info{'INCLUDE'} ;
254
$ZLIB_LIB = $ENV{'ZLIB_LIB'} || $Info{'LIB'} ;
257
$ZLIB_INCLUDE = VMS::Filespec::vmspath($ZLIB_INCLUDE);
258
$ZLIB_LIB = VMS::Filespec::vmspath($ZLIB_LIB);
261
$EXTRA_DEFINE = $ENV{EXTRA_DEFINE} if defined $ENV{EXTRA_DEFINE};
263
my $y = $ENV{'OLD_ZLIB'} || $Info{'OLD_ZLIB'} ;
264
$OLD_ZLIB = '-DOLD_ZLIB' if $y and $y =~ /^yes|on|true|1$/i;
266
my $x = $ENV{'BUILD_ZLIB'} || $Info{'BUILD_ZLIB'} ;
268
if ($x and $x =~ /^yes|on|true|1$/i ) {
272
# ZLIB_LIB & ZLIB_INCLUDE must point to the same place when
273
# BUILD_ZLIB is specified.
274
die "INCLUDE & LIB must be the same when BUILD_ZLIB is True\n"
275
if $ZLIB_LIB ne $ZLIB_INCLUDE ;
277
# Check the zlib source directory exists
278
die "LIB/INCLUDE directory '$ZLIB_LIB' does not exits\n"
279
unless -d $ZLIB_LIB ;
281
# check for a well known file
282
die "LIB/INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib source files\n"
283
unless -e catfile($ZLIB_LIB, 'zlib.h') ;
286
# check Makefile.zlib has been copied to ZLIB_LIB
287
#copy 'Makefile.zlib', catfile($ZLIB_LIB, 'Makefile.PL') ||
288
#die "Could not copy Makefile.zlib to " . catfile($ZLIB_LIB, 'Makefile.PL') . ": $!\n" ;
289
#print "Created a Makefile.PL for zlib\n" ;
292
print "Building Zlib enabled\n" ;
296
INCLUDE [$ZLIB_INCLUDE]
301
print "Looks Good.\n" ;
309
# our is stable from 5.6.0 onward
310
# warnings is stable from 5.6.1 onward
312
# Note: this code assumes that each statement it modifies is not
313
# split across multiple lines.
319
my $opt = shift @ARGV || '' ;
320
my $upgrade = ($opt =~ /^-upgrade/i);
321
my $downgrade = ($opt =~ /^-downgrade/i);
322
push @ARGV, $opt unless $downgrade || $upgrade;
325
# From: use|no warnings "blah"
326
# To: local ($^W) = 1; # use|no warnings "blah"
328
s/^(\s*)(no\s+warnings)/${1}local (\$^W) = 0; #$2/ ;
329
s/^(\s*)(use\s+warnings)/${1}local (\$^W) = 1; #$2/ ;
332
elsif ($] >= 5.006001 || $upgrade) {
333
# From: local ($^W) = 1; # use|no warnings "blah"
334
# To: use|no warnings "blah"
336
s/^(\s*)local\s*\(\$\^W\)\s*=\s*\d+\s*;\s*#\s*((no|use)\s+warnings.*)/$1$2/ ;
342
if ( /^(\s*)our\s+\(\s*([^)]+\s*)\)/ ) {
344
my $vars = join ' ', split /\s*,\s*/, $2;
345
$_ = "${indent}use vars qw($vars);\n";
349
elsif ($] >= 5.006000 || $upgrade) {
351
if ( /^(\s*)use\s+vars\s+qw\((.*?)\)/ ) {
353
my $vars = join ', ', split ' ', $2;
354
$_ = "${indent}our ($vars);\n";
359
if (! $our_sub && ! $warn_sub) {
360
warn "Up/Downgrade not needed.\n";
361
if ($upgrade || $downgrade)
368
{ doUpDown($our_sub, $warn_sub, $_) }
370
warn "Up/Downgrade complete.\n" ;
371
exit 0 if $upgrade || $downgrade;
379
my $warn_sub = shift;
381
local ($^I) = ($^O eq 'VMS') ? "_bak" : ".bak";
382
local (@ARGV) = shift;
386
print, last if /^__(END|DATA)__/ ;
388
&{ $our_sub }() if $our_sub ;
389
&{ $warn_sub }() if $warn_sub ;
407
if (-f catfile($dir, "infback.c")) {
408
# zlib 1.2.0 or greater
410
@h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h
411
zutil.h deflate.h inffixed.h inftrees.h zconf.h
414
@c_files = qw(adler32 crc32 infback inflate uncompr
415
compress deflate gzio inffast inftrees
422
@h_files = qw(deflate.h infcodes.h inftrees.h zconf.h zutil.h
423
infblock.h inffast.h infutil.h zlib.h
425
@c_files = qw(adler32 compress crc32 gzio uncompr
426
deflate trees zutil inflate infblock
427
inftrees infcodes infutil inffast
431
@h_files = map { catfile($dir, $_) } @h_files ;
432
my @o_files = map { "$_\$(OBJ_EXT)" } 'Zlib', @c_files;
433
@c_files = map { "$_.c" } 'Zlib', @c_files ;
435
foreach my $file (@c_files)
436
{ copy(catfile($dir, $file), '.') }
439
#'H' => [ @h_files ],
440
'C' => [ @c_files ] ,
441
#'OBJECT' => qq[ @o_files ],
442
'OBJECT' => q[ $(O_FILES) ],
449
# end of file Makefile.PL