diff --git a/0001-Fixed-724.patch b/0001-Fixed-724.patch new file mode 100644 index 0000000..16bebe1 --- /dev/null +++ b/0001-Fixed-724.patch @@ -0,0 +1,61 @@ +From 53d2ea9ad3cc20e1beac2e1c014082c25e221182 Mon Sep 17 00:00:00 2001 +From: Takatoshi Kondo +Date: Sun, 26 Aug 2018 10:58:47 +0900 +Subject: [PATCH] Fixed #724. + +Fixed type mismatch in msgpack_timestamp. +Added 64bit singed postfix. +--- + include/msgpack/timestamp.h | 8 ++++++-- + include/msgpack/v1/adaptor/cpp11/chrono.hpp | 4 ++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/include/msgpack/timestamp.h b/include/msgpack/timestamp.h +index 4d7df83d..76139312 100644 +--- a/include/msgpack/timestamp.h ++++ b/include/msgpack/timestamp.h +@@ -28,13 +28,17 @@ static inline bool msgpack_object_to_timestamp(const msgpack_object* obj, msgpac + switch (obj->via.ext.size) { + case 4: + ts->tv_nsec = 0; +- _msgpack_load32(uint32_t, obj->via.ext.ptr, &ts->tv_sec); ++ { ++ uint32_t v; ++ _msgpack_load32(uint32_t, obj->via.ext.ptr, &v); ++ ts->tv_sec = v; ++ } + return true; + case 8: { + uint64_t value; + _msgpack_load64(uint64_t, obj->via.ext.ptr, &value); + ts->tv_nsec = (uint32_t)(value >> 34); +- ts->tv_sec = value & 0x00000003ffffffffL; ++ ts->tv_sec = value & 0x00000003ffffffffLL; + return true; + } + case 12: +diff --git a/include/msgpack/v1/adaptor/cpp11/chrono.hpp b/include/msgpack/v1/adaptor/cpp11/chrono.hpp +index 1e08355e..db2035b7 100644 +--- a/include/msgpack/v1/adaptor/cpp11/chrono.hpp ++++ b/include/msgpack/v1/adaptor/cpp11/chrono.hpp +@@ -41,7 +41,7 @@ struct as { + uint64_t value; + _msgpack_load64(uint64_t, o.via.ext.data(), &value); + uint32_t nanosec = static_cast(value >> 34); +- uint64_t sec = value & 0x00000003ffffffffL; ++ uint64_t sec = value & 0x00000003ffffffffLL; + tp += std::chrono::duration_cast( + std::chrono::nanoseconds(nanosec)); + tp += std::chrono::seconds(sec); +@@ -79,7 +79,7 @@ struct convert { + uint64_t value; + _msgpack_load64(uint64_t, o.via.ext.data(), &value); + uint32_t nanosec = static_cast(value >> 34); +- uint64_t sec = value & 0x00000003ffffffffL; ++ uint64_t sec = value & 0x00000003ffffffffLL; + tp += std::chrono::duration_cast( + std::chrono::nanoseconds(nanosec)); + tp += std::chrono::seconds(sec); +-- +2.17.1 + diff --git a/msgpack-3.1.0.tar.gz b/msgpack-3.1.0.tar.gz new file mode 100644 index 0000000..386e6ab Binary files /dev/null and b/msgpack-3.1.0.tar.gz differ diff --git a/msgpack.spec b/msgpack.spec new file mode 100644 index 0000000..26437f8 --- /dev/null +++ b/msgpack.spec @@ -0,0 +1,71 @@ +%global __cmake_in_source_build 1 + +Name: msgpack +Version: 3.1.0 +Release: 1 +Summary: Binary-based efficient object serialization library + +License: Boost +URL: http://msgpack.org +Source0: https://github.com/msgpack/msgpack-c/releases/download/cpp-%{version}/%{name}-%{version}.tar.gz +Patch: 0001-Fixed-724.patch + +BuildRequires: make cmake gcc-c++ doxygen gtest-devel zlib-devel + +%description +MessagePack is a binary-based efficient object serialization +library. It enables to exchange structured objects between many +languages like JSON. But unlike JSON, it is very fast and small. +%package devel + +Summary: Libraries and header files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +Libraries and header files for %{name} + +%prep +%autosetup -p1 + +sed -i "s|-std=c++98|-std=gnu++11|g" CMakeLists.txt + +%build +if test ! -e "obj"; then + mkdir obj +fi +pushd obj +%cmake .. -DCMAKE_INSTALL_LIBDIR=%{_libdir} -Dlibdir=%{_libdir} -DBUILD_SHARED_LIBS=ON +%make_build + +popd + +%check +pushd obj +# https://github.com/msgpack/msgpack-c/issues/697 +export GTEST_FILTER=-object_with_zone.ext_empty +make test || { + cat Testing/Temporary/LastTest.log; + exit 1; +} +popd + +%install +make install/fast DESTDIR=$RPM_BUILD_ROOT -C obj + +%ldconfig_scriptlets + +%files +%license LICENSE_1_0.txt COPYING +%doc AUTHORS ChangeLog NOTICE README README.md +%{_libdir}/*.so.* + +%files devel +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/msgpack.pc +%{_libdir}/cmake/msgpack + +%changelog +* Thu Jul 22 2021 lipanpan - 3.1.0-1 +- package init +