Skip to content

Commit

Permalink
cpan/Compress-Raw-Zlib - Update to version 2.208
Browse files Browse the repository at this point in the history
  2.208 18 February 2024

      * #30 Fix for READMEmd target
        Mon Feb 19 09:09:05 2024 +0000
        6945e13819aa525ab1e5d61362e171011aae9e7b
  • Loading branch information
pmqs authored and jkeenan committed Feb 26, 2024
1 parent ba0cc60 commit fd0a86c
Show file tree
Hide file tree
Showing 26 changed files with 1,151 additions and 1,443 deletions.
3 changes: 2 additions & 1 deletion Porting/Maintainers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ package Maintainers;
},

'Compress::Raw::Zlib' => {
'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.206.tar.gz',
'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.208.tar.gz',
'SYNCINFO' => 'jkeenan on Sun Feb 25 20:07:03 2024',
'SYNCINFO' => 'yorton on Tue Jul 25 20:37:04 2023',
'FILES' => q[cpan/Compress-Raw-Zlib],
'EXCLUDED' => [
Expand Down
187 changes: 96 additions & 91 deletions cpan/Compress-Raw-Zlib/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ if ($Config{'gccversion'} and $OPTIMIZE =~ /-g (gdb)? 3/x) {
# Windows uses a different name for the zlib library
my $ZLIB_LIBRARY_NAME = $^O eq 'MSWin32' ? 'zlib' : 'z' ;

#$WALL = ' -pedantic ' if $Config{'cc'} =~ /gcc/ ;
#$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;

# Ticket #18986 says that ExtUtils::Install 1.39 fixes the in-use issue
# on win32/cygwin, so make the code below conditional on the version of
# ExtUtils::Install.
Expand Down Expand Up @@ -56,15 +53,14 @@ EOM

if ($answer =~ /^yes|y/i)
{
print "continuing...\n"
print "continuing...\n"
}
else
{
print "exiting...\n" ;
exit 1 ;
print "exiting...\n" ;
exit 1 ;
}


}

ParseCONFIG() ;
Expand All @@ -78,9 +74,12 @@ my $OPT_ZLIB_LIB = "-L$ZLIB_LIB" ;
my $OPT_SOLO = '-DZ_SOLO';
my $OPT_USE_ZLIB_NG = "";

if (! $BUILD_ZLIB)
# For C++ only
my $OPT_CXX_DEFINES = '-Dregister=' ; # for https://github.com/pmqs/Compress-Raw-Zlib/issues/23

if (!$BUILD_ZLIB)
{
# When using the system supplied zlib, we don't want to use our bespoke prefix
# When using the system supplied zlib, we don't want to use our bespoke prefix
$OPT_Z_PREFIX = '';

$OPT_ZLIB_INCLUDE = ''
Expand All @@ -98,15 +97,23 @@ if ( $USE_ZLIB_NG)
$ZLIB_LIBRARY_NAME = $^O eq 'MSWin32' ? 'zlib-ng' : 'z-ng' ;
}

WriteMakefile(
my %WriteMakefileArgs = (

NAME => 'Compress::Raw::Zlib',
VERSION_FROM => 'lib/Compress/Raw/Zlib.pm',
INC => $OPT_ZLIB_INCLUDE ,
DEFINE => "-DNO_VIZ $OPT_SOLO $OLD_ZLIB $WALL $OPT_Z_PREFIX $OPT_USE_ZLIB_NG -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H -DPerl_crz_BUILD_ZLIB=$BUILD_ZLIB" ,
DEFINE => "-DNO_VIZ $OPT_SOLO $OLD_ZLIB $WALL $OPT_Z_PREFIX $OPT_USE_ZLIB_NG -DGZIP_OS_CODE=$GZIP_OS_CODE $USE_PPPORT_H -DPerl_crz_BUILD_ZLIB=$BUILD_ZLIB $OPT_CXX_DEFINES" ,
XS => { 'Zlib.xs' => 'Zlib.c'},
'depend' => { 'Makefile' => 'config.in' },
'clean' => { FILES => '*.c constants.h constants.xs' },
'dist' => { COMPRESS => 'gzip',
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',
Expand All @@ -117,14 +124,12 @@ WriteMakefile(
? zlib_files($ZLIB_LIB)
: (LIBS => [ "$OPT_ZLIB_LIB -l$ZLIB_LIBRARY_NAME " ])
),
OPTIMIZE => $OPTIMIZE,

INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'),
INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'),

( eval { ExtUtils::MakeMaker->VERSION(6.46) }
? ( META_MERGE => {
META_MERGE => {

"meta-spec" => { version => 2 },
'meta-spec' => { version => 2 },

no_index => {
directory => [ 't', 'private' ],
Expand All @@ -144,16 +149,21 @@ WriteMakefile(
web => 'https://github.com/pmqs/Compress-Raw-Zlib',
},
},
}
)
: ()
),

((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
('LICENSE' => 'perl') : ()),
},

) ;

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 ;
Expand Down Expand Up @@ -266,19 +276,30 @@ 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 =~ /^yes|on|true|1$/i) ? 1 : 0;
return $x;
}

sub ParseCONFIG
{
my ($k, $v) ;
my @badkey = () ;
my %Info = () ;
my @Options = qw( INCLUDE LIB BUILD_ZLIB OLD_ZLIB GZIP_OS_CODE USE_ZLIB_NG) ;
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' ;
Expand All @@ -287,84 +308,72 @@ sub ParseCONFIG

open(F, "<$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
while (<F>) {
s/^\s*|\s*$//g ;
next if /^\s*$/ or /^\s*#/ ;
s/\s*#\s*$// ;

($k, $v) = split(/\s+=\s+/, $_, 2) ;
$k = uc $k ;
if ($ValidOption{$k}) {
delete $Parsed{$k} ;
$Info{$k} = $v ;
}
else {
push(@badkey, $k) ;
}
s/^\s*|\s*$//g ;
next if /^\s*$/ or /^\s*#/ ;
s/\s*#\s*$// ;

($k, $v) = split(/\s+=\s+/, $_, 2) ;
$k = uc $k ;
if ($ValidOption{$k}) {
delete $Parsed{$k} ;
$Info{$k} = $v ;
}
else {
push(@badkey, $k) ;
}
}
close F ;

print "Unknown keys in $CONFIG ignored [@badkey]\n"
if @badkey ;
if @badkey ;

# check parsed values
my @missing = () ;
die "The following keys are missing from $CONFIG [@missing]\n"
if @missing = keys %Parsed ;

$ZLIB_INCLUDE = defined $ENV{'ZLIB_INCLUDE'}
? $ENV{'ZLIB_INCLUDE'}
: $Info{'INCLUDE'} ;

$ZLIB_LIB = defined $ENV{'ZLIB_LIB'}
?$ENV{'ZLIB_LIB'}
: $Info{'LIB'} ;
$ZLIB_INCLUDE = getConfigValue('ZLIB_INCLUDE', \%Info);
$ZLIB_LIB = getConfigValue('ZLIB_LIB', \%Info);
$GZIP_OS_CODE = getConfigValue('GZIP_OS_CODE', \%Info);

$USE_ZLIB_NG = getBoolean('USE_ZLIB_NG', \%Info);
$BUILD_ZLIB = getBoolean('BUILD_ZLIB', \%Info);
$USE_ZLIB_NG = getBoolean('USE_ZLIB_NG', \%Info);
$OLD_ZLIB = getBoolean('OLD_ZLIB', \%Info);

if ($^O eq 'VMS') {
$ZLIB_INCLUDE = VMS::Filespec::vmspath($ZLIB_INCLUDE);
$ZLIB_LIB = VMS::Filespec::vmspath($ZLIB_LIB);
}

$OLD_ZLIB = '-DOLD_ZLIB'
if getBoolean('OLD_ZLIB', \%Info);

$BUILD_ZLIB = getBoolean('BUILD_ZLIB', \%Info);
$OLD_ZLIB = $OLD_ZLIB
?'-DOLD_ZLIB'
: '';

if ($BUILD_ZLIB ) {

die "Cannot have USE_ZLIB_NG when BUILD_ZLIBis true\n"
if $USE_ZLIB_NG ;

# ZLIB_LIB & ZLIB_INCLUDE must point to the same place when
# BUILD_ZLIB is specified.
die "INCLUDE & LIB must be the same when BUILD_ZLIB is True\n"
die "ZLIB_INCLUDE & ZLIB_LIB must be the same when BUILD_ZLIB is True\n"
if $ZLIB_LIB ne $ZLIB_INCLUDE ;

# Check the zlib source directory exists
die "LIB/INCLUDE directory '$ZLIB_LIB' does not exits\n"
die "ZLIB_LIB/ZLIB_INCLUDE directory '$ZLIB_LIB' does not exits\n"
unless -d $ZLIB_LIB ;

# check for a well known file
if ($USE_ZLIB_NG)
{
die "LIB/INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib-ng source files\n"
unless -e catfile($ZLIB_LIB, 'zlib-ng.h') ;
}
else
{
die "LIB/INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib source files\n"
unless -e catfile($ZLIB_LIB, 'zlib.h') ;
}
die "ZLIB_LIB/ZLIB_INCLUDE directory, '$ZLIB_LIB', doesn't seem to have the zlib source files\n"
unless -e catfile($ZLIB_LIB, 'zlib.h') ;

# write the Makefile
print "Building Zlib enabled\n" ;
print "Building Zlib is enabled\n" ;
}

$GZIP_OS_CODE = defined $ENV{'GZIP_OS_CODE'}
? $ENV{'GZIP_OS_CODE'}
: $Info{'GZIP_OS_CODE'} ;

die "GZIP_OS_CODE not 'AUTO_DETECT' or a number between 0 and 255\n"
unless uc $GZIP_OS_CODE eq 'AUTO_DETECT'
|| ( $GZIP_OS_CODE =~ /^(\d+)$/ && $1 >= 0 && $1 <= 255) ;
die "GZIP_OS_CODE not 'AUTO_DETECT' or a number between 0 and 255\n"
unless uc $GZIP_OS_CODE eq 'AUTO_DETECT'
|| ( $GZIP_OS_CODE =~ /^(\d+)$/ && $1 >= 0 && $1 <= 255) ;

if (uc $GZIP_OS_CODE eq 'AUTO_DETECT')
{
Expand Down Expand Up @@ -402,24 +411,24 @@ sub zlib_files
# zlib 1.2.0 or greater
#
@h_files = qw(crc32.h inffast.h inflate.h trees.h zconf.in.h
zutil.h deflate.h inffixed.h inftrees.h zconf.h
zlib.h
);
zutil.h deflate.h inffixed.h inftrees.h zconf.h
zlib.h
);
@c_files = qw(adler32 crc32 infback inflate uncompr
compress deflate inffast inftrees
trees zutil
);
compress deflate inffast inftrees
trees zutil
);
}
else {
# zlib 1.1.x

@h_files = qw(deflate.h infcodes.h inftrees.h zconf.h zutil.h
infblock.h inffast.h infutil.h zlib.h
);
infblock.h inffast.h infutil.h zlib.h
);
@c_files = qw(adler32 compress crc32 uncompr
deflate trees zutil inflate infblock
inftrees infcodes infutil inffast
);
deflate trees zutil inflate infblock
inftrees infcodes infutil inffast
);
}

@h_files = map { catfile($dir, $_) } @h_files ;
Expand All @@ -430,12 +439,8 @@ sub zlib_files
{ copy(catfile($dir, $file), '.') }

return (
#'H' => [ @h_files ],
'C' => [ @c_files ] ,
#'OBJECT' => qq[ @o_files ],
'OBJECT' => q[ $(O_FILES) ],


'C' => [ @c_files ] ,
'OBJECT' => q[ $(O_FILES) ],
) ;
}

Expand Down
35 changes: 35 additions & 0 deletions cpan/Compress-Raw-Zlib/Zlib.xs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@
# define NEED_sv_2pv_nolen
# define NEED_sv_pvn_force_flags
# include "ppport.h"

/* Proposed fix for https://github.com/Dual-Life/Devel-PPPort/issues/231 */

# if PERL_VERSION < 18
# ifdef sv_2pv
# undef sv_2pv
# endif

# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define sv_2pv(sv, lp) ({ SV *_sv_2pv = (sv); SvPOKp(_sv_2pv) ? ((*(lp) = SvCUR(_sv_2pv)), SvPVX(_sv_2pv)) : Perl_sv_2pv(aTHX_ _sv_2pv, (lp)); })
# else
# define sv_2pv(sv, lp) (SvPOKp(sv) ? ((*(lp) = SvCUR(sv)), SvPVX(sv)) : Perl_sv_2pv(aTHX_ (sv), (lp)))
# endif

#endif

#endif

#if PERL_REVISION == 5 && PERL_VERSION == 9
Expand Down Expand Up @@ -1227,6 +1243,15 @@ deflate (s, buf, output)
CODE:
bufinc = s->bufsize;

/*
if (trace) {
printf("\nDEFLATE Before deRef of input buffer\n");
printf("\nPerl_sv_dump\n");
Perl_sv_dump(buf);
printf("\n");
}
*/

/* If the input buffer is a reference, dereference it */
buf = deRef(buf, "deflate") ;

Expand All @@ -1238,6 +1263,16 @@ deflate (s, buf, output)
s->stream.next_in = (Bytef*)SvPV_nomg(buf, origlen) ;
s->stream.avail_in = origlen;

if (trace) {
printf("\nDEFLATE Starts\n");
DispStream(s, "START");
/*
printf("\nPerl_sv_dump\n");
Perl_sv_dump(buf);
printf("\n");
*/
}

if (s->flags & FLAG_CRC32)
s->crc32 = CRZ_crc32(s->crc32, s->stream.next_in, s->stream.avail_in) ;

Expand Down

0 comments on commit fd0a86c

Please sign in to comment.