git: 261d635f8715 - main - misc/mnn: Update 1.2.0 → 2.4.0

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 14 Mar 2023 09:57:06 UTC
The branch main has been updated by yuri:

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

commit 261d635f8715f14a163e74ce0c6b57ceb4a3f26e
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-03-14 09:56:50 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-03-14 09:57:04 +0000

    misc/mnn: Update 1.2.0 → 2.4.0
    
    Reported by:    portscout
---
 misc/mnn/Makefile                                  | 27 +++++++++++-----------
 misc/mnn/distinfo                                  |  6 ++---
 misc/mnn/files/patch-CMakeLists.txt                | 10 --------
 .../mnn/files/patch-tools_converter_CMakeLists.txt | 10 --------
 misc/mnn/pkg-plist                                 |  8 ++++---
 5 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/misc/mnn/Makefile b/misc/mnn/Makefile
index 1b9d7b134587..ddcf42bdc124 100644
--- a/misc/mnn/Makefile
+++ b/misc/mnn/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	mnn
-DISTVERSION=	1.2.0
-PORTREVISION=	5
+DISTVERSION=	2.4.0
 CATEGORIES=	misc # machine-learning
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -11,15 +10,19 @@ LICENSE=	APACHE20
 
 BROKEN_i386=	always_inline function '_mm_set1_ps' requires target feature 'sse', but would be inlined into function 'Vec4' that is compiled without support for 'sse'
 
-BUILD_DEPENDS=	bash:shells/bash \
-		flatc:devel/flatbuffers205 # until https://github.com/alibaba/MNN/issues/1922 is fixed
+BUILD_DEPENDS=	bash:shells/bash
+
+USES=		cmake:testing compiler:c++11-lang localbase shebangfix
+USE_LDCONFIG=	yes
 
-USES=		cmake compiler:c++11-lang localbase shebangfix
 USE_GITHUB=	yes
 GH_ACCOUNT=	alibaba
 GH_PROJECT=	MNN
+
 SHEBANG_GLOB=	*.sh
-USE_LDCONFIG=	yes
+
+CMAKE_TESTING_ON=	MNN_BUILD_TEST
+CMAKE_TESTING_TARGET=
 
 CXXFLAGS+=	-pthread
 LDFLAGS+=	-pthread
@@ -28,7 +31,7 @@ CFLAGS+=	-fPIC # workaround for https://github.com/alibaba/MNN/issues/553
 CXXFLAGS+=	-fPIC
 
 OPTIONS_DEFINE=		APPS CONVERTER HARD_FP
-OPTIONS_DEFAULT=	CONVERTER HARD_FP
+OPTIONS_DEFAULT=	APPS CONVERTER HARD_FP
 OPTIONS_SUB=		yes
 
 APPS_DESC=		Build ML training, quantization tools
@@ -48,22 +51,18 @@ CMAKE_ARGS+=	-DMNN_USE_AVX:BOOL=OFF \
 		-DMNN_USE_SSE:BOOL=OFF
 .endif
 
-pre-build: # https://github.com/alibaba/MNN/issues/648
-	@cd ${WRKSRC}/schema && FREEBSD_FLATC=${LOCALBASE}/bin/flatc ./generate.sh
-
 do-install-APPS-on:
-.for f in	MNNConvert MNNV2Basic.out mobilenetTest.out backendTest.out testModel.out testModelWithDescrisbe.out getPerformance.out checkInvalidValue.out timeProfile.out quantized.out \
+.for f in	MNNV2Basic.out mobilenetTest.out backendTest.out testModel.out getPerformance.out checkInvalidValue.out timeProfile.out quantized.out \
 		transformer.out train.out rawDataTransform.out dataTransformer.out runTrainDemo.out
 	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
 .endfor
 
 do-install-CONVERTER-on:
 	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/MNNConvert ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_LIB} ${BUILD_WRKSRC}/tools/converter/libMNNConvertDeps.so ${STAGEDIR}${PREFIX}/lib
 
-do-test:
+post-test:
 	@cd ${BUILD_WRKSRC} && \
-		${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DMNN_BUILD_TEST:BOOL=ON ${CMAKE_SOURCE_PATH} && \
-		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
 		cd ${BUILD_WRKSRC} && ./run_test.out
 
 .include <bsd.port.post.mk>
diff --git a/misc/mnn/distinfo b/misc/mnn/distinfo
index 00de57b88da2..6e8d2d6d35cd 100644
--- a/misc/mnn/distinfo
+++ b/misc/mnn/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1624209262
-SHA256 (alibaba-MNN-1.2.0_GH0.tar.gz) = b0e32d28e1b1c64904d6c1f810a48238430cf4ef5e8fdcd2ea4600e52c8a82ef
-SIZE (alibaba-MNN-1.2.0_GH0.tar.gz) = 103892968
+TIMESTAMP = 1678783312
+SHA256 (alibaba-MNN-2.4.0_GH0.tar.gz) = 3b9e2038caac293b0a3c97c7ef8361f6e3b4d72e3da13feaf1b1c864a8224f0b
+SIZE (alibaba-MNN-2.4.0_GH0.tar.gz) = 20154640
diff --git a/misc/mnn/files/patch-CMakeLists.txt b/misc/mnn/files/patch-CMakeLists.txt
deleted file mode 100644
index b817e27b5a62..000000000000
--- a/misc/mnn/files/patch-CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
---- CMakeLists.txt.orig	2021-06-11 09:17:13 UTC
-+++ CMakeLists.txt
-@@ -304,7 +304,6 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/include/
-                     ${CMAKE_CURRENT_LIST_DIR}/codegen/
-                     ${CMAKE_CURRENT_LIST_DIR}/schema/current/
-                     ${CMAKE_CURRENT_LIST_DIR}/3rd_party/
--                    ${CMAKE_CURRENT_LIST_DIR}/3rd_party/flatbuffers/include
-                     ${CMAKE_CURRENT_LIST_DIR}/3rd_party/half
-                     ${CMAKE_CURRENT_LIST_DIR}/3rd_party/imageHelper
-                     ${CMAKE_CURRENT_LIST_DIR}/3rd_party/OpenCLHeaders/
diff --git a/misc/mnn/files/patch-tools_converter_CMakeLists.txt b/misc/mnn/files/patch-tools_converter_CMakeLists.txt
deleted file mode 100644
index c82129bedf8c..000000000000
--- a/misc/mnn/files/patch-tools_converter_CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
---- tools/converter/CMakeLists.txt.orig	2021-06-11 09:17:13 UTC
-+++ tools/converter/CMakeLists.txt
-@@ -43,6 +43,7 @@ IF(MNN_BUILD_CONVERTER)
-   IF(MNN_BUILD_SHARED_LIBS)
-     add_library(MNNConvertDeps SHARED ${COMMON_SRC} ${MNN_CONVERTER_BACKENDS_OBJECTS} ${CMAKE_CURRENT_LIST_DIR}/../../3rd_party/flatbuffers/src/util.cpp $<TARGET_OBJECTS:MNNUtils>)
-     add_dependencies(MNNConvertDeps MNN)
-+    install(TARGETS MNNConvertDeps LIBRARY DESTINATION lib)
-   ELSE()
-     add_library(MNNConvertDeps STATIC ${COMMON_SRC} ${MNN_CONVERTER_BACKENDS_OBJECTS} ${CMAKE_CURRENT_LIST_DIR}/../../3rd_party/flatbuffers/src/util.cpp)
-   ENDIF()
diff --git a/misc/mnn/pkg-plist b/misc/mnn/pkg-plist
index b6b8563fafbd..857ebeb0594a 100644
--- a/misc/mnn/pkg-plist
+++ b/misc/mnn/pkg-plist
@@ -9,28 +9,30 @@
 %%APPS%%bin/rawDataTransform.out
 %%APPS%%bin/runTrainDemo.out
 %%APPS%%bin/testModel.out
-%%APPS%%bin/testModelWithDescrisbe.out
 %%APPS%%bin/timeProfile.out
 %%APPS%%bin/train.out
 %%APPS%%bin/transformer.out
 include/MNN/AutoTime.hpp
 include/MNN/ErrorCode.hpp
-include/MNN/expr/Executor.hpp
 include/MNN/HalideRuntime.h
 include/MNN/ImageProcess.hpp
 include/MNN/Interpreter.hpp
 include/MNN/MNNDefine.h
 include/MNN/MNNForwardType.h
+include/MNN/MNNSharedContext.h
 include/MNN/Matrix.h
 include/MNN/Rect.h
 include/MNN/Tensor.hpp
+include/MNN/expr/Executor.hpp
+include/MNN/expr/ExecutorScope.hpp
 include/MNN/expr/Expr.hpp
 include/MNN/expr/ExprCreator.hpp
 include/MNN/expr/MathOp.hpp
 include/MNN/expr/Module.hpp
 include/MNN/expr/NeuralNetWorkOp.hpp
 include/MNN/expr/Optimizer.hpp
+include/MNN/expr/Scope.hpp
 lib/libMNN.so
-%%APPS%%lib/libMNN_Express.so
 %%CONVERTER%%lib/libMNNConvertDeps.so
 %%APPS%%lib/libMNNTrain.so
+%%APPS%%lib/libMNN_Express.so