git: a5b371405775 - main - lang/python27: Fix build with OpenSSL 3 and later

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 03 Jun 2023 14:09:06 UTC
The branch main has been updated by bofh:

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

commit a5b3714057750ecbb8db8912edf5c481ff46ef2b
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-06-03 14:05:49 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-06-03 14:08:49 +0000

    lang/python27: Fix build with OpenSSL 3 and later
    
    PR:             271656
    Reported by:    exp-run
    Approved by:    portmgr (blanket)
---
 lang/python27/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lang/python27/Makefile b/lang/python27/Makefile
index b2784fe9435b..fc63dbf9e6ca 100644
--- a/lang/python27/Makefile
+++ b/lang/python27/Makefile
@@ -123,6 +123,16 @@ post-patch:
 		${WRKSRC}/setup.py
 .endif
 
+# This is just a dirty hack for building with OpenSSL 3.0.0 and later
+# There is no plain string OPENSSL_VERSION_NUMBER available in
+# openssl/opensslv.h so setup.py just detects the string as 00000000
+# However care should be taken for the OSVERSION. If OpenSSL 3.0.9
+# lands later the OSVERSION string should be fixed accordingly
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400089 && (${SSL_DEFAULT} == base || ${SSL_DEFAULT:Mopenssl3*} )
+	@${REINPLACE_CMD} -e 's|00907000|00000000|' \
+		${WRKSRC}/setup.py
+.endif
+
 post-install:
 	for i in ${STAGEDIR}${PREFIX}/lib/python2.7/lib-dynload/*.so; do \
 		${STRIP_CMD} $$i; done						# Strip shared extensions