git: ee5cf48426d3 - main - devel/py-awscrt: Do not use bundled libraries

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Tue, 29 Oct 2024 14:41:17 UTC
The branch main has been updated by sunpoet:

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

commit ee5cf48426d36b043110139be82378996872d596
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-10-29 14:19:15 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-10-29 14:38:33 +0000

    devel/py-awscrt: Do not use bundled libraries
    
    - Bump PORTREVISION for dependency change
---
 devel/py-awscrt/Makefile                | 20 +++++++++++++-
 devel/py-awscrt/files/patch-powerpc64le | 18 -------------
 devel/py-awscrt/files/patch-setup.py    | 46 +++++++--------------------------
 3 files changed, 28 insertions(+), 56 deletions(-)

diff --git a/devel/py-awscrt/Makefile b/devel/py-awscrt/Makefile
index 18cf282d49d2..800b2b5a4f9f 100644
--- a/devel/py-awscrt/Makefile
+++ b/devel/py-awscrt/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	awscrt
 PORTVERSION=	0.23.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -13,12 +14,29 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
+LIB_DEPENDS=	libaws-c-auth.so:security/aws-c-auth \
+		libaws-c-cal.so:security/aws-c-cal \
+		libaws-c-common.so:devel/aws-c-common \
+		libaws-c-compression.so:devel/aws-c-compression \
+		libaws-c-event-stream.so:devel/aws-c-event-stream \
+		libaws-c-http.so:devel/aws-c-http \
+		libaws-c-io.so:devel/aws-c-io \
+		libaws-c-mqtt.so:devel/aws-c-mqtt \
+		libaws-c-s3.so:devel/aws-c-s3 \
+		libaws-c-sdkutils.so:devel/aws-c-sdkutils \
+		libaws-checksums.so:devel/aws-checksums \
+		libcrypto.so:security/aws-lc \
+		libs2n.so:security/s2n-tls
 
-USES=		cmake:indirect python ssl
+USES=		localbase:ldflags python ssl
 USE_PYTHON=	autoplist concurrent pep517
 
 MAKE_ENV=	AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1
 
+# Clean up bundled libraries
+post-patch:
+	@${RM} -r ${WRKSRC}/crt/
+
 post-install:
 	${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' -exec ${STRIP_CMD} {} +
 
diff --git a/devel/py-awscrt/files/patch-powerpc64le b/devel/py-awscrt/files/patch-powerpc64le
deleted file mode 100644
index ebd7f1993820..000000000000
--- a/devel/py-awscrt/files/patch-powerpc64le
+++ /dev/null
@@ -1,18 +0,0 @@
---- crt/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c.orig	2024-07-03 21:50:24 UTC
-+++ crt/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c
-@@ -69,10 +69,15 @@ void OPENSSL_cpuid_setup(void) {
- 
- void OPENSSL_cpuid_setup(void) {
- #if defined(AT_HWCAP2)
-+#if defined(__linux__)
-   OPENSSL_ppc64le_hwcap2 = getauxval(AT_HWCAP2);
-+#elif defined(__FreeBSD__)
-+  elf_aux_info(AT_HWCAP2, &OPENSSL_ppc64le_hwcap2, sizeof(OPENSSL_ppc64le_hwcap2));
-+#endif
- #else
-   OPENSSL_ppc64le_hwcap2 = 0;
- #endif
-+
-   OPENSSL_cpucap_initialized = 1;
- 
-   // OPENSSL_ppccap is a 64-bit hex string which may start with "0x".
diff --git a/devel/py-awscrt/files/patch-setup.py b/devel/py-awscrt/files/patch-setup.py
index 0f9b5b31657a..ac7a17b4f95a 100644
--- a/devel/py-awscrt/files/patch-setup.py
+++ b/devel/py-awscrt/files/patch-setup.py
@@ -1,39 +1,11 @@
---- setup.py.orig	2024-10-21 22:20:04 UTC
+--- setup.py.orig	2024-10-23 17:56:10 UTC
 +++ setup.py
-@@ -12,7 +12,6 @@ import sysconfig
- import subprocess
- import sys
- import sysconfig
--from wheel.bdist_wheel import bdist_wheel
- if sys.platform == 'win32':
-     # distutils is deprecated in Python 3.10 and removed in 3.12. However, it still works because Python defines a compatibility interface as long as setuptools is installed.
-     # We don't have an official alternative for distutils.ccompiler as of September 2024. See: https://github.com/pypa/setuptools/issues/2806
-@@ -306,20 +305,6 @@ class awscrt_build_ext(setuptools.command.build_ext.bu
-         super().run()
+@@ -353,7 +353,7 @@ def awscrt_ext():
+         # In Brazil, both shared and static libs are available.
+         # But Lambda requires all shared libs to be explicitly packaged up.
+         # So it's simpler to link them in statically and have less runtime dependencies.
+-        libraries = [':lib{}.a'.format(x) for x in libraries]
++        libraries = [':lib{}.so'.format(x) for x in libraries]
  
- 
--class bdist_wheel_abi3(bdist_wheel):
--    def get_tag(self):
--        python, abi, plat = super().get_tag()
--        # on CPython, our wheels are abi3 and compatible back to 3.11
--        if python.startswith("cp") and sys.version_info >= (3, 13):
--            # 3.13 deprecates PyWeakref_GetObject(), adds alternative
--            return "cp313", "abi3", plat
--        elif python.startswith("cp") and sys.version_info >= (3, 11):
--            # 3.11 is the first stable ABI that has everything we need
--            return "cp311", "abi3", plat
--
--        return python, abi, plat
--
--
- def awscrt_ext():
-     # fetch the CFLAGS/LDFLAGS from env
-     extra_compile_args = os.environ.get('CFLAGS', '').split()
-@@ -468,6 +453,6 @@ setuptools.setup(
-     ],
-     python_requires='>=3.8',
-     ext_modules=[awscrt_ext()],
--    cmdclass={'build_ext': awscrt_build_ext, "bdist_wheel": bdist_wheel_abi3},
-+    cmdclass={'build_ext': awscrt_build_ext},
-     test_suite='test',
- )
+         # OpenBSD doesn't have librt; functions are found in libc instead.
+         if not sys.platform.startswith('openbsd'):