* Warning: For a seamless upgrade, upgrade to version 3
* of the decoder before upgrading to version 3 of the
* encoder!
-3.002_001 Sept 26, 2014
+3.003 Oct 19 2014
* Niko Tyni fixed the 64-bit big endian Sereal bug! (Yay Niko!)
* Setup META.yml correctly so that certain dependencies are
marked as being test dependencies and not build or run-time
dependencies.
+ * Allow one to build against an externally supplied version
+ of csnappy or miniz. Thanks to Petr Písař <ppisar@redhat.com>
3.002 Aug 20 2014
Summary of changes from 3.001 - 3.002
--- /dev/null
+Install with
+
+ perl Makefile.PL
+ make
+ make test
+ make instal
+
+By default the module will detect and use system versions of the miniz
+and csnappy libraries during build and install. You can override this
+by setting the SEREAL_USE_BUNDLED_LIBS to true, or you can override
+it on a case by case basis by setting SEREAL_USE_BUNDLED_MINIZ or
+SEREAL_USE_BUNDLED_CSNAPPY env vars. Eg:
+
+ SEREAL_USE_BUNDLED_LIBS=1 perl Makefile.PL
+ SEREAL_USE_BUNDLED_CSNAPPY=1 perl Makefile.PL
+ SEREAL_USE_BUNDLED_MINIZ=1 perl Makefile.PL
+
+
Encoder.xs
inc/Devel/CheckLib.pm
inc/Sereal/BuildTools.pm
+INSTALL
lib/Sereal/Encoder.pm
lib/Sereal/Encoder/Constants.pm
Makefile.PL
}
}
},
- "release_status" : "testing",
+ "release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/Sereal/Sereal/issues"
"url" : "git://github.com/Sereal/Sereal.git"
}
},
- "version" : "3.002_001"
+ "version" : "3.003"
}
resources:
bugtracker: https://github.com/Sereal/Sereal/issues
repository: git://github.com/Sereal/Sereal.git
-version: 3.002_001
+version: '3.003'
our $OPTIMIZE;
+my $libs = '';
+my $objects = '$(BASEEXT)$(OBJ_EXT) srl_encoder$(OBJ_EXT)';
my $defines = join " ", map "-D$_", grep exists $ENV{$_},
qw(NOINLINE DEBUG MEMDEBUG NDEBUG ENABLE_DANGEROUS_HACKS);
$defines .= " -Dinline= ";
}
-# from Compress::Snappy
-require Devel::CheckLib;
-my $ctz = Devel::CheckLib::check_lib(
- lib => 'c',
- function => 'return (__builtin_ctzll(0x100000000LL) != 32);'
-) ? '-DHAVE_BUILTIN_CTZ' : '';
-$defines .= " $ctz" if $ctz;
+# Prefer external libraries over the bundled one.
+inc::Sereal::BuildTools::check_external_libraries(\$libs, \$defines, \$objects);
+
+if ($defines !~ /HAVE_CSNAPPY/) {
+ # from Compress::Snappy
+ require Devel::CheckLib;
+ my $ctz = Devel::CheckLib::check_lib(
+ lib => 'c',
+ function => 'return (__builtin_ctzll(0x100000000LL) != 32);'
+ ) ? '-DHAVE_BUILTIN_CTZ' : '';
+ $defines .= " $ctz" if $ctz;
+}
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
LICENSE => 'perl',
ABSTRACT_FROM => 'lib/Sereal/Encoder.pm',
AUTHOR => 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>',
- LIBS => [''], # e.g., '-lm'
+ LIBS => [$libs], # e.g., '-lm'
DEFINE => $defines,
INC => '-I.', # e.g., '-I. -I/usr/include/other'
OPTIMIZE => $OPTIMIZE,
- OBJECT => '$(O_FILES)',
+ OBJECT => $objects,
test => {
TESTS => "t/*.t t/*/*/*.t",
},
}
}
+# Prefer external csnappy and miniz libraries over the bundled ones.
+sub check_external_libraries {
+ my ($libs, $defines, $objects) = @_;
+ require Devel::CheckLib;
+
+ if (
+ !$ENV{SEREAL_USE_BUNDLED_LIBS} &&
+ !$ENV{SEREAL_USE_BUNDLED_CSNAPPY} &&
+ Devel::CheckLib::check_lib(
+ lib => 'csnappy',
+ header => 'csnappy.h'
+ )) {
+ print "Using installed csnappy library\n";
+ $$libs .= ' -lcsnappy';
+ $$defines .= ' -DHAVE_CSNAPPY';
+ } else {
+ print "Using bundled csnappy code\n";
+ }
+
+ if (
+ !$ENV{SEREAL_USE_BUNDLED_LIBS} &&
+ !$ENV{SEREAL_USE_BUNDLED_MINIZ} &&
+ Devel::CheckLib::check_lib(
+ lib => 'miniz',
+ header => 'miniz.h'
+ )) {
+ print "Using installed miniz library\n";
+ $$libs .= ' -lminiz';
+ $$defines .= ' -DHAVE_MINIZ';
+ } else {
+ print "Using bundled miniz code\n";
+ $$objects .= ' miniz$(OBJ_EXT)';
+ }
+}
1;
use Carp qw/croak/;
use XSLoader;
-our $VERSION = '3.002_001'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '3.003'; # Don't forget to update the TestCompat set for testing against installed decoders!
our $XS_VERSION = $VERSION; $VERSION= eval $VERSION;
# not for public consumption, just for testing.
for common cases. This, however, does mean that most arrays up to 15 elements
could be represented in two different, yet perfectly valid forms. ARRAYREF would
have to be outlawed for a properly canonical form. The exact same logic
-applies to HASH vs. HASHREF. This behavior can be overriden by the
+applies to HASH vs. HASHREF. This behavior can be overridden by the
C<canonical_refs> option, which disables use of HASHREF and ARRAYREF.
=item Numeric representation
extern "C" {
#endif
-#define CSNAPPY_VERSION 4
+#define CSNAPPY_VERSION 5
-#define CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO 15
+#define CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO 16
#define CSNAPPY_WORKMEM_BYTES (1 << CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO)
#ifndef __GNUC__
#define __attribute__(x) /*NOTHING*/
#endif
+#include <stdint.h>
/*
* Returns the maximal size of the compressed representation of
#include "ptable.h"
#include "srl_buffer.h"
+#if defined(HAVE_CSNAPPY)
+#include <csnappy.h>
+#else
#include "snappy/csnappy_compress.c"
+#endif
+
+#if defined(HAVE_MINIZ)
+#include <miniz.h>
+#else
#include "miniz.h"
+#endif
/* The ENABLE_DANGEROUS_HACKS (passed through from ENV via Makefile.PL) enables
* optimizations that may make the code so cozy with a particular version of the