7 use ExtUtils::MakeMaker 5.16 ;
14 my $GZIP_OS_CODE = -1 ;
16 #$WALL = ' -pedantic ' if $Config{'cc'} =~ /gcc/ ;
17 #$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
19 # don't ask if MM_USE_DEFAULT is set -- enables perl core building on cygwin
20 if ($^O =~ /cygwin/i and not ($ENV{PERL_MM_USE_DEFAULT} or $ENV{PERL_CORE}))
24 I see you are running Cygwin.
26 Please note that this module cannot be installed on Cygwin using the
27 CPAN shell. The CPAN Shell uses Compress::Zlib internally and it is not
28 possible to delete an active DLL.
30 If you are running the CPAN shell, please exit it and install this module
31 by hand by running 'make install' under the directory
33 ~/.cpan/build/Compress-Raw-Zlib-VERSION
37 print "Do you want to continue? [Y/N]: " ;
38 my $answer = <STDIN> ;
40 if ($answer =~ /^yes|y/i)
42 print "continuing...\n"
46 print "exiting...\n" ;
55 UpDowngrade(getPerlFiles('MANIFEST'))
56 unless $ENV{PERL_CORE};
59 NAME => 'Compress::Raw::Zlib',
60 VERSION_FROM => 'lib/Compress/Raw/Zlib.pm',
61 INC => "-I$ZLIB_INCLUDE" ,
62 DEFINE => "$OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE" ,
63 XS => { 'Zlib.xs' => 'Zlib.c'},
64 'depend' => { 'Makefile' => 'config.in' },
65 'clean' => { FILES => '*.c constants.h constants.xs' },
66 'dist' => { COMPRESS => 'gzip',
69 DIST_DEFAULT => 'MyTrebleCheck tardist',
81 ? zlib_files($ZLIB_LIB)
82 : (LIBS => [ "-L$ZLIB_LIB -lz " ])
87 ? (ABSTRACT_FROM => 'lib/Compress/Raw/Zlib.pm',
88 AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
108 Z_DEFAULT_COMPRESSION
134 if (eval {require ExtUtils::Constant; 1}) {
135 # Check the constants above all appear in @EXPORT in Zlib.pm
136 my %names = map { $_, 1} @names, 'ZLIB_VERSION';
137 open F, "<lib/Compress/Raw/Zlib.pm" or die "Cannot open Zlib.pm: $!\n";
140 last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
147 delete $names{$1} if defined $1 ;
153 my $missing = join ("\n\t", sort keys %names) ;
154 die "The following names are missing from \@EXPORT in Zlib.pm\n" .
158 push @names, {name => 'ZLIB_VERSION', type => 'PV' };
160 ExtUtils::Constant::WriteConstants(
163 C_FILE => 'constants.h',
164 XS_FILE => 'constants.xs',
169 foreach my $name (qw( constants.h constants.xs ))
171 my $from = catfile('fallback', $name);
173 or die "Can't copy $from to $name: $!";
182 my @Options = qw( INCLUDE LIB BUILD_ZLIB OLD_ZLIB GZIP_OS_CODE ) ;
183 my %ValidOption = map {$_, 1} @Options ;
184 my %Parsed = %ValidOption ;
185 my $CONFIG = 'config.in' ;
187 print "Parsing $CONFIG...\n" ;
189 open(F, "<$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
192 next if /^\s*$/ or /^\s*#/ ;
195 ($k, $v) = split(/\s+=\s+/, $_, 2) ;
197 if ($ValidOption{$k}) {
207 print "Unknown keys in $CONFIG ignored [@badkey]\n"
210 # check parsed values
212 die "The following keys are missing from $CONFIG [@missing]\n"
213 if @missing = keys %Parsed ;
215 $ZLIB_INCLUDE = $ENV{'ZLIB_INCLUDE'} || $Info{'INCLUDE'} ;
216 $ZLIB_LIB = $ENV{'ZLIB_LIB'} || $Info{'LIB'} ;
219 $ZLIB_INCLUDE = VMS::Filespec::vmspath($ZLIB_INCLUDE);
220 $ZLIB_LIB = VMS::Filespec::vmspath($ZLIB_LIB);
223 my $y = $ENV{'OLD_ZLIB'} || $Info{'OLD_ZLIB'} ;
224 $OLD_ZLIB = '-DOLD_ZLIB' if $y and $y =~ /^yes|on|true|1$/i;
226 my $x = $ENV{'BUILD_ZLIB'} || $Info{'BUILD_ZLIB'} ;
228 if ($x and $x =~ /^yes|on|true|1$/i ) {
232 # ZLIB_LIB & ZLIB_INCLUDE must point to the same place when
233 # BUILD_ZLIB is specified.
234 die "INCLUDE & LIB must be the same when BUILD_ZLIB is True\n"
235 if $ZLIB_LIB ne $ZLIB_INCLUDE ;
237 # Check the zlib source directory exists
238 die "LIB/INCLUDE directory '$ZLIB_LIB' does not exits\n"
239 unless -d $ZLIB_LIB ;
241 # check for a well known file
242 die "LIB/INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib source files\n"
243 unless -e catfile($ZLIB_LIB, 'zlib.h') ;
247 print "Building Zlib enabled\n" ;
250 $GZIP_OS_CODE = defined $ENV{'GZIP_OS_CODE'}
251 ? $ENV{'GZIP_OS_CODE'}
252 : $Info{'GZIP_OS_CODE'} ;
254 die "GZIP_OS_CODE not 'AUTO_DETECT' or a number between 0 and 255\n"
255 unless uc $GZIP_OS_CODE eq 'AUTO_DETECT'
256 || ( $GZIP_OS_CODE =~ /^(\d+)$/ && $1 >= 0 && $1 <= 255) ;
258 if (uc $GZIP_OS_CODE eq 'AUTO_DETECT')
260 print "Auto Detect Gzip OS Code..\n" ;
261 $GZIP_OS_CODE = getOSCode() ;
264 my $name = getOSname($GZIP_OS_CODE);
265 print "Setting Gzip OS Code to $GZIP_OS_CODE [$name]\n" ;
268 INCLUDE [$ZLIB_INCLUDE]
270 GZIP_OS_CODE [$GZIP_OS_CODE]
272 BUILD_ZLIB [$BUILD_ZLIB]
276 print "Looks Good.\n" ;
289 if (-f catfile($dir, "infback.c")) {
290 # zlib 1.2.0 or greater
292 @h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h
293 zutil.h deflate.h inffixed.h inftrees.h zconf.h
296 @c_files = qw(adler32 crc32 infback inflate uncompr
297 compress deflate inffast inftrees
304 @h_files = qw(deflate.h infcodes.h inftrees.h zconf.h zutil.h
305 infblock.h inffast.h infutil.h zlib.h
307 @c_files = qw(adler32 compress crc32 uncompr
308 deflate trees zutil inflate infblock
309 inftrees infcodes infutil inffast
313 @h_files = map { catfile($dir, $_) } @h_files ;
314 my @o_files = map { "$_\$(OBJ_EXT)" } 'Zlib', @c_files;
315 @c_files = map { "$_.c" } 'Zlib', @c_files ;
317 foreach my $file (@c_files)
318 { copy(catfile($dir, $file), '.') }
321 #'H' => [ @h_files ],
322 'C' => [ @c_files ] ,
323 #'OBJECT' => qq[ @o_files ],
324 'OBJECT' => q[ $(O_FILES) ],
332 use vars qw ( @GZIP_OS_Names %OSnames) ;
337 [ '' => 0, 'MS-DOS' ],
338 [ 'amigaos' => 1, 'Amiga' ],
339 [ 'VMS' => 2, 'VMS' ],
340 [ '' => 3, 'Unix/Default' ],
341 [ '' => 4, 'VM/CMS' ],
342 [ '' => 5, 'Atari TOS' ],
343 [ 'os2' => 6, 'HPFS (OS/2, NT)' ],
344 [ 'MacOS' => 7, 'Macintosh' ],
345 [ '' => 8, 'Z-System' ],
347 [ '' => 10, 'TOPS-20' ],
348 [ '' => 11, 'NTFS (NT)' ],
349 [ '' => 12, 'SMS QDOS' ],
350 [ '' => 13, 'Acorn RISCOS' ],
351 [ 'MSWin32' => 14, 'VFAT file system (Win95, NT)' ],
353 [ 'beos' => 16, 'BeOS' ],
354 [ '' => 17, 'Tandem/NSK' ],
355 [ '' => 18, 'THEOS' ],
356 [ '' => 255, 'Unknown OS' ],
359 %OSnames = map { $$_[1] => $$_[2] }
365 my $default = 3 ; # Unix is the default
369 for my $h (@GZIP_OS_Names)
371 my ($pattern, $code, $name) = @$h;
374 if $pattern && $uname eq $pattern ;
384 return $OSnames{$code} || 'Unknown OS' ;
387 # end of file Makefile.PL