package init

This commit is contained in:
lipanpan 2021-11-22 16:12:37 +08:00
parent 82d607e357
commit 9eaecdc44d
3 changed files with 132 additions and 0 deletions

61
0001-Fixed-724.patch Normal file
View File

@ -0,0 +1,61 @@
From 53d2ea9ad3cc20e1beac2e1c014082c25e221182 Mon Sep 17 00:00:00 2001
From: Takatoshi Kondo <redboltz@gmail.com>
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<std::chrono::system_clock::time_point> {
uint64_t value;
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
- uint64_t sec = value & 0x00000003ffffffffL;
+ uint64_t sec = value & 0x00000003ffffffffLL;
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
@@ -79,7 +79,7 @@ struct convert<std::chrono::system_clock::time_point> {
uint64_t value;
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
- uint64_t sec = value & 0x00000003ffffffffL;
+ uint64_t sec = value & 0x00000003ffffffffLL;
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
std::chrono::nanoseconds(nanosec));
tp += std::chrono::seconds(sec);
--
2.17.1

BIN
msgpack-3.1.0.tar.gz Normal file

Binary file not shown.

71
msgpack.spec Normal file
View File

@ -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 <lipanpan@lipanpana@uniontech.com> - 3.1.0-1
- package init