Compress-Raw-Zlib
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
OPTIMIZE => $OPTIMIZE,
LICENSE => 'perl',
ABSTRACT => 'Perl interface to zlib/zlib-ng compression libraries',
AUTHOR => 'Paul Marquess <pmqs@cpan.org>',
depend => { Makefile => 'config.in',
manifypods => 'READMEmd'
},
postamble => { name => 'Zlib' },
clean => { FILES => '*.c constants.h constants.xs' },
dist => { COMPRESS => 'gzip',
TARFLAGS => '-chvf',
SUFFIX => 'gz',
DIST_DEFAULT => 'MyTrebleCheck tardist',
},
(
$BUILD_ZLIB
? zlib_files($ZLIB_LIB)
: (LIBS => [ "$OPT_ZLIB_LIB -l$ZLIB_LIBRARY_NAME " ])
),
INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'),
META_MERGE => {
'meta-spec' => { version => 2 },
no_index => {
directory => [ 't', 'private' ],
},
resources => {
bugtracker => {
web => 'https://github.com/pmqs/Compress-Raw-Zlib/issues'
},
homepage => 'https://github.com/pmqs/Compress-Raw-Zlib',
repository => {
type => 'git',
url => 'git://github.com/pmqs/Compress-Raw-Zlib.git',
web => 'https://github.com/pmqs/Compress-Raw-Zlib',
},
},
},
) ;
delete $WriteMakefileArgs{LICENSE}
unless eval { ExtUtils::MakeMaker->VERSION(6.30) } ;
delete $WriteMakefileArgs{META_MERGE}
unless eval { ExtUtils::MakeMaker->VERSION(6.46) } ;
delete $WriteMakefileArgs{BUILD_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.55_03) } ;
WriteMakefile(%WriteMakefileArgs);
sub version_Macro
{
my $ver = shift ;
return [ "#if ZLIB_VERNUM >= 0x$ver\n", "#endif\n" ];
}
my @names = qw(
DEF_WBITS
MAX_MEM_LEVEL
MAX_WBITS
OS_CODE
Z_ASCII
Z_BEST_COMPRESSION
Z_BEST_SPEED
Z_BINARY
Z_BLOCK
Z_BUF_ERROR
Z_DATA_ERROR
Z_DEFAULT_COMPRESSION
Z_DEFAULT_STRATEGY
Z_DEFLATED
Z_ERRNO
Z_FILTERED
Z_FINISH
Z_FIXED
Z_FULL_FLUSH
Z_HUFFMAN_ONLY
Z_MEM_ERROR
Z_NEED_DICT
Z_NO_COMPRESSION
Z_NO_FLUSH
Z_OK
Z_PARTIAL_FLUSH
Z_RLE
Z_STREAM_END
Z_STREAM_ERROR
Z_SYNC_FLUSH
Z_UNKNOWN
Z_VERSION_ERROR
ZLIBNG_VERNUM
ZLIBNG_VER_MAJOR
ZLIBNG_VER_MINOR
ZLIBNG_VER_REVISION
ZLIBNG_VER_MODIFIED
);
my %verSpecificNames = (
Z_TREES => '1240',
);
if (eval {require ExtUtils::Constant; 1}) {
# Check the constants above all appear in @EXPORT in Zlib.pm
my %names = %verSpecificNames, map { $_, 1} @names, 'ZLIB_VERSION';
open F, "<lib/Compress/Raw/Zlib.pm" or die "Cannot open Zlib.pm: $!\n";
while (<F>)
{
last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
}
while (<F>)
{
last if /^\s*\)/ ;
/(\S+)/ ;
delete $names{$1} if defined $1 ;
}
close F ;
if ( keys %names )
{
my $missing = join ("\n\t", sort keys %names) ;
die "The following names are missing from \@EXPORT in Zlib.pm\n" .
"\t$missing\n" ;
}
push @names, { name => 'ZLIB_VERSION', type => 'PV' };
push @names, map { { name => $_,
macro => version_Macro $verSpecificNames{$_}
}
}
keys %verSpecificNames ;
push @names, { name => 'Z_NULL', type => 'UV' };
push @names, { name => 'ZLIBNG_VERSION', type => 'PV' };
ExtUtils::Constant::WriteConstants(
NAME => 'Zlib',
NAMES => \@names,
C_FILE => 'constants.h',
XS_FILE => 'constants.xs',
);
}
else {
foreach my $name (qw( constants.h constants.xs ))
{
my $from = catfile('fallback', $name);
copy ($from, $name)
or die "Can't copy $from to $name: $!";
}
}
sub getBoolean
{
my $name = shift ;
my $info = shift;
my $x = getConfigValue($name, $info);
return ($x =~ /^yes|on|true|1$/i) ? 1 : 0;
}
sub getConfigValue
{
my $name = shift ;
my $info = shift;
# Environment variable takes priority
my $x = defined $ENV{$name}
? $ENV{$name}
: $info->{$name} ;
return $x;
}
sub ParseCONFIG
{
my ($k, $v) ;
my @badkey = () ;
my %Info = () ;
my @Options = qw( ZLIB_INCLUDE ZLIB_LIB BUILD_ZLIB OLD_ZLIB GZIP_OS_CODE USE_ZLIB_NG) ;
my %ValidOption = map {$_, 1} @Options ;
my %Parsed = %ValidOption ;
my $CONFIG = 'config.in' ;
print "Parsing $CONFIG...\n" ;
( run in 0.812 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )