git: f32bf28fa273 - 2023Q3 - databases/libmemcached: Skip libcrypto.pc when using SSL from base system

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 31 Jul 2023 17:48:01 UTC
The branch 2023Q3 has been updated by sunpoet:

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

commit f32bf28fa27305b8f16a44c8f3f58aedc1394fbf
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-07-09 10:17:04 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-07-31 17:47:57 +0000

    databases/libmemcached: Skip libcrypto.pc when using SSL from base system
    
    - Bump PORTREVISION for package change
    
    (cherry picked from commit c25f0c013e88d84c620b2bb8c56158e9ca7f8bef)
---
 databases/libmemcached/Makefile                  | 10 +++++++++-
 databases/libmemcached/files/extra-patch-openssl | 11 +++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/databases/libmemcached/Makefile b/databases/libmemcached/Makefile
index e044f28499fd..71f031d3014f 100644
--- a/databases/libmemcached/Makefile
+++ b/databases/libmemcached/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	libmemcached
 PORTVERSION=	1.1.4
+PORTREVISION=	1
 CATEGORIES=	databases
 
 MAINTAINER=	sunpoet@FreeBSD.org
@@ -44,4 +45,11 @@ MURMUR_CMAKE_BOOL=	ENABLE_HASH_MURMUR
 SASL_CMAKE_BOOL=	ENABLE_SASL
 SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+# Skip libcrypto.pc while using OpenSSL from base system on older FreeBSD versions which does not skip this file
+.if ${SSL_DEFAULT} == base && !exists(/usr/libdata/pkgconfig/libcrypto.pc)
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-openssl
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/databases/libmemcached/files/extra-patch-openssl b/databases/libmemcached/files/extra-patch-openssl
new file mode 100644
index 000000000000..bf65fa7f4ece
--- /dev/null
+++ b/databases/libmemcached/files/extra-patch-openssl
@@ -0,0 +1,11 @@
+--- src/libhashkit/CMakeLists.txt.orig	2023-03-06 08:47:30 UTC
++++ src/libhashkit/CMakeLists.txt
+@@ -45,7 +45,7 @@ if(ENABLE_OPENSSL_CRYPTO)
+                 if(OPENSSL_CRYPTO_LIBRARY)
+                         target_compile_definitions(libhashkit PRIVATE HAVE_OPENSSL_CRYPTO)
+                         target_link_libraries(libhashkit PUBLIC OpenSSL::Crypto)
+-                        pkgconfig_export(REQUIRES_PRIVATE libcrypto)
++                        pkgconfig_export(REQUIRES_PRIVATE "")
+                 else()
+                         message(WARNING "Could not find OpenSSL::Crypto")
+                 endif()