From 8e13abb3ff996e3736ada6b2c028cc6d496b817f Mon Sep 17 00:00:00 2001 From: Todd Rinaldo Date: Mon, 16 May 2022 02:04:31 +0000 Subject: [PATCH] Sync Compress-Raw-Zlib-2.105 into blead This commit synchs into blead versions 2.105 for CPAN distribution Compress-Raw-Zlib --- Porting/Maintainers.pl | 2 +- cpan/Compress-Raw-Zlib/Makefile.PL | 22 +++++- cpan/Compress-Raw-Zlib/Zlib.xs | 9 ++- .../lib/Compress/Raw/Zlib.pm | 2 +- cpan/Compress-Raw-Zlib/t/01version.t | 75 +++++++++++++++++++ cpan/Compress-Raw-Zlib/t/02zlib.t | 4 +- 6 files changed, 105 insertions(+), 9 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 44e2bf08bcea..1413ce02fc0a 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -216,7 +216,7 @@ package Maintainers; }, 'Compress::Raw::Zlib' => { - 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.104.tar.gz', + 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.105.tar.gz', 'FILES' => q[cpan/Compress-Raw-Zlib], 'EXCLUDED' => [ qr{^examples/}, diff --git a/cpan/Compress-Raw-Zlib/Makefile.PL b/cpan/Compress-Raw-Zlib/Makefile.PL index bce82e7adfce..bf3681babd80 100644 --- a/cpan/Compress-Raw-Zlib/Makefile.PL +++ b/cpan/Compress-Raw-Zlib/Makefile.PL @@ -71,11 +71,27 @@ ParseCONFIG() ; UpDowngrade(getPerlFiles('MANIFEST')) unless $ENV{PERL_CORE}; +my $OPT_Z_PREFIX = '-DZ_PREFIX' ; +my $OPT_ZLIB_INCLUDE = "-I$ZLIB_INCLUDE"; +my $OPT_ZLIB_LIB = "-L$ZLIB_LIB" ; + +if (! $BUILD_ZLIB) +{ + # When using the system supplied zlib, we don't want to use our bespoke prefix + $OPT_Z_PREFIX = ''; + + $OPT_ZLIB_INCLUDE = '' + if $ZLIB_INCLUDE eq './zlib-src' ; + + $OPT_ZLIB_LIB = '' + if $ZLIB_LIB eq './zlib-src' ; +} + WriteMakefile( NAME => 'Compress::Raw::Zlib', VERSION_FROM => 'lib/Compress/Raw/Zlib.pm', - INC => "-I$ZLIB_INCLUDE" , - DEFINE => "-DNO_VIZ -DZ_SOLO $OLD_ZLIB $WALL -DZ_PREFIX -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H" , + INC => $OPT_ZLIB_INCLUDE , + DEFINE => "-DNO_VIZ -DZ_SOLO $OLD_ZLIB $WALL $OPT_Z_PREFIX -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H -DPerl_crz_BUILD_ZLIB=$BUILD_ZLIB" , XS => { 'Zlib.xs' => 'Zlib.c'}, 'depend' => { 'Makefile' => 'config.in' }, 'clean' => { FILES => '*.c constants.h constants.xs' }, @@ -88,7 +104,7 @@ WriteMakefile( ( $BUILD_ZLIB ? zlib_files($ZLIB_LIB) - : (LIBS => [ "-L$ZLIB_LIB -l$ZLIB_LIBRARY_NAME " ]) + : (LIBS => [ "$OPT_ZLIB_LIB -l$ZLIB_LIBRARY_NAME " ]) ), OPTIMIZE => $OPTIMIZE, diff --git a/cpan/Compress-Raw-Zlib/Zlib.xs b/cpan/Compress-Raw-Zlib/Zlib.xs index 085078de65d6..cb7f0e0e1e57 100644 --- a/cpan/Compress-Raw-Zlib/Zlib.xs +++ b/cpan/Compress-Raw-Zlib/Zlib.xs @@ -760,6 +760,12 @@ BOOT: sv_setiv(os_code_sv, GZIP_OS_CODE) ; } + { + /* BUILD_ZLIB */ + SV * os_code_sv = perl_get_sv("Compress::Raw::Zlib::BUILD_ZLIB", GV_ADDMULTI) ; + sv_setiv(os_code_sv, Perl_crz_BUILD_ZLIB) ; + } + #define Zip_zlib_version() (const char*)zlib_version const char* @@ -1142,8 +1148,7 @@ deflate (s, buf, output) if (RETVAL != Z_STREAM_ERROR) { int done = increment - s->stream.avail_out ; printf("std DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL, - GetErrorString(RETVAL), s->stream.avail_in, -s->stream.avail_out, done); + GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out, done); } */ diff --git a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm index 5e2289e7f23a..004a541f75b8 100644 --- a/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm +++ b/cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm @@ -10,7 +10,7 @@ use warnings ; use bytes ; our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); -$VERSION = '2.104'; +$VERSION = '2.105'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/cpan/Compress-Raw-Zlib/t/01version.t b/cpan/Compress-Raw-Zlib/t/01version.t index a38a1e6b3b90..a6429f5d41aa 100644 --- a/cpan/Compress-Raw-Zlib/t/01version.t +++ b/cpan/Compress-Raw-Zlib/t/01version.t @@ -23,11 +23,86 @@ BEGIN use_ok('Compress::Raw::Zlib', 2) ; } +sub bit +{ + return 1 << $_[0]; +} + +{ + + my $zlib_h = ZLIB_VERSION ; + my $libz = Compress::Raw::Zlib::zlib_version; + my $ZLIB_VERNUM = sprintf ("0x%X", Compress::Raw::Zlib::ZLIB_VERNUM()) ; + my $flags = Compress::Raw::Zlib::zlibCompileFlags(); + + my %sizes = ( + 0 => '16 bit', + 1 => '32 bit', + 2 => '64 bit', + 3 => 'other' + ); + my $uIntSize = $sizes{ ($flags >> 0) & 0x3 }; + my $uLongSize = $sizes{ ($flags >> 2) & 0x3 }; + my $pointerSize = $sizes{ ($flags >> 4) & 0x3 }; + my $zOffSize = $sizes{ ($flags >> 6) & 0x3 }; + + my @compiler_options; + push @compiler_options, 'ZLIB_DEBUG' if $flags & bit(8) ; + push @compiler_options, 'ASM' if $flags & bit(9) ; + push @compiler_options, 'ZLIB_WINAPI' if $flags & bit(10) ; + push @compiler_options, 'None' unless @compiler_options; + my $compiler_options = join ", ", @compiler_options; + + my @one_time; + push @one_time, 'BUILDFIXED' if $flags & bit(12) ; + push @one_time, 'DYNAMIC_CRC_TABLE' if $flags & bit(13) ; + push @one_time, 'None' unless @one_time; + my $one_time = join ", ", @one_time; + + my @library; + push @library, 'NO_GZCOMPRESS' if $flags & bit(16) ; + push @library, 'NO_GZIP' if $flags & bit(17) ; + push @library, 'None' unless @library; + my $library = join ", ", @library; + + my @operational; + push @operational, 'PKZIP_BUG_WORKAROUND' if $flags & bit(20) ; + push @operational, 'FASTEST' if $flags & bit(21) ; + push @operational, 'None' unless @operational; + my $operational = join ", ", @operational; + + diag <= ZLIB_1_2_12_0 || Compress::Raw::Zlib::haveZlibNg()) + if (ZLIB_VERNUM >= ZLIB_1_2_12_0) { cmp_ok $status, '==', Z_STREAM_END ; } @@ -526,7 +526,7 @@ SKIP: $GOT = ''; $status = $k->inflate($rest, $GOT); # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib - if (ZLIB_VERNUM >= ZLIB_1_2_12_0 || Compress::Raw::Zlib::haveZlibNg()) + if (ZLIB_VERNUM >= ZLIB_1_2_12_0 ) { cmp_ok $status, '==', Z_STREAM_END ; }