summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-27 12:08:57 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-27 12:08:57 +0100
commit16fbb700ed82cf6d3aad3a9c293b0e8068840b96 (patch)
tree83e54e80a4540199d5f7cc3212470d489f819cbd
parentfcdf5b3f2308555f5c1a5b2585ee2947855e1ca9 (diff)
Fix build on Debian and Ubuntu versions
-rw-r--r--Makefile12
-rw-r--r--debian/control2
-rw-r--r--src/test-unicode.cpp22
3 files changed, 29 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e037bc5..a3962c1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,18 @@
PROJECTNAME=unicode
VERSION=$(shell dpkg-parsechangelog --show-field Version)
-ifeq ($(shell lsb_release -si),Debian)
+ifeq ($(shell lsb_release -is),Debian)
ONDEBIAN=yes
+DEBIANVERSION=$(shell lsb_release -rs)
else
ONDEBIAN=no
endif
# On Ubuntu 2104 and 2110, dh_strip / debugedit is broken, therefore different Non-Debian options in the following
-DISTROS=base base-i386 debian10 debian11 ubuntu2004 ubuntu2010 ubuntu2104 ubuntu2110 ubuntu2204
+DISTROS=base base-i386 debian10 debian11 ubuntu2004 ubuntu2104 ubuntu2110 ubuntu2204
+
+ifeq ($(DEBIANVERSION),10)
+CXX=g++-8
+else
ifeq ($(wildcard $(shell which clang++-13)),)
ifeq ($(wildcard $(shell which clang++-12)),)
@@ -27,6 +32,8 @@ else
CXX=clang++-13
endif
+endif
+
STANDARD=c++17
ifeq ($(CXXFLAGS),)
@@ -38,7 +45,6 @@ ifeq ($(CXX),clang++-13)
ifeq ($(ONDEBIAN),yes)
COMPILER_SUITE=clang
LIBS+=-fuse-ld=lld-13
-# boost is buggy for C++20: error: static_assert failed due to requirement 'detail::is_endian_reversible_inplace<char8_t>
STANDARD=c++20
endif
endif
diff --git a/debian/control b/debian/control
index 0c236a3..a06886a 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: unicode
Section: devel
Priority: optional
Maintainer: Roland Reichwein <mail@reichwein.it>
-Build-Depends: debhelper (>= 12), libboost1.74-all-dev | libboost-all-dev, libc++-13-dev | libc++-12-dev | libc++-11-dev | libc++-dev, libc++abi-13-dev | libc++abi-12-dev | libc++abi-11-dev | libc++abi-dev, lld-13 | lld-12 | lld-11 | lld, clang-13 | clang-12 | clang-11 | clang, libunwind-13-dev | libunwind-12-dev | libunwind-dev, llvm-13-linker-tools | llvm-12-linker-tools | llvm-11-linker-tools | clang
+Build-Depends: debhelper (>= 12), lsb-release, libboost1.74-all-dev | libboost-all-dev, libc++-13-dev | libc++-12-dev | libc++-11-dev | libc++-dev, libc++abi-13-dev | libc++abi-12-dev | libc++abi-11-dev | libc++abi-dev, lld-13 | lld-12 | lld-11 | lld, clang-13 | clang-12 | clang-11 | clang, libunwind-13-dev | libunwind-12-dev | libunwind-dev, llvm-13-linker-tools | llvm-12-linker-tools | llvm-11-linker-tools | clang
Standards-Version: 4.5.0
Homepage: http://www.reichwein.it/unicode/
diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp
index e7dfa6f..2675989 100644
--- a/src/test-unicode.cpp
+++ b/src/test-unicode.cpp
@@ -5,7 +5,11 @@
#include <boost/test/data/dataset.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <boost/test/data/test_case.hpp>
+#include <boost/version.hpp>
+#if BOOST_VERSION > 106700
+// CPU Timer in Debian 10 boost is broken, so leave it to std::chrono wall clock
#include <boost/timer/timer.hpp>
+#endif
#include <array>
#include <chrono>
@@ -99,6 +103,10 @@ namespace std {
return os;
}
+} // namespace std
+
+namespace {
+
// utility wrapper to adapt locale-bound facets for wstring/wbuffer convert
template<class Facet>
struct deletable_facet : Facet
@@ -174,7 +182,8 @@ namespace std {
{
return conv32.from_bytes(conv32.to_bytes(s));
}
-}
+
+} // namespace
// check assumptions about environment
BOOST_AUTO_TEST_CASE(string_u8string)
@@ -530,16 +539,23 @@ public:
~CPUTimer()
{
+#if BOOST_VERSION > 106700
auto elapsed_cpu{mCPUTimer.elapsed()};
+#endif
std::cout << mName << ": " << std::chrono::duration<double>(std::chrono::steady_clock::now() - mWallTime0).count() <<
- "s (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) <<
- "s CPU)" << std::endl;
+ "s" <<
+#if BOOST_VERSION > 106700
+ " (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) << "s CPU)" <<
+#endif
+ std::endl;
}
private:
std::string mName;
std::chrono::time_point<std::chrono::steady_clock> mWallTime0;
+#if BOOST_VERSION > 106700
boost::timer::cpu_timer mCPUTimer;
+#endif
};
template<typename From, typename ToTypesCollectionType, size_t index = 0>