aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2024-04-21 02:59:18 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2024-04-21 03:02:37 +0000
commita78b560136addb37b700c950ddceea25fb2da9b8 (patch)
treed23e8b04ef95ba9806d0c676a19220e47ad3ca20
parent21051e9e434f520415b3e3fbcfafaba640d556cf (diff)
downloadports-a78b560136addb37b700c950ddceea25fb2da9b8.tar.gz
ports-a78b560136addb37b700c950ddceea25fb2da9b8.zip
misc/py-onnx: Link with bundled protobuf-22.3 to prevent run-time failures
-rw-r--r--misc/py-onnx/Makefile24
-rw-r--r--misc/py-onnx/distinfo10
-rw-r--r--misc/py-onnx/files/patch-CMakeLists.txt10
3 files changed, 37 insertions, 7 deletions
diff --git a/misc/py-onnx/Makefile b/misc/py-onnx/Makefile
index f39307b4743f..1ad4f7d9cbb5 100644
--- a/misc/py-onnx/Makefile
+++ b/misc/py-onnx/Makefile
@@ -1,8 +1,16 @@
PORTNAME= onnx
DISTVERSION= 1.16.0
+PORTREVISION= 1
CATEGORIES= misc # machine-learning
-MASTER_SITES= PYPI
+MASTER_SITES= PYPI \
+ https://github.com/abseil/abseil-cpp/archive/refs/tags/:abseil \
+ https://github.com/protocolbuffers/protobuf/releases/download/v22.3/:protobuf # use downloaded protobuf-22.3
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTFILES= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} \
+ 20230125.3.tar.gz:abseil \
+ protobuf-22.3.tar.gz:protobuf # use downloaded protobuf-22.3
+DIST_SUBDIR= onnx
+EXTRACT_ONLY= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
MAINTAINER= yuri@FreeBSD.org
COMMENT= Open Neural Network eXchange
@@ -18,8 +26,8 @@ BUILD_DEPENDS= bash:shells/bash \
${PYTHON_PKGNAMEPREFIX}pytest-runner>=0:devel/py-pytest-runner@${PY_FLAVOR} \
${PY_SETUPTOOLS} \
${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
-LIB_DEPENDS= libabsl_base.so:devel/abseil \
- libprotobuf.so:devel/protobuf
+#LIB_DEPENDS= libabsl_base.so:devel/abseil \
+ libprotobuf.so:devel/protobuf # disable packaged protobuf
RUN_DEPENDS= ${PYNUMPY} \
${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}typing-extensions>=3.6.2.1:devel/py-typing-extensions@${PY_FLAVOR}
@@ -32,11 +40,21 @@ CXXFLAGS+= -Dstat64=stat
SHEBANG_FILES= tools/protoc-gen-mypy.sh.in
+CONFLICTS_BUILD= protobuf # use downloaded protobuf-22.3
+
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
TEST_WRKSRC= ${WRKSRC}/onnx/test
BINARY_ALIAS= python=${PYTHON_CMD}
+post-patch: # replace protobuf-24+ with protobuf-lite-22.3
+ @${REINPLACE_CMD} \
+ -e ' \
+ s|set(ProtobufURL https://github.com/protocolbuffers/protobuf/releases/download/v22.3/|set(ProtobufURL file://${DISTDIR}/${DIST_SUBDIR}/|; \
+ s|set(AbseilURL https://github.com/abseil/abseil-cpp/archive/refs/tags/|set(AbseilURL file://${DISTDIR}/${DIST_SUBDIR}/| \
+ ' \
+ ${WRKSRC}/CMakeLists.txt
+
post-install:
@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/onnx/onnx_cpp2py_export*.so
diff --git a/misc/py-onnx/distinfo b/misc/py-onnx/distinfo
index 1e6ebb954add..2289ca153cfb 100644
--- a/misc/py-onnx/distinfo
+++ b/misc/py-onnx/distinfo
@@ -1,3 +1,7 @@
-TIMESTAMP = 1713580433
-SHA256 (onnx-1.16.0.tar.gz) = 237c6987c6c59d9f44b6136f5819af79574f8d96a760a1fa843bede11f3822f7
-SIZE (onnx-1.16.0.tar.gz) = 12303017
+TIMESTAMP = 1713648416
+SHA256 (onnx/onnx-1.16.0.tar.gz) = 237c6987c6c59d9f44b6136f5819af79574f8d96a760a1fa843bede11f3822f7
+SIZE (onnx/onnx-1.16.0.tar.gz) = 12303017
+SHA256 (onnx/20230125.3.tar.gz) = 5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36
+SIZE (onnx/20230125.3.tar.gz) = 2119655
+SHA256 (onnx/protobuf-22.3.tar.gz) = 4101e11ef41afa91cac1bd95483cb781626781ae1a331501ed8379f2d82ca9bc
+SIZE (onnx/protobuf-22.3.tar.gz) = 4919899
diff --git a/misc/py-onnx/files/patch-CMakeLists.txt b/misc/py-onnx/files/patch-CMakeLists.txt
index c658385d91e3..21f7bfc0b494 100644
--- a/misc/py-onnx/files/patch-CMakeLists.txt
+++ b/misc/py-onnx/files/patch-CMakeLists.txt
@@ -1,6 +1,8 @@
+- use downloaded protobuf-22.3
+
--- CMakeLists.txt.orig 2024-03-05 00:46:58 UTC
+++ CMakeLists.txt
-@@ -19,7 +19,7 @@ option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using
+@@ -19,12 +19,12 @@ option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using
option(ONNX_BUILD_BENCHMARKS "Build ONNX micro-benchmarks" OFF)
option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using protobuf shared library. Sets PROTOBUF_USE_DLLS CMAKE Flag and Protobuf_USE_STATIC_LIBS. " OFF)
@@ -9,3 +11,9 @@
option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON)
option(ONNX_WERROR "Build with Werror" OFF)
option(ONNX_COVERAGE "Build with coverage instrumentation" OFF)
+ option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF)
+-option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF)
++option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." ON) # workaround for the failure, see https://github.com/onnx/optimizer/issues/38#issuecomment-817058821
+ option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF)
+ option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for onnx operator schemas." OFF)
+ option(ONNX_USE_UNITY_BUILD "Enable Unity (Jumbo) build for" OFF)