diff --git a/.gitignore b/.gitignore index e69de29..cd636cb 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/CBOR-XS-1.3.tar.gz diff --git a/CBOR-XS-1.3-Cast-char-and-U8-where-needed.patch b/CBOR-XS-1.3-Cast-char-and-U8-where-needed.patch new file mode 100644 index 0000000..6601267 --- /dev/null +++ b/CBOR-XS-1.3-Cast-char-and-U8-where-needed.patch @@ -0,0 +1,77 @@ +From fb089d08ff9bc5cf45570b950aa33e50ee62371b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 29 Sep 2015 10:31:58 +0200 +Subject: [PATCH] Cast char* and U8* where needed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building with GCC 5.1.1 and perl-5.22.0 produces various warnings about +mismatching signess. This patch corrects it. + +Signed-off-by: Petr Písař +--- + XS.xs | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/XS.xs b/XS.xs +index 0af7c95..134ed9e 100644 +--- a/XS.xs ++++ b/XS.xs +@@ -765,7 +765,7 @@ decode_he (dec_t *dec, HV *hv) + dec->cur += len; + + if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) +- if (!is_utf8_string (key, len)) ++ if (!is_utf8_string ((U8*)key, len)) + ERR ("corrupted CBOR data (invalid UTF-8 in map key)"); + + hv_store (hv, key, -len, decode_sv (dec), 0); +@@ -854,7 +854,7 @@ decode_str (dec_t *dec, int utf8) + STRLEN len = decode_uint (dec); + + WANT (len); +- sv_catpvn (sv, dec->cur, len); ++ sv_catpvn (sv, (char *)dec->cur, len); + dec->cur += len; + } + } +@@ -863,7 +863,7 @@ decode_str (dec_t *dec, int utf8) + STRLEN len = decode_uint (dec); + + WANT (len); +- sv = newSVpvn (dec->cur, len); ++ sv = newSVpvn ((char*)dec->cur, len); + dec->cur += len; + + if (ecb_expect_false (dec->stringref) +@@ -874,7 +874,7 @@ decode_str (dec_t *dec, int utf8) + if (utf8) + { + if (ecb_expect_false (dec->cbor.flags & F_VALIDATE_UTF8)) +- if (!is_utf8_string (SvPVX (sv), SvCUR (sv))) ++ if (!is_utf8_string ((U8*)SvPVX (sv), SvCUR (sv))) + ERR ("corrupted CBOR data (invalid UTF-8 in text string)"); + + SvUTF8_on (sv); +@@ -1181,7 +1181,7 @@ decode_cbor (SV *string, CBOR *cbor, char **offset_return) + sv = decode_sv (&dec); + + if (offset_return) +- *offset_return = dec.cur; ++ *offset_return = (char *)dec.cur; + + if (!(offset_return || !sv)) + if (dec.cur != dec.end && !dec.err) +@@ -1231,7 +1231,7 @@ incr_parse (CBOR *self, SV *cborstr) + 1, 2, 4, 8,-1,-1,-1,-2 + }; + +- const U8 *p = SvPVX (cborstr) + self->incr_pos; ++ const U8 *p = (U8*)SvPVX (cborstr) + self->incr_pos; + U8 m = *p & MINOR_MASK; + IV count = SvIVX (AvARRAY (self->incr_count)[AvFILLp (self->incr_count)]); + I8 ilen = incr_len[m]; +-- +2.4.3 + diff --git a/CBOR-XS-1.3-Include-ecb.h-from-system.patch b/CBOR-XS-1.3-Include-ecb.h-from-system.patch new file mode 100644 index 0000000..fc62033 --- /dev/null +++ b/CBOR-XS-1.3-Include-ecb.h-from-system.patch @@ -0,0 +1,29 @@ +From 5f37da992f0c9ded881d22e607d77d89c57741a3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 29 Sep 2015 10:13:05 +0200 +Subject: [PATCH] Include ecb.h from system +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + XS.xs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/XS.xs b/XS.xs +index 15bce1f..0af7c95 100644 +--- a/XS.xs ++++ b/XS.xs +@@ -10,7 +10,7 @@ + #include + + #define ECB_NO_THREADS 1 +-#include "ecb.h" ++#include + + // compatibility with perl <5.18 + #ifndef HvNAMELEN_get +-- +2.4.3 + diff --git a/perl-CBOR-XS.spec b/perl-CBOR-XS.spec new file mode 100644 index 0000000..9c3a607 --- /dev/null +++ b/perl-CBOR-XS.spec @@ -0,0 +1,79 @@ +Name: perl-CBOR-XS +Version: 1.3 +Release: 1%{?dist} +Summary: Concise Binary Object Representation (CBOR) +# COPYING: GPLv3+ +## Replaced by system header-only package +# ecb.h: BSD or GPLv2+ +License: GPLv3+ and (BSD or GPLv2+) +Group: Development/Libraries +URL: http://search.cpan.org/dist/CBOR-XS/ +Source0: http://www.cpan.org/authors/id/M/ML/MLEHMANN/CBOR-XS-%{version}.tar.gz +# Use system libecb +Patch0: CBOR-XS-1.3-Include-ecb.h-from-system.patch +# Silent compiler warnings +Patch1: CBOR-XS-1.3-Cast-char-and-U8-where-needed.patch +BuildRequires: coreutils +BuildRequires: findutils +# gcc for standard header files +BuildRequires: gcc +BuildRequires: libecb-static +BuildRequires: make +BuildRequires: perl +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: sed +# Run-time: +BuildRequires: perl(common::sense) +BuildRequires: perl(Exporter) +BuildRequires: perl(Math::BigFloat) +BuildRequires: perl(Math::BigInt) +BuildRequires: perl(Time::Piece) +BuildRequires: perl(Types::Serialiser) +BuildRequires: perl(URI) +BuildRequires: perl(XSLoader) +# Tests: +BuildRequires: perl(Data::Dumper) +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +Requires: perl(Math::BigFloat) +Requires: perl(Math::BigInt) +Requires: perl(Time::Piece) +Requires: perl(URI) + +%description +This module converts Perl data structures to the Concise Binary Object +Representation (CBOR) and vice versa. CBOR is a fast binary serialisation +format that aims to use an (almost) superset of the JSON data model, i.e. +when you can represent something useful in JSON, you should be able to +represent it in CBOR. + +%prep +%setup -q -n CBOR-XS-%{version} +%patch0 -p1 +%patch1 -p1 +# Remove bundled libecb +rm ecb.h +sed -i -e '/^ecb\.h/d' MANIFEST + +%build +perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" +make %{?_smp_mflags} + +%install +make pure_install DESTDIR=$RPM_BUILD_ROOT +find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; +find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \; +%{_fixperms} $RPM_BUILD_ROOT/* + +%check +make test + +%files +%license COPYING +%doc Changes README +%{perl_vendorarch}/auto/* +%{perl_vendorarch}/CBOR* +%{_mandir}/man3/* + +%changelog +* Tue Sep 29 2015 Petr Pisar 1.3-1 +- Specfile autogenerated by cpanspec 1.78. diff --git a/sources b/sources index e69de29..55774d7 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +5bfeba032f5fdbf45ef7275ddb37af97 CBOR-XS-1.3.tar.gz