git: 97eecf838ae8 - main - security/kleopatra: Fix build against libc++18

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Wed, 22 May 2024 19:51:20 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/ports/commit/?id=97eecf838ae8e88c56c7f97080adce0dc593a491

commit 97eecf838ae8e88c56c7f97080adce0dc593a491
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-05-22 19:08:41 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-05-22 19:51:01 +0000

    security/kleopatra: Fix build against libc++18
    
    libc++ 18 by default removes unique() in 'std::shared_ptr' (in <memory>), as
    a follow-up to this resolution:
    https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0521r0.html
    
    An alternative would be to get it back by defining
    _LIBCPP_ENABLE_CXX20_REMOVED_SHARED_PTR_UNIQUE before including the libc++
    headers, but trying to fight the standard may not be a wise move going forward,
    especially if/as other C++ libraries follow suit.
    
    Upstream MR (approved) is at
    https://invent.kde.org/pim/kleopatra/-/merge_requests/205.
    
    PR:             279139
    Approved by:    kde (maintainer)
    Approved by:    jrm (ports)
    Approved by:    markj (mentor)
---
 security/kleopatra/files/patch-src_crypto_recipient.cpp | 14 ++++++++++++++
 security/kleopatra/files/patch-src_crypto_sender.cpp    | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/security/kleopatra/files/patch-src_crypto_recipient.cpp b/security/kleopatra/files/patch-src_crypto_recipient.cpp
new file mode 100644
index 000000000000..7e5efab0e453
--- /dev/null
+++ b/security/kleopatra/files/patch-src_crypto_recipient.cpp
@@ -0,0 +1,14 @@
+Submitted upstream: https://invent.kde.org/pim/kleopatra/-/merge_requests/205.
+To remove when updating to next release.
+
+--- src/crypto/recipient.cpp.orig	2024-02-11 04:00:57 UTC
++++ src/crypto/recipient.cpp
+@@ -85,7 +85,7 @@ void Recipient::detach()
+ 
+ void Recipient::detach()
+ {
+-    if (d && !d.unique()) {
++    if (d && d.use_count() != 1) {
+         d.reset(new Private(*d));
+     }
+ }
diff --git a/security/kleopatra/files/patch-src_crypto_sender.cpp b/security/kleopatra/files/patch-src_crypto_sender.cpp
new file mode 100644
index 000000000000..b60c856ac95e
--- /dev/null
+++ b/security/kleopatra/files/patch-src_crypto_sender.cpp
@@ -0,0 +1,14 @@
+Submitted upstream: https://invent.kde.org/pim/kleopatra/-/merge_requests/205.
+To remove when updating to next release.
+
+--- src/crypto/sender.cpp.orig	2024-02-11 04:00:57 UTC
++++ src/crypto/sender.cpp
+@@ -91,7 +91,7 @@ void Sender::detach()
+ 
+ void Sender::detach()
+ {
+-    if (d && !d.unique()) {
++    if (d && d.use_count() != 1) {
+         d.reset(new Private(*d));
+     }
+ }