aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Kubo da Costa <rakuco@FreeBSD.org>2023-07-16 12:56:40 +0000
committerRaphael Kubo da Costa <rakuco@FreeBSD.org>2023-07-16 13:05:22 +0000
commite7f65a58f219d0f6f4e2d3b48e4ee431081ef92b (patch)
tree5e42f7f1fa73a2e5abf9a12dad1383be59174531
parentb856ee2ca2c10315bb383f94ee374995400aea50 (diff)
downloadports-e7f65a58f219d0f6f4e2d3b48e4ee431081ef92b.tar.gz
ports-e7f65a58f219d0f6f4e2d3b48e4ee431081ef92b.zip
net-im/libquotient: Fix the build on FreeBSD releases with LLVM < 14
Older libc++ releases have a bug, https://reviews.llvm.org/D107199, that prevents `connectSingleShot()` in this port from working in certain cases. The current workaround was to just avoid compiling the test that caused the build to fail, but it does not fix the problem for consumer ports like net-im/neochat. The easiest solution in this case is to make the port fall back to a code path that does not use `std::bind_front()` on FreeBSD versions with older LLVM releases. Test Plan: The port built fine on 12.4-i386 (LLVM 13.0.0), 13.2-amd64 (LLVM 14.0.3) and 14-amd64 (LLVM 16). I didn't bother to test 13.1 because it's going EOL at the end of the month anyway. Approved by: kde (arrowd) MFH: 2023Q3 Differential Revision: https://reviews.freebsd.org/D41044
-rw-r--r--net-im/libquotient/Makefile10
-rw-r--r--net-im/libquotient/files/patch-lib_qt__connection__util.h52
2 files changed, 54 insertions, 8 deletions
diff --git a/net-im/libquotient/Makefile b/net-im/libquotient/Makefile
index 5f797562c844..a7baa9492b5b 100644
--- a/net-im/libquotient/Makefile
+++ b/net-im/libquotient/Makefile
@@ -1,5 +1,6 @@
PORTNAME= libquotient
DISTVERSION= 0.7.1
+PORTREVISION= 1
CATEGORIES= net-im
MAINTAINER= adridg@FreeBSD.org
@@ -29,11 +30,4 @@ CC= ${LLVM_PREFIX}/bin/clang
CPP= ${LLVM_PREFIX}/bin/clang-cpp
CXX= ${LLVM_PREFIX}/bin/clang++
-
-.include <bsd.port.pre.mk>
-
-.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1301507
-CMAKE_ARGS+= -DBUILD_TESTING=OFF
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/net-im/libquotient/files/patch-lib_qt__connection__util.h b/net-im/libquotient/files/patch-lib_qt__connection__util.h
new file mode 100644
index 000000000000..e180df41eedd
--- /dev/null
+++ b/net-im/libquotient/files/patch-lib_qt__connection__util.h
@@ -0,0 +1,52 @@
+The call std::bind_front() below only works from LLVM 14 on because libc++
+needs https://reviews.llvm.org/D107199 to work correctly, otherwise uses of
+connectSingleShot() fail. See net-im/neochat for example [1]:
+
+In file included from /wrkdirs/usr/ports/net-im/neochat/work/neochat-23.04.2/src/controller.cpp:5:
+In file included from /wrkdirs/usr/ports/net-im/neochat/work/neochat-23.04.2/src/controller.h:6:
+In file included from /usr/local/include/qt5/QtCore/QObject:1:
+In file included from /usr/local/include/qt5/QtCore/qobject.h:46:
+In file included from /usr/local/include/qt5/QtCore/qobjectdefs.h:48:
+In file included from /usr/local/include/qt5/QtCore/qnamespace.h:43:
+In file included from /usr/local/include/qt5/QtCore/qglobal.h:142:
+In file included from /usr/include/c++/v1/algorithm:653:
+In file included from /usr/include/c++/v1/functional:495:
+In file included from /usr/include/c++/v1/__functional/bind_front.h:14:
+/usr/include/c++/v1/__functional/perfect_forward.h:77:9: error: no matching constructor for initialization of 'tuple<void (Controller::*)(), Controller *>'
+ __bound_(_VSTD::forward<_BoundArgs>(__bound)...) { }
+ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/usr/local/include/Quotient/qt_connection_util.h:22:14: note: in instantiation of function template specialization 'std::__perfect_forward_impl<std::__bind_front_op, std::__tuple_types<void (Controller::*)(), Controller *>, std::__tuple_indices<0, 1>>::__perfect_forward_impl<std::__perfect_forward_impl<std::__bind_front_op, std::__tuple_types<void (Controller::*)(), Controller *>, std::__tuple_indices<0, 1>> &>' requested here
+ [slotLike, pConn = std::move(pConn)](const auto&... args)
+ ^
+/usr/local/include/Quotient/qt_connection_util.h:93:23: note: in instantiation of function template specialization 'Quotient::_impl::connect<Quotient::_impl::SingleShot, Quotient::Connection, void (Quotient::Connection::*)(), Controller, std::__perfect_forward_impl<std::__bind_front_op, std::__tuple_types<void (Controller::*)(), Controller *>, std::__tuple_indices<0, 1>>>' requested here
+ return _impl::connect<_impl::SingleShot>(
+ ^
+/wrkdirs/usr/ports/net-im/neochat/work/neochat-23.04.2/src/controller.cpp:372:25: note: in instantiation of function template specialization 'Quotient::connectSingleShot<Controller, void (Controller::*)(), Quotient::Connection, void (Quotient::Connection::*)()>' requested here
+ connectSingleShot(connection, &Connection::syncDone, this, &Controller::initiated);
+ ^
+
+[1] https://pkg-status.freebsd.org/beefy2/data/124amd64-quarterly/8898bf465b47/logs/neochat-23.04.2.log
+
+--- lib/qt_connection_util.h
++++ lib/qt_connection_util.h
+@@ -3,6 +3,8 @@
+
+ #pragma once
+
++#include <sys/param.h> // For __FreeBSD_version
++
+ #include "function_traits.h"
+
+ #include <QtCore/QPointer>
+@@ -81,7 +83,10 @@ inline auto connectSingleShot(auto* sender, auto signal, ContextT* context,
+ // object has to be pre-bound to the slot to make it self-contained
+ if constexpr (_impl::PmfSlot<SlotT, ContextT>) {
+ auto&& boundSlot =
+-# if __cpp_lib_bind_front // Needs Apple Clang 13 (other platforms are fine)
++# if __cpp_lib_bind_front && \
++ !defined(__FreeBSD_version) || __FreeBSD_version >= 1301504
++ // This requires LLVM >= 14, this only works with libc++ commit
++ // https://reviews.llvm.org/D107199.
+ std::bind_front(slot, context);
+ # else
+ [context, slot](const auto&... args)