aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile1
-rw-r--r--misc/darknet/Makefile60
-rw-r--r--misc/darknet/distinfo3
-rw-r--r--misc/darknet/files/patch-CMakeLists.txt13
-rw-r--r--misc/darknet/pkg-descr4
5 files changed, 81 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile
index 8d628992c0f1..d72fb3cee82b 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -67,6 +67,7 @@
SUBDIR += dahdi
SUBDIR += dahdi-kmod
SUBDIR += dahdi-kmod26
+ SUBDIR += darknet
SUBDIR += dartsim
SUBDIR += ddate
SUBDIR += deco
diff --git a/misc/darknet/Makefile b/misc/darknet/Makefile
new file mode 100644
index 000000000000..faa0c0f1e631
--- /dev/null
+++ b/misc/darknet/Makefile
@@ -0,0 +1,60 @@
+# $FreeBSD$
+
+PORTNAME= darknet
+PORTVERSION= 3.20200507 # the upstream doesn't maintain a meaningful versioning schema, so have to use a date here
+PORTEPOCH= 1
+CATEGORIES= misc # machine-learning
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Open source neural networks in C
+
+LICENSE= PD
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= cmake compiler:c11
+USE_GITHUB= yes
+GH_ACCOUNT= AlexeyAB
+GH_TAGNAME= 1f60ca57ad90f34a0559783656fa1ba98c61bb6d
+USE_LDCONFIG= yes
+
+CMAKE_OFF= ENABLE_CUDA ENABLE_CUDNN ENABLE_CUDNN_HALF ENABLE_VCPKG_INTEGRATION
+
+PLIST_FILES= bin/darknet \
+ include/darknet.h \
+ include/yolo_v2_class.hpp \
+ lib/libdark.so
+
+OPTIONS_DEFINE= OPENCV
+OPTIONS_DEFAULT= OPENCV
+OPTIONS_DEFINE_amd64= SSE2 SSE3 SSE4 AVX
+OPTIONS_DEFINE_i386= SSE2 SSE3 SSE4 AVX
+OPTIONS_DEFAULT_amd64= SSE2
+OPTIONS_DEFAULT_i386= SSE2
+# Many secondary functions in DarkNet depend on OpenCV which is a large dependency.
+# Build with OPENCV=off for a self-contained executable which would support
+# core NN computations but would not support many visualization, training and
+# other features.
+
+OPENCV_USES= pkgconfig
+OPENCV_CMAKE_BOOL= ENABLE_OPENCV
+OPENCV_LIB_DEPENDS= libopencv_video.so:graphics/opencv \
+ libopencv_core.so:graphics/opencv-core
+
+OPTIONS_GROUP= SIMD
+OPTIONS_GROUP_SIMD_amd64= SSE2 SSE3 SSE4 AVX
+SSE2_DESC= Use SSE2 instructions
+SSE2_CMAKE_ON= -DFREEBSD_SIMD="-msse2"
+SSE3_DESC= Use SSE3 instructions
+SSE3_CMAKE_ON= -DFREEBSD_SIMD="-msse3"
+SSE4_DESC= Use SSE4 instructions
+SSE4_CMAKE_ON= -DFREEBSD_SIMD="-msse4.1 -msse4.2 -msse4a"
+AVX_DESC= Use AVX instructions
+AVX_CMAKE_ON= -DFREEBSD_SIMD="-mavx -mavx2"
+
+do-install: # https://github.com/AlexeyAB/darknet/issues/4527
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/darknet ${STAGEDIR}${PREFIX}/bin
+ cd ${WRKSRC} && ${COPYTREE_SHARE} include ${STAGEDIR}${PREFIX}
+ ${INSTALL_DATA} ${BUILD_WRKSRC}/libdark.so ${STAGEDIR}${PREFIX}/lib
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libdark.so
+
+.include <bsd.port.mk>
diff --git a/misc/darknet/distinfo b/misc/darknet/distinfo
new file mode 100644
index 000000000000..51edfe1b59a6
--- /dev/null
+++ b/misc/darknet/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1588890263
+SHA256 (AlexeyAB-darknet-3.20200507-1f60ca57ad90f34a0559783656fa1ba98c61bb6d_GH0.tar.gz) = 7150165c564d3dbb549ffbf009efa303f65be39dd8bd94186251942be3782539
+SIZE (AlexeyAB-darknet-3.20200507-1f60ca57ad90f34a0559783656fa1ba98c61bb6d_GH0.tar.gz) = 7495107
diff --git a/misc/darknet/files/patch-CMakeLists.txt b/misc/darknet/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..02c8b6de2187
--- /dev/null
+++ b/misc/darknet/files/patch-CMakeLists.txt
@@ -0,0 +1,13 @@
+--- CMakeLists.txt.orig 2019-12-17 03:49:21 UTC
++++ CMakeLists.txt
+@@ -158,8 +158,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID
+ string(REGEX REPLACE "-O3" "-Ofast" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
+ string(REGEX REPLACE "-O0" "-Og" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+ string(REGEX REPLACE "-O3" "-Ofast" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a")
+- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a")
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffp-contract=fast ${FREEBSD_SIMD}")
++ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffp-contract=fast ${FREEBSD_SIMD}")
+ endif()
+
+ if(OpenCV_FOUND)
diff --git a/misc/darknet/pkg-descr b/misc/darknet/pkg-descr
new file mode 100644
index 000000000000..1fc6987ad80b
--- /dev/null
+++ b/misc/darknet/pkg-descr
@@ -0,0 +1,4 @@
+Darknet is an open source neural network framework written in C and CUDA. It is
+fast, easy to install, and supports CPU and GPU computation.
+
+WWW: https://pjreddie.com/darknet/