git: 6c2f5fd23f9b - main - devel/thrift-c_glib: Fix build with openssl3

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Mon, 07 Aug 2023 12:27:09 UTC
The branch main has been updated by bofh:

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

commit 6c2f5fd23f9bd7ead34f2d7a70dcbad1eb70d3c6
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-07 02:29:05 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-07 11:54:43 +0000

    devel/thrift-c_glib: Fix build with openssl3
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 devel/thrift-c_glib/Makefile                       |  6 ----
 ..._thrift_c__glib_transport_thrift__ssl__socket.c | 35 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/devel/thrift-c_glib/Makefile b/devel/thrift-c_glib/Makefile
index fec3671f2a2c..f92aa8a86df8 100644
--- a/devel/thrift-c_glib/Makefile
+++ b/devel/thrift-c_glib/Makefile
@@ -28,12 +28,6 @@ USE_LDCONFIG=	yes
 
 PLIST_SUB+=	PORTVERSION="${PORTVERSION}"
 
-.include <bsd.port.options.mk>
-
-.if ( ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400092 && ${SSL_DEFAULT} == base ) || ${SSL_DEFAULT:Mopenssl3*}
-CXXFLAGS+=	-DOPENSSL_API_COMPAT=0x30000000L
-.endif
-
 post-patch:
 	@${REINPLACE_CMD} 's,-Werror,,' ${WRKSRC}/compiler/cpp/Makefile.am \
 		${WRKSRC}/lib/rb/ext/extconf.rb
diff --git a/devel/thrift-c_glib/files/patch-lib_c__glib_src_thrift_c__glib_transport_thrift__ssl__socket.c b/devel/thrift-c_glib/files/patch-lib_c__glib_src_thrift_c__glib_transport_thrift__ssl__socket.c
new file mode 100644
index 000000000000..93f34cc44d9b
--- /dev/null
+++ b/devel/thrift-c_glib/files/patch-lib_c__glib_src_thrift_c__glib_transport_thrift__ssl__socket.c
@@ -0,0 +1,35 @@
+--- lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c.orig	2023-08-07 02:22:44 UTC
++++ lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
+@@ -86,7 +86,7 @@ static unsigned long thrift_ssl_socket_static_id_funct
+ #endif
+ }
+ 
+-static void thrift_ssl_socket_static_locking_callback(int mode, int n, const char* unk, int id) 
++static void thrift_ssl_socket_static_locking_callback(int mode, int n, const char* unk, int id)
+ {
+   THRIFT_UNUSED_VAR (unk);
+   THRIFT_UNUSED_VAR (id);
+@@ -380,7 +380,7 @@ gboolean
+ thrift_ssl_socket_flush (ThriftTransport *transport, GError **error)
+ {
+   ThriftSSLSocket *ssl_socket = THRIFT_SSL_SOCKET (transport);
+- 
++
+   ThriftSocket *socket = THRIFT_SOCKET (transport);
+ 
+   ThriftTransportClass *ttc = THRIFT_TRANSPORT_GET_CLASS (transport);
+@@ -675,7 +675,9 @@ thrift_ssl_socket_initialize_openssl(void)
+   SSL_library_init();
+   ERR_load_crypto_strings();
+   SSL_load_error_strings();
++#if OPENSSL_VERSION_NUMBER < 0x30000000L
+   ERR_load_BIO_strings();
++#endif
+ 
+   /* Setup locking */
+   g_debug("We setup %d threads locks", thrift_ssl_socket_static_thread_setup());
+@@ -867,4 +869,3 @@ thrift_ssl_socket_context_initialize(ThriftSSLSocketPr
+ 
+   return context;
+ }
+-