From ae8f0d7b1e6ef68854d073b1099e2e0945693076 Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Sun, 8 Oct 2023 15:13:49 +0200 Subject: [PATCH] liblinphone: add back QR support liblinphone was broken by 1769609dc0f5bb4bab18d2245e28b052f66b7a71 as zxing-cpp 2.0 and later require C++ 17 [1]. The version of liblinphone in nixpkgs does however only build with C++ 14. This was then fixed in c42909d342e2bad6739a31e608f41ad62d545ce1 by disabling QR code support. Its master branch does however build with C++ 17, so backport that commit. Due to upstream running formatters on their code in the meantime, the backport had to be done manually and the commit cannot be picked. [1] https://github.com/zxing-cpp/zxing-cpp/releases/tag/v2.0.0 --- .../liblinphone/backport-cpp17.patch | 98 +++++++++++++++++++ .../libraries/liblinphone/default.nix | 9 +- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/liblinphone/backport-cpp17.patch diff --git a/pkgs/development/libraries/liblinphone/backport-cpp17.patch b/pkgs/development/libraries/liblinphone/backport-cpp17.patch new file mode 100644 index 000000000000..d9eb75fa2768 --- /dev/null +++ b/pkgs/development/libraries/liblinphone/backport-cpp17.patch @@ -0,0 +1,98 @@ +From 9ece6e77dcf6545c3b8104068302c6243e3a5e88 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micka=C3=ABl=20Turnel?= + +Date: Wed, 1 Mar 2023 09:14:53 +0100 +Subject: [PATCH] Set c++ version 17 and fix compilation errors + +Backported-by: Lorenz Brun + +--- + CMakeLists.txt | 2 +- + daemon/daemon.cc | 2 +- + libxsd/xsd/cxx/config.hxx | 2 +- + src/conference/session/streams-group.cpp | 10 +++++----- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 475ff16a8..a771e4595 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -92,7 +92,7 @@ cmake_dependent_option(ENABLE_QRCODE "Enable QRCode support" YES "ENABLE_VIDEO" + # * DISABLE_BC_PACKAGE_SEARCH: skip find_package() for every BC package (bctoolbox, ortp, etc.) + # * DISABLE_SOCI_PACKAGE_SEARCH: skip find_package() for Soci. + +-set(CMAKE_CXX_STANDARD 14) ++set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_EXTENSIONS NO) + + if(NOT CMAKE_BUILD_TYPE) +diff --git a/daemon/daemon.cc b/daemon/daemon.cc +index 197fc22ef..fd09edb26 100644 +--- a/daemon/daemon.cc ++++ b/daemon/daemon.cc +@@ -628,7 +628,7 @@ void Daemon::execCommand(const string &command) { + ist.get(argsbuf); + string args = argsbuf.str(); + if (!args.empty() && (args[0] == ' ')) args.erase(0, 1); +- list::iterator it = find_if(mCommands.begin(), mCommands.end(), bind2nd(mem_fun(&DaemonCommand::matches), name)); ++ list::iterator it = find_if(mCommands.begin(), mCommands.end(), [&name](const DaemonCommand *dc) { return dc->matches(name); }); + if (it != mCommands.end()) { + ms_mutex_lock(&mMutex); + (*it)->exec(this, args); +diff --git a/libxsd/xsd/cxx/config.hxx b/libxsd/xsd/cxx/config.hxx +index 076b107f5..385841731 100644 +--- a/libxsd/xsd/cxx/config.hxx ++++ b/libxsd/xsd/cxx/config.hxx +@@ -19,7 +19,7 @@ + # endif + #else + # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +-# ifdef __GNUC__ ++# if defined(__GNUC__) && !defined(__clang__) + # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 + # define XSD_CXX11_NULLPTR + # endif +diff --git a/src/conference/session/streams-group.cpp b/src/conference/session/streams-group.cpp +index bff739dda..84277a6b7 100644 +--- a/src/conference/session/streams-group.cpp ++++ b/src/conference/session/streams-group.cpp +@@ -447,11 +447,11 @@ float StreamsGroup::computeOverallQuality(_functor func){ + } + + float StreamsGroup::getAverageQuality(){ +- return computeOverallQuality(mem_fun(&Stream::getAverageQuality)); ++ return computeOverallQuality(mem_fn(&Stream::getAverageQuality)); + } + + float StreamsGroup::getCurrentQuality(){ +- return computeOverallQuality(mem_fun(&Stream::getCurrentQuality)); ++ return computeOverallQuality(mem_fn(&Stream::getCurrentQuality)); + } + + int StreamsGroup::getAvpfRrInterval()const{ +@@ -481,11 +481,11 @@ bool StreamsGroup::avpfEnabled() const{ + } + + void StreamsGroup::refreshSockets(){ +- forEach(mem_fun(&Stream::refreshSockets)); ++ forEach(mem_fn(&Stream::refreshSockets)); + } + + void StreamsGroup::computeAndReportBandwidth(){ +- forEach(mem_fun(&Stream::updateBandwidthReports)); ++ forEach(mem_fn(&Stream::updateBandwidthReports)); + + if (!bctbx_log_level_enabled(BCTBX_LOG_DOMAIN, BCTBX_LOG_MESSAGE)) return; + +@@ -540,7 +540,7 @@ void StreamsGroup::finish(){ + mIceService->finish(); // finish ICE first, as it has actions on the streams. + for (auto & ss : mSharedServices) ss.second->checkDestroy(); + mSharedServices.clear(); +- forEach(mem_fun(&Stream::finish)); ++ forEach(mem_fn(&Stream::finish)); + mFinished = true; + } + +-- +2.41.0 + diff --git a/pkgs/development/libraries/liblinphone/default.nix b/pkgs/development/libraries/liblinphone/default.nix index 53c56fa36385..c4b792e673fc 100644 --- a/pkgs/development/libraries/liblinphone/default.nix +++ b/pkgs/development/libraries/liblinphone/default.nix @@ -13,6 +13,7 @@ , sqlite , stdenv , xercesc +, zxing-cpp }: stdenv.mkDerivation rec { @@ -28,6 +29,12 @@ stdenv.mkDerivation rec { hash = "sha256-kQZePMa7MTaSJLEObM8khfSFYLqhlgTcVyKfTPLwKYU="; }; + patches = [ + # zxing-cpp 2.0+ requires C++ 17 + # Manual backport as upstream ran formatters in the meantime + ./backport-cpp17.patch + ]; + postPatch = '' substituteInPlace src/CMakeLists.txt \ --replace "jsoncpp_object" "jsoncpp" \ @@ -38,7 +45,6 @@ stdenv.mkDerivation rec { "-DENABLE_STATIC=NO" # Do not build static libraries "-DENABLE_UNIT_TESTS=NO" # Do not build test executables "-DENABLE_STRICT=NO" # Do not build with -Werror - "-DENABLE_QRCODE=NO" # Does not build with zxing-cpp 2 ]; buildInputs = [ @@ -56,6 +62,7 @@ stdenv.mkDerivation rec { (python3.withPackages (ps: [ ps.pystache ps.six ])) sqlite xercesc + zxing-cpp ]; nativeBuildInputs = [