git: 23fc86a8b236 - main - misc/caffe: Re-add port: Fast open framework for deep learning

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 29 Sep 2022 08:47:46 UTC
The branch main has been updated by yuri:

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

commit 23fc86a8b2366268ee83462175702b90c2074bc2
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-09-29 08:46:55 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-09-29 08:47:43 +0000

    misc/caffe: Re-add port: Fast open framework for deep learning
---
 MOVED                                        |   1 -
 misc/Makefile                                |   1 +
 misc/caffe/Makefile                          |  48 +++++++++
 misc/caffe/distinfo                          |   7 ++
 misc/caffe/files/patch-python_CMakeLists.txt |  25 +++++
 misc/caffe/pkg-descr                         |   4 +
 misc/caffe/pkg-plist                         | 141 +++++++++++++++++++++++++++
 7 files changed, 226 insertions(+), 1 deletion(-)

diff --git a/MOVED b/MOVED
index 697b4083d0ce..0dc66def2427 100644
--- a/MOVED
+++ b/MOVED
@@ -15423,7 +15423,6 @@ games/kiki||2020-09-19|Has expired: Uses deprecated version of python
 games/lightyears||2020-09-19|Has expired: Uses deprecated version of python
 games/outerspace||2020-09-19|Has expired: Uses deprecated version of python
 games/pachi-game-engine||2020-09-19|Has expired: Uses deprecated version of python
-graphics/caffe||2020-09-19|Has expired: Uses deprecated version of python
 graphics/kudu||2020-09-19|Has expired: Uses deprecated version of python
 graphics/pecomato||2020-09-19|Has expired: Uses deprecated version of python
 graphics/py-editobj||2020-09-19|Has expired: Uses deprecated version of python
diff --git a/misc/Makefile b/misc/Makefile
index c333f8ac2bc7..330130110555 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -32,6 +32,7 @@
     SUBDIR += broot
     SUBDIR += bsod
     SUBDIR += buffer
+    SUBDIR += caffe
     SUBDIR += cheat
     SUBDIR += chef
     SUBDIR += chmlib
diff --git a/misc/caffe/Makefile b/misc/caffe/Makefile
new file mode 100644
index 000000000000..c92675496c27
--- /dev/null
+++ b/misc/caffe/Makefile
@@ -0,0 +1,48 @@
+PORTNAME=	caffe
+DISTVERSION=	1.0-136
+DISTVERSIONSUFFIX=	-g9b891540
+CATEGORIES=	misc # machine-learning
+
+PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
+PATCHFILES+=	7f503bd9a19758a173064e299ab9d4cac65ed60f.patch:-p1 # opencv4 fix
+PATCHFILES+=	1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch:-p1 # protobuf3 fix
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Fast open framework for deep learning
+WWW=		https://caffe.berkeleyvision.org/
+
+LICENSE=	BSD2CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	bash:shells/bash \
+		${PYNUMPY}
+LIB_DEPENDS=	libsnappy.so:archivers/snappy \
+		libleveldb.so:databases/leveldb \
+		liblmdb.so:databases/lmdb \
+		libboost_system.so:devel/boost-libs \
+		${PY_BOOST} \
+		libgflags.so:devel/gflags \
+		libglog.so:devel/glog \
+		libprotobuf.so:devel/protobuf \
+		libopencv_highgui.so:graphics/opencv \
+		libopenblas.so:math/openblas \
+		libhdf5.so:science/hdf5
+RUN_DEPENDS=	${PYNUMPY} \
+		${PYTHON_PKGNAMEPREFIX}protobuf>0:devel/py-protobuf@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pydot>0:graphics/py-pydot@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pydotplus>0:graphics/py-pydotplus@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}scikit-image>0:graphics/py-scikit-image@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}
+
+USES=		cmake fortran pkgconfig python
+USE_LDCONFIG=	yes
+
+GH_ACCOUNT=	BVLC
+USE_GITHUB=	yes
+
+CMAKE_ARGS=	-DBLAS=Open \
+		-DPYTHON_EXECUTABLE=${PYTHON_CMD} \
+		-DFREEBSD_PYTHONPREFIX_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR}
+
+.include <bsd.port.mk>
diff --git a/misc/caffe/distinfo b/misc/caffe/distinfo
new file mode 100644
index 000000000000..5b49dfc5a6c5
--- /dev/null
+++ b/misc/caffe/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1664432089
+SHA256 (BVLC-caffe-1.0-136-g9b891540_GH0.tar.gz) = c3fc96788aece6e90978c914382df3e8dbdb5482a6ba76a5d62147984a7ff598
+SIZE (BVLC-caffe-1.0-136-g9b891540_GH0.tar.gz) = 8519353
+SHA256 (7f503bd9a19758a173064e299ab9d4cac65ed60f.patch) = 2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9
+SIZE (7f503bd9a19758a173064e299ab9d4cac65ed60f.patch) = 4645
+SHA256 (1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch) = 65be5a646ab32e9b277b4352b702a57ac6c79af5258e12e33b9751f07d1031aa
+SIZE (1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch) = 936
diff --git a/misc/caffe/files/patch-python_CMakeLists.txt b/misc/caffe/files/patch-python_CMakeLists.txt
new file mode 100644
index 000000000000..f35ac9083cca
--- /dev/null
+++ b/misc/caffe/files/patch-python_CMakeLists.txt
@@ -0,0 +1,25 @@
+--- python/CMakeLists.txt.orig	2020-02-13 07:20:36 UTC
++++ python/CMakeLists.txt
+@@ -23,12 +23,12 @@ endif()
+ 
+ # ---[ Install
+ # scripts
+-file(GLOB python_files *.py requirements.txt)
+-install(FILES ${python_files} DESTINATION python)
++#file(GLOB python_files *.py requirements.txt)
++#install(FILES ${python_files} DESTINATION python)
+ 
+ # module
+ install(DIRECTORY caffe
+-    DESTINATION python
++    DESTINATION ${FREEBSD_PYTHONPREFIX_SITELIBDIR}/caffe
+     FILES_MATCHING
+     PATTERN "*.py"
+     PATTERN "ilsvrc_2012_mean.npy"
+@@ -36,5 +36,5 @@ install(DIRECTORY caffe
+     )
+ 
+ # _caffe.so
+-install(TARGETS pycaffe  DESTINATION python/caffe)
++install(TARGETS pycaffe  DESTINATION ${FREEBSD_PYTHONPREFIX_SITELIBDIR}/caffe)
+ 
diff --git a/misc/caffe/pkg-descr b/misc/caffe/pkg-descr
new file mode 100644
index 000000000000..17f12e6de3e9
--- /dev/null
+++ b/misc/caffe/pkg-descr
@@ -0,0 +1,4 @@
+Caffe is a deep learning framework made with expression, speed, and modularity
+in mind. It is developed by the Berkeley Vision and Learning Center (BVLC) and
+by community contributors. Yangqing Jia created the project during his PhD at
+UC Berkeley. Caffe is released under the BSD 2-Clause license.
diff --git a/misc/caffe/pkg-plist b/misc/caffe/pkg-plist
new file mode 100644
index 000000000000..cc1c0a33b09e
--- /dev/null
+++ b/misc/caffe/pkg-plist
@@ -0,0 +1,141 @@
+bin/caffe
+bin/classification
+bin/compute_image_mean
+bin/convert_cifar_data
+bin/convert_imageset
+bin/convert_mnist_data
+bin/convert_mnist_siamese_data
+bin/extract_features
+bin/upgrade_net_proto_binary
+bin/upgrade_net_proto_text
+bin/upgrade_solver_proto_text
+include/caffe/blob.hpp
+include/caffe/caffe.hpp
+include/caffe/common.hpp
+include/caffe/data_transformer.hpp
+include/caffe/filler.hpp
+include/caffe/internal_thread.hpp
+include/caffe/layer.hpp
+include/caffe/layer_factory.hpp
+include/caffe/layers/absval_layer.hpp
+include/caffe/layers/accuracy_layer.hpp
+include/caffe/layers/argmax_layer.hpp
+include/caffe/layers/base_conv_layer.hpp
+include/caffe/layers/base_data_layer.hpp
+include/caffe/layers/batch_norm_layer.hpp
+include/caffe/layers/batch_reindex_layer.hpp
+include/caffe/layers/bias_layer.hpp
+include/caffe/layers/bnll_layer.hpp
+include/caffe/layers/clip_layer.hpp
+include/caffe/layers/concat_layer.hpp
+include/caffe/layers/contrastive_loss_layer.hpp
+include/caffe/layers/conv_layer.hpp
+include/caffe/layers/crop_layer.hpp
+include/caffe/layers/cudnn_conv_layer.hpp
+include/caffe/layers/cudnn_deconv_layer.hpp
+include/caffe/layers/cudnn_lcn_layer.hpp
+include/caffe/layers/cudnn_lrn_layer.hpp
+include/caffe/layers/cudnn_pooling_layer.hpp
+include/caffe/layers/cudnn_relu_layer.hpp
+include/caffe/layers/cudnn_sigmoid_layer.hpp
+include/caffe/layers/cudnn_softmax_layer.hpp
+include/caffe/layers/cudnn_tanh_layer.hpp
+include/caffe/layers/data_layer.hpp
+include/caffe/layers/deconv_layer.hpp
+include/caffe/layers/dropout_layer.hpp
+include/caffe/layers/dummy_data_layer.hpp
+include/caffe/layers/eltwise_layer.hpp
+include/caffe/layers/elu_layer.hpp
+include/caffe/layers/embed_layer.hpp
+include/caffe/layers/euclidean_loss_layer.hpp
+include/caffe/layers/exp_layer.hpp
+include/caffe/layers/filter_layer.hpp
+include/caffe/layers/flatten_layer.hpp
+include/caffe/layers/hdf5_data_layer.hpp
+include/caffe/layers/hdf5_output_layer.hpp
+include/caffe/layers/hinge_loss_layer.hpp
+include/caffe/layers/im2col_layer.hpp
+include/caffe/layers/image_data_layer.hpp
+include/caffe/layers/infogain_loss_layer.hpp
+include/caffe/layers/inner_product_layer.hpp
+include/caffe/layers/input_layer.hpp
+include/caffe/layers/log_layer.hpp
+include/caffe/layers/loss_layer.hpp
+include/caffe/layers/lrn_layer.hpp
+include/caffe/layers/lstm_layer.hpp
+include/caffe/layers/memory_data_layer.hpp
+include/caffe/layers/multinomial_logistic_loss_layer.hpp
+include/caffe/layers/mvn_layer.hpp
+include/caffe/layers/neuron_layer.hpp
+include/caffe/layers/parameter_layer.hpp
+include/caffe/layers/pooling_layer.hpp
+include/caffe/layers/power_layer.hpp
+include/caffe/layers/prelu_layer.hpp
+include/caffe/layers/python_layer.hpp
+include/caffe/layers/recurrent_layer.hpp
+include/caffe/layers/reduction_layer.hpp
+include/caffe/layers/relu_layer.hpp
+include/caffe/layers/reshape_layer.hpp
+include/caffe/layers/rnn_layer.hpp
+include/caffe/layers/scale_layer.hpp
+include/caffe/layers/sigmoid_cross_entropy_loss_layer.hpp
+include/caffe/layers/sigmoid_layer.hpp
+include/caffe/layers/silence_layer.hpp
+include/caffe/layers/slice_layer.hpp
+include/caffe/layers/softmax_layer.hpp
+include/caffe/layers/softmax_loss_layer.hpp
+include/caffe/layers/split_layer.hpp
+include/caffe/layers/spp_layer.hpp
+include/caffe/layers/swish_layer.hpp
+include/caffe/layers/tanh_layer.hpp
+include/caffe/layers/threshold_layer.hpp
+include/caffe/layers/tile_layer.hpp
+include/caffe/layers/window_data_layer.hpp
+include/caffe/net.hpp
+include/caffe/parallel.hpp
+include/caffe/proto/caffe.pb.h
+include/caffe/sgd_solvers.hpp
+include/caffe/solver.hpp
+include/caffe/solver_factory.hpp
+include/caffe/syncedmem.hpp
+include/caffe/test/test_caffe_main.hpp
+include/caffe/test/test_gradient_check_util.hpp
+include/caffe/util/benchmark.hpp
+include/caffe/util/blocking_queue.hpp
+include/caffe/util/cudnn.hpp
+include/caffe/util/db.hpp
+include/caffe/util/db_leveldb.hpp
+include/caffe/util/db_lmdb.hpp
+include/caffe/util/device_alternate.hpp
+include/caffe/util/format.hpp
+include/caffe/util/gpu_util.cuh
+include/caffe/util/hdf5.hpp
+include/caffe/util/im2col.hpp
+include/caffe/util/insert_splits.hpp
+include/caffe/util/io.hpp
+include/caffe/util/math_functions.hpp
+include/caffe/util/mkl_alternate.hpp
+include/caffe/util/nccl.hpp
+include/caffe/util/rng.hpp
+include/caffe/util/signal_handler.h
+include/caffe/util/upgrade_proto.hpp
+lib/libcaffe.so
+lib/libcaffe.so.1.0.0
+lib/libcaffeproto.a
+%%PYTHON_SITELIBDIR%%/caffe/_caffe.so
+%%PYTHON_SITELIBDIR%%/caffe/caffe/__init__.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/classifier.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/coord_map.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/detector.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/draw.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/imagenet/ilsvrc_2012_mean.npy
+%%PYTHON_SITELIBDIR%%/caffe/caffe/io.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/net_spec.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/proto/__init__.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/proto/caffe_pb2.py
+%%PYTHON_SITELIBDIR%%/caffe/caffe/pycaffe.py
+python/caffe/proto/__init__.py
+python/caffe/proto/caffe_pb2.py
+share/Caffe/CaffeConfig.cmake
+share/Caffe/CaffeTargets-%%CMAKE_BUILD_TYPE%%.cmake
+share/Caffe/CaffeTargets.cmake