git: b1402eab815c - main - misc/py-tflite-support: update depends for absl-py; unbreak for clang 19+

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 04 Mar 2025 07:42:33 UTC
The branch main has been updated by yuri:

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

commit b1402eab815c782a2f630eac82661c0e85bc87a8
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2025-03-04 07:41:35 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-03-04 07:41:35 +0000

    misc/py-tflite-support: update depends for absl-py; unbreak for clang 19+
    
    PR:             284843
---
 misc/py-tflite-support/Makefile                    |  6 ++--
 .../files/patch-include_flatbuffers_flatbuffers.h  | 34 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/misc/py-tflite-support/Makefile b/misc/py-tflite-support/Makefile
index e2bfc0d5c023..79ba00be09ba 100644
--- a/misc/py-tflite-support/Makefile
+++ b/misc/py-tflite-support/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	tflite-support
 DISTVERSION=	0.1.0a1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	misc # machine-learning
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -11,11 +11,9 @@ WWW=		https://www.tensorflow.org/
 
 LICENSE=	APACHE20
 
-BROKEN_FreeBSD_15=	compilation fails with clang-19, and it isn't clear how to upgrade, see https://github.com/tensorflow/tflite-support/issues/991
-
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pybind11>=2.4:devel/py-pybind11@${PY_FLAVOR}
 RUN_DEPENDS=	${PYNUMPY} \
-		${PYTHON_PKGNAMEPREFIX}absl>=0.7.0:devel/py-absl@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}absl-py>=0.7.0:devel/py-absl-py@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pybind11>=2.4:devel/py-pybind11@${PY_FLAVOR}
 
 USES=		compiler:c++14-lang python
diff --git a/misc/py-tflite-support/files/patch-include_flatbuffers_flatbuffers.h b/misc/py-tflite-support/files/patch-include_flatbuffers_flatbuffers.h
new file mode 100644
index 000000000000..28c4d34cb2b6
--- /dev/null
+++ b/misc/py-tflite-support/files/patch-include_flatbuffers_flatbuffers.h
@@ -0,0 +1,34 @@
+'vector_downward &operator=(vector_downward &&other)' wants an rvalue.
+other.buf_ is a lvalue.
+
+Newer clang compilers are stricter about this.
+clang++19 and later complain:
+
+include/flatbuffers/flatbuffers.h:1866:12: error: overload resolution selected deleted operator '='
+ 1866 |       buf_ = other.buf_;
+      |       ~~~~ ^ ~~~~~~~~~~
+
+For this py-tflite-support port, if you comment out TableKeyComparator &operator=(),
+it builds.
+
+Another fix is to convert the lvalue to an rvalue using std::move()
+which is not an expensive operation.  That also builds with older
+or newe clang++.
+
+
+--- include/flatbuffers/flatbuffers.h.orig	2020-03-20 02:52:36 UTC
++++ include/flatbuffers/flatbuffers.h
+@@ -1862,10 +1862,12 @@ class FlatBufferBuilder {
+     vector_downward &buf_;
+ 
+    private:
++#if 1
+     TableKeyComparator &operator=(const TableKeyComparator &other) {
+-      buf_ = other.buf_;
++      buf_ = std::move(other.buf_);
+       return *this;
+     }
++#endif
+   };
+   /// @endcond
+