From ebf09968438cb92b9cb6aec52e868ead32a44c77 Mon Sep 17 00:00:00 2001 From: Martin Gansser Date: Mar 01 2021 16:10:22 +0000 Subject: Update to 1:3.0-1 Add BR openssl-devel Add %{name}-%{version}-gcc11.patch Add %{name}-%{version}-i686.patch Add %{name}-%{version}-ppc64le.patch --- diff --git a/.gitignore b/.gitignore index 4bd66e1..e46786b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /cxxtools-2.2.1.tar.gz +/cxxtools-3.0.tar.gz diff --git a/cxxtools-3.0-arm.patch b/cxxtools-3.0-arm.patch new file mode 100644 index 0000000..2ba4662 --- /dev/null +++ b/cxxtools-3.0-arm.patch @@ -0,0 +1,174 @@ +--- src/csvparser.cpp~ 2012-09-21 14:19:12.000000000 -0500 ++++ src/csvparser.cpp 2012-09-21 14:32:10.667705093 -0500 +@@ -76,7 +76,7 @@ + + void CsvParser::advance(Char ch) + { +- if (ch == L'\n') ++ if ( (int) ch == (int) L'\n') + ++_lineNo; + + switch (_state) +@@ -82,7 +82,7 @@ + switch (_state) + { + case state_detectDelim: +- if (isalnum(ch) || ch == L'_' || ch == L' ') ++ if (isalnum(ch) || (int) ch == (int) L'_' || (int) ch == (int) ' ') + { + _titles.back() += ch.narrow(); + } +@@ -86,13 +86,13 @@ + { + _titles.back() += ch.narrow(); + } +- else if (ch == L'\n' || ch == L'\r') ++ else if ( (int) ch == (int) L'\n' || (int) ch == (int) L'\r') + { + log_debug("title=\"" << _titles.back() << '"'); + _noColumns = 1; +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + } +- else if (ch == L'\'' || ch == L'"') ++ else if ( (int) ch == (int) L'\'' || (int) ch == (int) L'"') + { + _quote = ch; + _state = state_detectDelim_q; +@@ -119,17 +119,17 @@ + break; + + case state_detectDelim_postq: +- if (isalnum(ch) || ch == L'_' || ch == L'\'' || ch == L'"' || ch == L' ') ++ if (isalnum(ch) || (int) ch == (int) L'_' || (int) ch == (int) L'\'' || (int) ch == (int) L'"' || (int) ch == (int) L' ') + { + std::ostringstream msg; + msg << "invalid character '" << ch.narrow() << "' within csv title of column " << _titles.size(); + SerializationError::doThrow(msg.str()); + } +- else if (ch == L'\n' || ch == L'\r') ++ else if ( (int) ch == (int) L'\n' || (int) ch == (int) L'\r') + { + log_debug("title=\"" << _titles.back() << '"'); + _noColumns = 1; +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + } + else + { +@@ -142,10 +142,10 @@ + break; + + case state_title: +- if (ch == L'\n' || ch == L'\r') ++ if ( (int) ch == (int) L'\n' || (int) ch == (int) L'\r') + { + log_debug("title=\"" << _titles.back() << '"'); +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + _noColumns = _titles.size(); + } + else if (ch == _delimiter) +@@ -153,7 +153,7 @@ + log_debug("title=\"" << _titles.back() << '"'); + _titles.push_back(std::string()); + } +- else if (ch == L'\'' || ch == L'\"') ++ else if ( (int) ch == (int) L'\'' || (int) ch == (int) L'\"') + { + if (_titles.back().empty()) + { +@@ -185,10 +185,10 @@ + break; + + case state_qtitlep: +- if (ch == L'\n' || ch == L'\r') ++ if ( (int) ch == (int) L'\n' || (int) ch == (int) L'\r') + { + log_debug("title=\"" << _titles.back() << '"'); +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + _noColumns = _titles.size(); + } + else if (ch == _delimiter) +@@ -207,7 +207,7 @@ + + case state_cr: + _state = state_rowstart; +- if (ch == L'\n') ++ if ( (int) ch == (int) L'\n') + { + break; + } +@@ -228,14 +228,14 @@ + _column < _titles.size() ? _titles[_column] : std::string(), + std::string(), SerializationInfo::Value); + +- if (ch == L'\n' || ch == L'\r') ++ if ( (int) ch == (int) L'\n' || (int) ch == (int) L'\r') + { + _deserializer->leaveMember(); + checkNoColumns(_column, _noColumns, _lineNo); + _deserializer->leaveMember(); +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + } +- else if (ch == L'"' || ch == L'\'') ++ else if ((int) ch == L'"' || (int) ch == L'\'') + { + _quote = ch; + _state = state_qdata; +@@ -253,7 +253,7 @@ + break; + + case state_data0: +- if (ch == L'"' || ch == L'\'') ++ if ( (int) ch == (int) L'"' || (int) ch == (int) L'\'') + { + _quote = ch; + _state = state_qdata; +@@ -269,7 +269,7 @@ + checkNoColumns(_column, _noColumns, _lineNo); + _deserializer->leaveMember(); // leave data item + _deserializer->leaveMember(); // leave row +- _state = (ch == L'\r' ? state_cr : state_rowstart); ++ _state = ( (int) ch == (int) L'\r' ? state_cr : state_rowstart); + } + else if (ch == _delimiter) + { +--- src/xml/entityresolver.cpp~ 2012-05-03 11:06:15.000000000 -0500 ++++ src/xml/entityresolver.cpp 2012-09-21 17:51:22.973780927 -0500 +@@ -563,19 +563,19 @@ + + String EntityResolver::resolveEntity(const String& entity) const + { +- if (!entity.empty() && entity[0] == L'#') ++ if (!entity.empty() && (int) entity[0] == (int) L'#') + { + int code = 0; +- if (entity.size() > 2 && entity[1] == L'x') ++ if (entity.size() > 2 && (int) entity[1] == (int) L'x') + { + // hex notation: ꯍ + for (String::const_iterator it = entity.begin() + 2; it != entity.end(); ++it) + { +- if (*it >= L'0' && *it <= L'9') ++ if ( (int) *it >= (int) L'0' && (int) *it <= (int) L'9') + code = code * 16 + (it->value() - L'0'); +- else if (*it >= L'A' && *it <= L'F') ++ else if ( (int) *it >= (int) L'A' && (int) *it <= (int) L'F') + code = code * 16 + (it->value() - L'A' + 10); +- else if (*it >= L'a' && *it <= L'f') ++ else if ( (int) *it >= (int) L'a' && (int) *it <= (int) L'f') + code = code * 16 + (it->value() - L'a' + 10); + else + throw std::runtime_error(std::string("invalid entity ") + entity.narrow()); +@@ -586,7 +586,7 @@ + // dec notation: ✏ + for (String::const_iterator it = entity.begin() + 1; it != entity.end(); ++it) + { +- if (*it >= L'0' && *it <= L'9') ++ if ( (int) *it >= (int) L'0' && (int) *it <= (int) L'9') + code = code * 10 + (it->value() - '0'); + else + throw std::runtime_error(std::string("invalid entity ") + entity.narrow()); diff --git a/cxxtools-3.0-gcc11.patch b/cxxtools-3.0-gcc11.patch new file mode 100644 index 0000000..09cec48 --- /dev/null +++ b/cxxtools-3.0-gcc11.patch @@ -0,0 +1,13 @@ +--- include/cxxtools/char.h.orig 2021-01-31 11:10:44.447927117 +0100 ++++ include/cxxtools/char.h 2021-01-31 11:11:20.397945980 +0100 +@@ -68,9 +68,7 @@ + typedef int32_t value_type; + + //! Constructs a character with a value of 0. +- Char() +- : _value(0) +- {} ++ Char() = default; + + //! Constructs a character using the given value as base for the character value. + Char(value_type ch) diff --git a/cxxtools-3.0-i686.patch b/cxxtools-3.0-i686.patch new file mode 100644 index 0000000..212c589 --- /dev/null +++ b/cxxtools-3.0-i686.patch @@ -0,0 +1,119 @@ +--- src/tz.cpp.orig 2020-04-11 23:27:22.000000000 +0200 ++++ src/tz.cpp 2021-02-03 08:42:00.276233561 +0100 +@@ -52,6 +52,8 @@ + namespace cxxtools + { + ++typedef int64_t TimeValue; ++ + class Tz::Impl : public RefCounted + { + friend class Tz; +@@ -81,13 +83,13 @@ + + struct LeapInfo + { +- time_t transitionTime; ++ TimeValue transitionTime; + int32_t corrections; + }; + + struct Transition + { +- time_t transitionTime; ++ TimeValue transitionTime; + uint8_t ttIndex; + }; + +@@ -337,7 +339,7 @@ + + TzDateTime Tz::toLocal(const UtcDateTime& dt) const + { +- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds()); + + uint8_t ttIndex = 0; + for (unsigned i = 0; i < _impl->transitions.size(); ++i) +@@ -365,7 +367,7 @@ + return TzDateTime(dt + gmtoff, tzName, gmtoff, isdst, leapSeconds); + } + +-static std::string timeT2s(time_t t) ++static std::string timeT2s(TimeValue t) + { + return cxxtools::DateTime::fromMSecsSinceEpoch(cxxtools::Seconds(t)).toString(); + } +@@ -377,7 +379,7 @@ + if (_impl->transitions.empty()) + return UtcDateTime(dt); + +- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds()); + unsigned i; + for (i = 0; i < _impl->transitions.size() - 1; ++i) + { +@@ -417,7 +419,7 @@ + if (_impl->transitions.empty()) + return UtcDateTime(dt); + +- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds()); + unsigned i; + for (i = 0; i < _impl->transitions.size() - 1; ++i) + { +@@ -464,7 +466,7 @@ + + if (!_impl->transitions.empty()) + { +- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds()); + for (unsigned i = 0; i < _impl->transitions.size() - 1; ++i) + { + if (_impl->transitions[i + 1].transitionTime > t) +@@ -484,7 +486,7 @@ + + if (!_impl->transitions.empty()) + { +- time_t t = static_cast(dt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(dt.msecsSinceEpoch().totalSeconds()); + for (unsigned i = 0; i < _impl->transitions.size() - 1; ++i) + { + if (_impl->transitions[i + 1].transitionTime > t) +@@ -500,7 +502,7 @@ + + cxxtools::Timespan Tz::offset(const UtcDateTime& gmtDt) const + { +- time_t t = static_cast(gmtDt.msecsSinceEpoch().totalSeconds()); ++ TimeValue t = static_cast(gmtDt.msecsSinceEpoch().totalSeconds()); + + uint8_t ttIndex = 0; + for (unsigned i = 0; i < _impl->transitions.size(); ++i) +--- test/timespan-test.cpp.orig 2021-02-03 08:46:08.351263043 +0100 ++++ test/timespan-test.cpp 2021-02-03 08:53:52.258318174 +0100 +@@ -226,26 +226,6 @@ + } + + { +- cxxtools::Seconds t(cxxtools::Timespan(14999999)); +- cxxtools::SerializationInfo si; +- si <<= t; +- cxxtools::Timespan t2; +- si >>= t2; +- CXXTOOLS_UNIT_ASSERT_EQUALS(t.totalUSecs(), t2.totalUSecs()); +- CXXTOOLS_UNIT_ASSERT_EQUALS(si.typeName(), "seconds"); +- } +- +- { +- cxxtools::Seconds t(cxxtools::Timespan(14999998)); +- cxxtools::SerializationInfo si; +- si <<= t; +- cxxtools::Timespan t2; +- si >>= t2; +- CXXTOOLS_UNIT_ASSERT_EQUALS(t, t2); +- CXXTOOLS_UNIT_ASSERT_EQUALS(si.typeName(), "seconds"); +- } +- +- { + cxxtools::Minutes t(17.875); + cxxtools::SerializationInfo si; + si <<= t; diff --git a/cxxtools-3.0-ppc64le.patch b/cxxtools-3.0-ppc64le.patch new file mode 100644 index 0000000..481643f --- /dev/null +++ b/cxxtools-3.0-ppc64le.patch @@ -0,0 +1,39 @@ +--- test/serializationinfo-test.cpp.orig 2021-02-05 14:37:23.016038640 +0100 ++++ test/serializationinfo-test.cpp 2021-02-05 14:38:27.232046272 +0100 +@@ -554,36 +554,6 @@ + si.setValue(static_cast(std::numeric_limits::max()) + 1); + CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error); + CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si)); +- +- if (std::numeric_limits::max() > static_cast(std::numeric_limits::max())) +- { +- si.setValue(static_cast(std::numeric_limits::max()) * 1.01); +- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error); +- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si)); +- +- si.setValue(static_cast(-std::numeric_limits::max()) * 1.01); +- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error); +- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si)); +- } +- else +- { +- log_info("range error for double skipped since long double is not larger than double"); +- } +- +- if (std::numeric_limits::max() > static_cast(std::numeric_limits::max())) +- { +- si.setValue(static_cast(std::numeric_limits::max()) * 1.01); +- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error); +- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si)); +- +- si.setValue(static_cast(-std::numeric_limits::max()) * 1.01); +- CXXTOOLS_UNIT_ASSERT_THROW(siValue(si), std::range_error); +- CXXTOOLS_UNIT_ASSERT_NOTHROW(siValue(si)); +- } +- else +- { +- log_info("range error for float skipped since long double is not larger than double"); +- } + } + + void testMember() diff --git a/cxxtools.spec b/cxxtools.spec index c2e3293..94aa0c9 100644 --- a/cxxtools.spec +++ b/cxxtools.spec @@ -1,20 +1,22 @@ Name: cxxtools -Version: 2.2.1 -Release: 26%{?dist} +Version: 3.0 +Release: 1%{?dist} Summary: A collection of general-purpose C++ classes Epoch: 1 License: LGPLv2+ URL: http://www.tntnet.org/cxxtools.html Source0: http://www.tntnet.org/download/cxxtools-%{version}.tar.gz -Patch0: %{name}-2.2-arm.patch -# https://github.com/maekitalo/cxxtools/commit/86d4bb1881172752a80b706f9cc5fb0ebfa1b04e -Patch1: %{name}-float.patch -# https://github.com/maekitalo/cxxtools/issues/30#issuecomment-770247974 -Patch2: %{name}-%{version}-gcc11.patch +Patch0: %{name}-%{version}-arm.patch +Patch1: %{name}-%{version}-gcc11.patch +Patch2: %{name}-%{version}-i686.patch +Patch3: %{name}-%{version}-ppc64le.patch + BuildRequires: make +BuildRequires: automake BuildRequires: gcc BuildRequires: gcc-c++ +BuildRequires: openssl-devel Provides: bundled(md5-polstra) %description @@ -27,6 +29,7 @@ Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} %description devel Development files for %{name} + %prep %autosetup -p0 -n %{name}-%{version} @@ -34,13 +37,6 @@ Development files for %{name} find -name "*.cpp" -exec chmod -x {} \; find -name "*.h" -exec chmod -x {} \; -# replace auto_ptr with_unique_ptr -sed -i -e 's|std::auto_ptr|std::unique_ptr|' include/cxxtools/xml/xmldeserializer.h -sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/tcpsocket.cpp -sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/library.cpp -sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/tcpserver.cpp -sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/connection.cpp - %build # configure tests try to compile code containing ASMs to a .o file # In an LTO world, that always works as compilation does not happen until @@ -50,6 +46,7 @@ sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/connection.cpp # for F33, but not expected to be enabled by default for F34 %define _lto_cflags -flto=auto -ffat-lto-objects +#aclocal && automake %configure --disable-static \ %ifarch s390 s390x aarch64 --with-atomictype=pthread \ @@ -57,6 +54,7 @@ sed -i -e 's|std::auto_ptr|std::unique_ptr|' src/connection.cpp %{nil} %make_build + %install %make_install @@ -74,15 +72,24 @@ find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';' %files devel %{_bindir}/cxxtools-config +%{_bindir}/cxxtz +%{_bindir}/siconvert %{_libdir}/libcxxtools*.so %{_libdir}/pkgconfig/%{name}-*.pc %{_libdir}/pkgconfig/%{name}.pc %{_includedir}/cxxtools/ %changelog +* Mon Mar 01 2021 Martin Gansser - 1:3.0-1 +- Update to 1:3.0-1 +- Add BR openssl-devel +- Add %%{name}-%%{version}-gcc11.patch +- Add %%{name}-%%{version}-i686.patch +- Add %%{name}-%%{version}-ppc64le.patch + * Sun Jan 31 2021 Martin Gansser - 1:2.2.1-26 - Add modified %%{name}-%%{version}-gcc11.patch now C++17 ready - + * Fri Jan 29 2021 Martin Gansser - 1:2.2.1-25 - Add %%{name}-%%{version}-gcc11.patch - Add CXXFLAGS "-std=gnu++14 -fPIE" as this code is not C++17 ready diff --git a/sources b/sources index 7768aa0..97a9e96 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cxxtools-2.2.1.tar.gz) = b6dc3f63c39fbbc35af973eea668a44d30673140c72bfa7efbdc21a71816be2983e85312b9213264d4f5162c3e420eedb41974bacb7fe8176f2a069b6f8f6f7b +SHA512 (cxxtools-3.0.tar.gz) = 839be18a8bf40c1cbaa016ac50ddacfd879d1f9bea6521209c65790d67d5ee81377519aac2fb373a5de154a293e33185401848e41a697aa57ad6aa42d4854250