git: c0cc6dc80c47 - main - www/lagrange: Fix build with openssl3

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

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

commit c0cc6dc80c47d64dd9211daa1e59a4a78f8400f3
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-07 17:29:55 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-07 22:00:18 +0000

    www/lagrange: Fix build with openssl3
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 www/lagrange/Makefile                              |  8 +-----
 .../patch-lib_the__Foundation_src_tlsrequest.c     | 33 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/www/lagrange/Makefile b/www/lagrange/Makefile
index 833942da2481..73dddd1179e1 100644
--- a/www/lagrange/Makefile
+++ b/www/lagrange/Makefile
@@ -31,10 +31,4 @@ OPTIONS_DEFINE=	SSE41
 SSE41_DESC=	Enable SSE4.1 support
 SSE41_CMAKE_ON=	-DTFDN_ENABLE_SSE41:BOOL=ON
 
-.include <bsd.port.pre.mk>
-
-.if ( ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400092 && ${SSL_DEFAULT} == base ) || ${SSL_DEFAULT:Mopenssl3*}
-CXXFLAGS+=	-DOPENSSL_API_COMPAT=0x30000000L
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/www/lagrange/files/patch-lib_the__Foundation_src_tlsrequest.c b/www/lagrange/files/patch-lib_the__Foundation_src_tlsrequest.c
new file mode 100644
index 000000000000..4a9b32d99641
--- /dev/null
+++ b/www/lagrange/files/patch-lib_the__Foundation_src_tlsrequest.c
@@ -0,0 +1,33 @@
+--- lib/the_Foundation/src/tlsrequest.c.orig	2023-08-07 17:23:22 UTC
++++ lib/the_Foundation/src/tlsrequest.c
+@@ -72,9 +72,9 @@ static iBool readAllFromBIO_(BIO *bio, iBlock *out) {
+ /*----------------------------------------------------------------------------------------------*/
+ 
+ iDeclareClass(CachedSession)
+-    
++
+ static const int maxSessionAge_CachedSession_ = 10 * 60; /* seconds */
+-    
++
+ struct Impl_CachedSession {
+     iObject          object;
+     iBlock           pemSession;
+@@ -249,7 +249,9 @@ void init_Context(iContext *d) {
+     SSL_load_error_strings();
+     ERR_load_crypto_strings();
+ #endif
++#if OPENSSL_VERSION_NUMBER < 0x30000000L
+     ERR_load_BIO_strings();
++#endif
+     d->ctx = SSL_CTX_new(TLS_client_method());
+     if (!d->ctx) {
+         iDebug("[TlsRequest] failed to initialize OpenSSL\n");
+@@ -1012,7 +1014,7 @@ static iBool readIncoming_TlsRequest_(iTlsRequest *d) 
+ 
+ static iThreadResult run_TlsRequest_(iThread *thread) {
+     iTlsRequest *d = userData_Thread(thread);
+-    /* Thread-local pointer to the current request so it can be accessed in the 
++    /* Thread-local pointer to the current request so it can be accessed in the
+        verify callback. */
+     iDebug("[TlsRequest] run_TlsRequest_: %zu bytes to send\n", size_Block(&d->sending));
+     setCurrentRequestForThread_Context_(context_, d);