Re: Installing Python2.7 in 14-RELEASE

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Tue, 14 May 2024 12:00:52 UTC
From: Odhiambo Washington <odhiambo@gmail.com>
Subject: Re: Installing Python2.7 in 14-RELEASE
Date: Tue, 14 May 2024 11:39:30 +0300

> I am using openssl from the ports.
> I checked the build log and saw:
> 
> ```
> #warning "Make sure new member of socket address initialized"
>  ^
> 1 warning generated.
> warning: openssl 0x00000000 is too old for _hashlib
> building dbm using ndbm
> 
> Python build finished, but the necessary bits to build these modules were not found:
> _bsddb             _hashlib           dl
> imageop            linuxaudiodev      spwd
> sunaudiodev
> To find the necessary bits, look in setup.py in detect_modules() for the module's name.
> 
> ===>  Staging for python27-2.7.18
> ===>   python27-2.7.18 depends on file: /usr/local/lib/libcrypto.so.12 - found
> ===>   Generating temporary packing list
> install  -s -m 555 python /usr/ports/lang/python27/work/stage/usr/local/bin/python2.7
> if test -f libpython2.7.so; then  if test -n "" ; then  install  -s -m 0644  /usr/ports/lang/python27/work/stage/usr/local/
> bin;  else  install  -s -m 0644 libpython2.7.so /usr/ports/lang/python27/work/stage/usr/local/lib/libpython2.7.so.1;  if
> test libpython2.7.so != libpython27.so.1; then  (cd /usr/ports/lang/python27/work/stage/usr/local/lib; ln -sf
> libpython2.7.so.1 libpython2.7.so)  fi  fi;  else true;  fi
> warning: openssl 0x00000000 is too old for _hashlib
> ```
> root@gw:/usr/ports/lang/python27 # /usr/local/bin/openssl version
> OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)
> root@gw:/usr/ports/lang/python27 # ls -al  /usr/local/bin/openssl
> -rwxr-xr-x  1 root wheel 828656 May 14 11:22 /usr/local/bin/openssl
> root@gw:/usr/ports/lang/python27 # ls -al /usr/bin/openssl
> -r-xr-xr-x  1 root wheel 970624 Nov 25 14:13 /usr/bin/openssl
> root@gw: /usr/ports/lang/python27  # /usr/bin/openssl version
> OpenSSL 3.0.12 24 Oct 2023 (Library: OpenSSL 3.0.12 24 Oct 2023)
> 
> I have DEFAULT_VERSIONS+=ssl=openssl

Please try following patch.

diff --git a/lang/python27/Makefile b/lang/python27/Makefile
index 8aeab6d28008..245835f5be22 100644
--- a/lang/python27/Makefile
+++ b/lang/python27/Makefile
@@ -120,7 +120,8 @@ post-patch:
 # 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} >= 1400092 && (${SSL_DEFAULT} == base || ${SSL_DEFAULT:Mopenssl3*} )
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400092 && (${SSL_DEFAULT} == base || \
+	${SSL_DEFAULT} == openssl || ${SSL_DEFAULT:Mopenssl3*} )
 	@${REINPLACE_CMD} -e 's|00907000|00000000|' \
 		${WRKSRC}/setup.py
 .endif

Regards.

---
Yasuhiro Kimura