|
Packit |
d03632 |
#! perl -w
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
use strict ;
|
|
Packit |
d03632 |
require 5.006 ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
use lib '.';
|
|
Packit |
d03632 |
use private::MakeUtil;
|
|
Packit |
d03632 |
use ExtUtils::MakeMaker 5.16 ;
|
|
Packit |
d03632 |
use ExtUtils::Install (); # only needed to check for version
|
|
Packit |
d03632 |
use Config;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my $ZLIB_LIB ;
|
|
Packit |
d03632 |
my $ZLIB_INCLUDE ;
|
|
Packit |
d03632 |
my $BUILD_ZLIB = 0 ;
|
|
Packit |
d03632 |
my $OLD_ZLIB = '' ;
|
|
Packit |
d03632 |
my $WALL = '' ;
|
|
Packit |
d03632 |
my $GZIP_OS_CODE = -1 ;
|
|
Packit |
d03632 |
my $USE_PPPORT_H = ($ENV{PERL_CORE}) ? '' : '-DUSE_PPPORT_H';
|
|
Packit |
d03632 |
my $OPTIMIZE = $Config{'optimize'};
|
|
Packit |
d03632 |
if ($Config{'gccversion'} and $OPTIMIZE =~ /-g (gdb)? 3/x) {
|
|
Packit |
d03632 |
$OPTIMIZE =~ s/-g(gdb)?3/-g/g; # [88936] out of memory with -g3 since 2.062
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# Windows uses a different name for the zlib library
|
|
Packit |
d03632 |
my $ZLIB_LIBRARY_NAME = $^O eq 'MSWin32' ? 'zlib' : 'z' ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
#$WALL = ' -pedantic ' if $Config{'cc'} =~ /gcc/ ;
|
|
Packit |
d03632 |
#$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# Ticket #18986 says that ExtUtils::Install 1.39 fixes the in-use issue
|
|
Packit |
d03632 |
# on win32/cygwin, so make the code below conditional on the version of
|
|
Packit |
d03632 |
# ExtUtils::Install.
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# Don't ask if MM_USE_DEFAULT is set -- enables perl core building on cygwin
|
|
Packit |
d03632 |
if ($^O =~ /cygwin/i and $ExtUtils::Install::VERSION < 1.39
|
|
Packit |
d03632 |
and not ($ENV{PERL_MM_USE_DEFAULT} or $ENV{PERL_CORE}))
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
print <
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
I see you are running Cygwin.
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
Please note that this module cannot be installed on Cygwin using the CPAN
|
|
Packit |
d03632 |
shell. The CPAN Shell uses Compress::Raw::Zlib internally and it is not
|
|
Packit |
d03632 |
possible to delete an active DLL.
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
If you are running the CPAN shell, please exit it and install this module
|
|
Packit |
d03632 |
by hand by running 'make install' under the directory
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
~/.cpan/build/Compress-Raw-Zlib-VERSION
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
EOM
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
print "Do you want to continue? [Y/N]: " ;
|
|
Packit |
d03632 |
my $answer = <STDIN> ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if ($answer =~ /^yes|y/i)
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
print "continuing...\n"
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
else
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
print "exiting...\n" ;
|
|
Packit |
d03632 |
exit 1 ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
ParseCONFIG() ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
UpDowngrade(getPerlFiles('MANIFEST'))
|
|
Packit |
d03632 |
unless $ENV{PERL_CORE};
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
WriteMakefile(
|
|
Packit |
d03632 |
NAME => 'Compress::Raw::Zlib',
|
|
Packit |
d03632 |
VERSION_FROM => 'lib/Compress/Raw/Zlib.pm',
|
|
Packit |
d03632 |
INC => "-I$ZLIB_INCLUDE" ,
|
|
Packit |
d03632 |
DEFINE => "-DNO_VIZ -DZ_SOLO $OLD_ZLIB $WALL -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" ,
|
|
Packit |
d03632 |
XS => { 'Zlib.xs' => 'Zlib.c'},
|
|
Packit |
d03632 |
'depend' => { 'Makefile' => 'config.in' },
|
|
Packit |
d03632 |
'clean' => { FILES => '*.c constants.h constants.xs' },
|
|
Packit |
d03632 |
'dist' => { COMPRESS => 'gzip',
|
|
Packit |
d03632 |
TARFLAGS => '-chvf',
|
|
Packit |
d03632 |
SUFFIX => 'gz',
|
|
Packit |
d03632 |
DIST_DEFAULT => 'MyTrebleCheck tardist',
|
|
Packit |
d03632 |
},
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
(
|
|
Packit |
d03632 |
$BUILD_ZLIB
|
|
Packit |
d03632 |
? zlib_files($ZLIB_LIB)
|
|
Packit |
d03632 |
: (LIBS => [ "-L$ZLIB_LIB -l$ZLIB_LIBRARY_NAME " ])
|
|
Packit |
d03632 |
),
|
|
Packit |
d03632 |
OPTIMIZE => $OPTIMIZE,
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'),
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
META_MERGE => {
|
|
Packit |
d03632 |
no_index => {
|
|
Packit |
d03632 |
directory => [ 't', 'private' ],
|
|
Packit |
d03632 |
},
|
|
Packit |
d03632 |
},
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
|
|
Packit |
d03632 |
('LICENSE' => 'perl') : ()),
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
) ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
sub version_Macro
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $ver = shift ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
return [ "#if ZLIB_VERNUM >= 0x$ver\n", "#endif\n" ];
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my @names = qw(
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
DEF_WBITS
|
|
Packit |
d03632 |
MAX_MEM_LEVEL
|
|
Packit |
d03632 |
MAX_WBITS
|
|
Packit |
d03632 |
OS_CODE
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
Z_ASCII
|
|
Packit |
d03632 |
Z_BEST_COMPRESSION
|
|
Packit |
d03632 |
Z_BEST_SPEED
|
|
Packit |
d03632 |
Z_BINARY
|
|
Packit |
d03632 |
Z_BLOCK
|
|
Packit |
d03632 |
Z_BUF_ERROR
|
|
Packit |
d03632 |
Z_DATA_ERROR
|
|
Packit |
d03632 |
Z_DEFAULT_COMPRESSION
|
|
Packit |
d03632 |
Z_DEFAULT_STRATEGY
|
|
Packit |
d03632 |
Z_DEFLATED
|
|
Packit |
d03632 |
Z_ERRNO
|
|
Packit |
d03632 |
Z_FILTERED
|
|
Packit |
d03632 |
Z_FINISH
|
|
Packit |
d03632 |
Z_FIXED
|
|
Packit |
d03632 |
Z_FULL_FLUSH
|
|
Packit |
d03632 |
Z_HUFFMAN_ONLY
|
|
Packit |
d03632 |
Z_MEM_ERROR
|
|
Packit |
d03632 |
Z_NEED_DICT
|
|
Packit |
d03632 |
Z_NO_COMPRESSION
|
|
Packit |
d03632 |
Z_NO_FLUSH
|
|
Packit |
d03632 |
Z_NULL
|
|
Packit |
d03632 |
Z_OK
|
|
Packit |
d03632 |
Z_PARTIAL_FLUSH
|
|
Packit |
d03632 |
Z_RLE
|
|
Packit |
d03632 |
Z_STREAM_END
|
|
Packit |
d03632 |
Z_STREAM_ERROR
|
|
Packit |
d03632 |
Z_SYNC_FLUSH
|
|
Packit |
d03632 |
Z_UNKNOWN
|
|
Packit |
d03632 |
Z_VERSION_ERROR
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
#ZLIB_VERNUM
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my %verSpecificNames = (
|
|
Packit |
d03632 |
Z_TREES => '1240',
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if (eval {require ExtUtils::Constant; 1}) {
|
|
Packit |
d03632 |
# Check the constants above all appear in @EXPORT in Zlib.pm
|
|
Packit |
d03632 |
my %names = %verSpecificNames, map { $_, 1} @names, 'ZLIB_VERSION';
|
|
Packit |
d03632 |
open F, "
|
|
Packit |
d03632 |
while (<F>)
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
while (<F>)
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
last if /^\s*\)/ ;
|
|
Packit |
d03632 |
/(\S+)/ ;
|
|
Packit |
d03632 |
delete $names{$1} if defined $1 ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
close F ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if ( keys %names )
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $missing = join ("\n\t", sort keys %names) ;
|
|
Packit |
d03632 |
die "The following names are missing from \@EXPORT in Zlib.pm\n" .
|
|
Packit |
d03632 |
"\t$missing\n" ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
push @names, { name => 'ZLIB_VERSION', type => 'PV' };
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
push @names, map { { name => $_,
|
|
Packit |
d03632 |
macro => version_Macro $verSpecificNames{$_}
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
keys %verSpecificNames ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
ExtUtils::Constant::WriteConstants(
|
|
Packit |
d03632 |
NAME => 'Zlib',
|
|
Packit |
d03632 |
NAMES => \@names,
|
|
Packit |
d03632 |
C_FILE => 'constants.h',
|
|
Packit |
d03632 |
XS_FILE => 'constants.xs',
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
else {
|
|
Packit |
d03632 |
foreach my $name (qw( constants.h constants.xs ))
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $from = catfile('fallback', $name);
|
|
Packit |
d03632 |
copy ($from, $name)
|
|
Packit |
d03632 |
or die "Can't copy $from to $name: $!";
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
sub ParseCONFIG
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my ($k, $v) ;
|
|
Packit |
d03632 |
my @badkey = () ;
|
|
Packit |
d03632 |
my %Info = () ;
|
|
Packit |
d03632 |
my @Options = qw( INCLUDE LIB BUILD_ZLIB OLD_ZLIB GZIP_OS_CODE ) ;
|
|
Packit |
d03632 |
my %ValidOption = map {$_, 1} @Options ;
|
|
Packit |
d03632 |
my %Parsed = %ValidOption ;
|
|
Packit |
d03632 |
my $CONFIG = 'config.in' ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
print "Parsing $CONFIG...\n" ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
open(F, "<$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
|
|
Packit |
d03632 |
while (<F>) {
|
|
Packit |
d03632 |
s/^\s*|\s*$//g ;
|
|
Packit |
d03632 |
next if /^\s*$/ or /^\s*#/ ;
|
|
Packit |
d03632 |
s/\s*#\s*$// ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
($k, $v) = split(/\s+=\s+/, $_, 2) ;
|
|
Packit |
d03632 |
$k = uc $k ;
|
|
Packit |
d03632 |
if ($ValidOption{$k}) {
|
|
Packit |
d03632 |
delete $Parsed{$k} ;
|
|
Packit |
d03632 |
$Info{$k} = $v ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
else {
|
|
Packit |
d03632 |
push(@badkey, $k) ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
close F ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
print "Unknown keys in $CONFIG ignored [@badkey]\n"
|
|
Packit |
d03632 |
if @badkey ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# check parsed values
|
|
Packit |
d03632 |
my @missing = () ;
|
|
Packit |
d03632 |
die "The following keys are missing from $CONFIG [@missing]\n"
|
|
Packit |
d03632 |
if @missing = keys %Parsed ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
$ZLIB_INCLUDE = defined $ENV{'ZLIB_INCLUDE'}
|
|
Packit |
d03632 |
? $ENV{'ZLIB_INCLUDE'}
|
|
Packit |
d03632 |
: $Info{'INCLUDE'} ;
|
|
Packit |
d03632 |
$ZLIB_LIB = defined $ENV{'ZLIB_LIB'}
|
|
Packit |
d03632 |
?$ENV{'ZLIB_LIB'}
|
|
Packit |
d03632 |
: $Info{'LIB'} ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if ($^O eq 'VMS') {
|
|
Packit |
d03632 |
$ZLIB_INCLUDE = VMS::Filespec::vmspath($ZLIB_INCLUDE);
|
|
Packit |
d03632 |
$ZLIB_LIB = VMS::Filespec::vmspath($ZLIB_LIB);
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my $y = defined $ENV{'OLD_ZLIB'}
|
|
Packit |
d03632 |
? $ENV{'OLD_ZLIB'}
|
|
Packit |
d03632 |
: $Info{'OLD_ZLIB'} ;
|
|
Packit |
d03632 |
$OLD_ZLIB = '-DOLD_ZLIB' if $y and $y =~ /^yes|on|true|1$/i;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my $x = defined $ENV{'BUILD_ZLIB'}
|
|
Packit |
d03632 |
? $ENV{'BUILD_ZLIB'}
|
|
Packit |
d03632 |
: $Info{'BUILD_ZLIB'} ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if ($x and $x =~ /^yes|on|true|1$/i ) {
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
$BUILD_ZLIB = 1 ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# ZLIB_LIB & ZLIB_INCLUDE must point to the same place when
|
|
Packit |
d03632 |
# BUILD_ZLIB is specified.
|
|
Packit |
d03632 |
die "INCLUDE & LIB must be the same when BUILD_ZLIB is True\n"
|
|
Packit |
d03632 |
if $ZLIB_LIB ne $ZLIB_INCLUDE ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# Check the zlib source directory exists
|
|
Packit |
d03632 |
die "LIB/INCLUDE directory '$ZLIB_LIB' does not exits\n"
|
|
Packit |
d03632 |
unless -d $ZLIB_LIB ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# check for a well known file
|
|
Packit |
d03632 |
die "LIB/INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib source files\n"
|
|
Packit |
d03632 |
unless -e catfile($ZLIB_LIB, 'zlib.h') ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# write the Makefile
|
|
Packit |
d03632 |
print "Building Zlib enabled\n" ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
$GZIP_OS_CODE = defined $ENV{'GZIP_OS_CODE'}
|
|
Packit |
d03632 |
? $ENV{'GZIP_OS_CODE'}
|
|
Packit |
d03632 |
: $Info{'GZIP_OS_CODE'} ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
die "GZIP_OS_CODE not 'AUTO_DETECT' or a number between 0 and 255\n"
|
|
Packit |
d03632 |
unless uc $GZIP_OS_CODE eq 'AUTO_DETECT'
|
|
Packit |
d03632 |
|| ( $GZIP_OS_CODE =~ /^(\d+)$/ && $1 >= 0 && $1 <= 255) ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if (uc $GZIP_OS_CODE eq 'AUTO_DETECT')
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
print "Auto Detect Gzip OS Code..\n" ;
|
|
Packit |
d03632 |
$GZIP_OS_CODE = getOSCode() ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my $name = getOSname($GZIP_OS_CODE);
|
|
Packit |
d03632 |
print "Setting Gzip OS Code to $GZIP_OS_CODE [$name]\n" ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
print <
|
|
Packit |
d03632 |
INCLUDE [$ZLIB_INCLUDE]
|
|
Packit |
d03632 |
LIB [$ZLIB_LIB]
|
|
Packit |
d03632 |
GZIP_OS_CODE [$GZIP_OS_CODE]
|
|
Packit |
d03632 |
OLD_ZLIB [$OLD_ZLIB]
|
|
Packit |
d03632 |
BUILD_ZLIB [$BUILD_ZLIB]
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
EOM
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
print "Looks Good.\n" ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
sub zlib_files
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $dir = shift ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my @h_files = ();
|
|
Packit |
d03632 |
my @c_files = ();
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
if (-f catfile($dir, "infback.c")) {
|
|
Packit |
d03632 |
# zlib 1.2.0 or greater
|
|
Packit |
d03632 |
#
|
|
Packit |
d03632 |
@h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h
|
|
Packit |
d03632 |
zutil.h deflate.h inffixed.h inftrees.h zconf.h
|
|
Packit |
d03632 |
zlib.h
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
@c_files = qw(adler32 crc32 infback inflate uncompr
|
|
Packit |
d03632 |
compress deflate inffast inftrees
|
|
Packit |
d03632 |
trees zutil
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
else {
|
|
Packit |
d03632 |
# zlib 1.1.x
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
@h_files = qw(deflate.h infcodes.h inftrees.h zconf.h zutil.h
|
|
Packit |
d03632 |
infblock.h inffast.h infutil.h zlib.h
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
@c_files = qw(adler32 compress crc32 uncompr
|
|
Packit |
d03632 |
deflate trees zutil inflate infblock
|
|
Packit |
d03632 |
inftrees infcodes infutil inffast
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
@h_files = map { catfile($dir, $_) } @h_files ;
|
|
Packit |
d03632 |
my @o_files = map { "$_\$(OBJ_EXT)" } 'Zlib', @c_files;
|
|
Packit |
d03632 |
@c_files = map { "$_.c" } 'Zlib', @c_files ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
foreach my $file (@c_files)
|
|
Packit |
d03632 |
{ copy(catfile($dir, $file), '.') }
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
return (
|
|
Packit |
d03632 |
#'H' => [ @h_files ],
|
|
Packit |
d03632 |
'C' => [ @c_files ] ,
|
|
Packit |
d03632 |
#'OBJECT' => qq[ @o_files ],
|
|
Packit |
d03632 |
'OBJECT' => q[ $(O_FILES) ],
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
) ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
use vars qw ( @GZIP_OS_Names %OSnames) ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
BEGIN
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
@GZIP_OS_Names = (
|
|
Packit |
d03632 |
[ '' => 0, 'MS-DOS' ],
|
|
Packit |
d03632 |
[ 'amigaos' => 1, 'Amiga' ],
|
|
Packit |
d03632 |
[ 'VMS' => 2, 'VMS' ],
|
|
Packit |
d03632 |
[ '' => 3, 'Unix/Default' ],
|
|
Packit |
d03632 |
[ '' => 4, 'VM/CMS' ],
|
|
Packit |
d03632 |
[ '' => 5, 'Atari TOS' ],
|
|
Packit |
d03632 |
[ 'os2' => 6, 'HPFS (OS/2, NT)' ],
|
|
Packit |
d03632 |
[ 'MacOS' => 7, 'Macintosh' ],
|
|
Packit |
d03632 |
[ '' => 8, 'Z-System' ],
|
|
Packit |
d03632 |
[ '' => 9, 'CP/M' ],
|
|
Packit |
d03632 |
[ '' => 10, 'TOPS-20' ],
|
|
Packit |
d03632 |
[ '' => 11, 'NTFS (NT)' ],
|
|
Packit |
d03632 |
[ '' => 12, 'SMS QDOS' ],
|
|
Packit |
d03632 |
[ '' => 13, 'Acorn RISCOS' ],
|
|
Packit |
d03632 |
[ 'MSWin32' => 14, 'VFAT file system (Win95, NT)' ],
|
|
Packit |
d03632 |
[ '' => 15, 'MVS' ],
|
|
Packit |
d03632 |
[ 'beos' => 16, 'BeOS' ],
|
|
Packit |
d03632 |
[ '' => 17, 'Tandem/NSK' ],
|
|
Packit |
d03632 |
[ '' => 18, 'THEOS' ],
|
|
Packit |
d03632 |
[ '' => 255, 'Unknown OS' ],
|
|
Packit |
d03632 |
);
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
%OSnames = map { $$_[1] => $$_[2] }
|
|
Packit |
d03632 |
@GZIP_OS_Names ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
sub getOSCode
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $default = 3 ; # Unix is the default
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
my $uname = $^O;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
for my $h (@GZIP_OS_Names)
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my ($pattern, $code, $name) = @$h;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
return $code
|
|
Packit |
d03632 |
if $pattern && $uname eq $pattern ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
return $default ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
sub getOSname
|
|
Packit |
d03632 |
{
|
|
Packit |
d03632 |
my $code = shift ;
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
return $OSnames{$code} || 'Unknown OS' ;
|
|
Packit |
d03632 |
}
|
|
Packit |
d03632 |
|
|
Packit |
d03632 |
# end of file Makefile.PL
|
|
Packit |
d03632 |
|