From 16fbb700ed82cf6d3aad3a9c293b0e8068840b96 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 27 Dec 2021 12:08:57 +0100 Subject: Fix build on Debian and Ubuntu versions --- Makefile | 12 +++++++++--- debian/control | 2 +- src/test-unicode.cpp | 22 +++++++++++++++++++--- 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 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 -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 #include #include +#include +#if BOOST_VERSION > 106700 +// CPU Timer in Debian 10 boost is broken, so leave it to std::chrono wall clock #include +#endif #include #include @@ -99,6 +103,10 @@ namespace std { return os; } +} // namespace std + +namespace { + // utility wrapper to adapt locale-bound facets for wstring/wbuffer convert template 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(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 mWallTime0; +#if BOOST_VERSION > 106700 boost::timer::cpu_timer mCPUTimer; +#endif }; template -- cgit v1.2.3