From 35fbbebe34fe9707e151437628540a9ab223618b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 26 Apr 2018 20:39:16 +0000 Subject: New ports science/dlib-cpp and science/py-dlib (Python bindings for the former) Changed from the reviewed form: - fixed typo's - added support for suffixed Boost::Python - removed commented-out lines from patch Submitted by: arrowsvc (6yearold@gmail.com, new maintainer) Reviewed by: tcberner, adridg Approved by: tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D14798 --- science/py-dlib/Makefile | 57 ++++++++++++++++++++++ science/py-dlib/distinfo | 3 ++ .../patch-dlib_cmake__utils_add__python__module | 30 ++++++++++++ science/py-dlib/files/patch-setup.py | 35 +++++++++++++ science/py-dlib/pkg-descr | 7 +++ 5 files changed, 132 insertions(+) create mode 100644 science/py-dlib/Makefile create mode 100644 science/py-dlib/distinfo create mode 100644 science/py-dlib/files/patch-dlib_cmake__utils_add__python__module create mode 100644 science/py-dlib/files/patch-setup.py create mode 100644 science/py-dlib/pkg-descr (limited to 'science/py-dlib') diff --git a/science/py-dlib/Makefile b/science/py-dlib/Makefile new file mode 100644 index 000000000000..6d253d20d0eb --- /dev/null +++ b/science/py-dlib/Makefile @@ -0,0 +1,57 @@ +# $FreeBSD$ + +PORTNAME= dlib +DISTVERSION= 19.6 +CATEGORIES= science devel math python +MASTER_SITES= http://dlib.net/files/ +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= 6yearold@gmail.com +COMMENT= Machine learning framework written in C++ (python bindings) + +LICENSE= BSL +LICENSE_FILE= ${WRKSRC}/dlib/LICENSE.txt + +BUILD_DEPENDS= cmake:devel/cmake +LIB_DEPENDS= ${PY_BOOST} + +USES= pkgconfig python shebangfix tar:bzip2 +USE_PYTHON= autoplist distutils +SHEBANG_FILES= python_examples/*.py + +OPTIONS_DEFINE= X11 JPEG PNG GIF SQLITE BLASLAPACK AVX +OPTIONS_DEFAULT= X11 JPEG PNG GIF SQLITE + +BLASLAPACK_DESC= Use Blas and Lapack libraries from ports +AVX_DESC= Use AVX instructions if supported by CPU + +X11_USE= xorg=x11 +X11_VARS_OFF= x11args="--yes DLIB_NO_GUI_SUPPORT" + +JPEG_USES= jpeg +JPEG_VARS= jpegargs="--yes DLIB_JPEG_SUPPORT" +JPEG_VARS_OFF= jpegargs="--no DLIB_JPEG_SUPPORT" + +PNG_LIB_DEPENDS= libpng.so:graphics/png +PNG_VARS= pngargs="--yes DLIB_PNG_SUPPORT" +PNG_VARS_OFF= pngargs="--no DLIB_PNG_SUPPORT" + +GIF_LIB_DEPENDS= libgif.so:graphics/giflib +GIF_VARS= gifargs="--yes DLIB_GIF_SUPPORT" +GIF_VARS_OFF= gifargs="--no DLIB_GIF_SUPPORT" + +SQLITE_USES= sqlite +SQLITE_VARS= sqliteargs="--yes DLIB_LINK_WITH_SQLITE" +SQLITE_VARS_OFF= sqliteargs="--no DLIB_LINK_WITH_SQLITE" + +BLASLAPACK_USES= blaslapack +BLASLAPACK_VARS_OFF= avxargs="--no DLIB_USE_BLAS --no DLIB_USE_LAPACK --no DLIB_USE_MKL_FFT" + +AVX_VARS= avxargs="--yes USE_AVX_INSTRUCTIONS" + +PYDISTUTILS_BUILDARGS= --cmake-extra BOOST_PYTHON_SUFFIX:STRING=${PYTHON_SUFFIX} ${X11ARGS} ${JPEGARGS} ${PNGARGS} ${GIFARGS} ${SQLITEARGS} ${BLASLAPACKARGS} ${AVXARGS} + +post-install: + ${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/dlib/dlib.so + +.include diff --git a/science/py-dlib/distinfo b/science/py-dlib/distinfo new file mode 100644 index 000000000000..cca768807511 --- /dev/null +++ b/science/py-dlib/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1505047685 +SHA256 (dlib-19.6.tar.bz2) = 40292a4343499b18b881f69b26a56c1ecfe95cb9b9f964f37c1064c6fc415e2c +SIZE (dlib-19.6.tar.bz2) = 9016497 diff --git a/science/py-dlib/files/patch-dlib_cmake__utils_add__python__module b/science/py-dlib/files/patch-dlib_cmake__utils_add__python__module new file mode 100644 index 000000000000..abb2de62cedd --- /dev/null +++ b/science/py-dlib/files/patch-dlib_cmake__utils_add__python__module @@ -0,0 +1,30 @@ +--- dlib/cmake_utils/add_python_module.orig 2017-08-28 22:18:45 UTC ++++ dlib/cmake_utils/add_python_module +@@ -118,12 +118,6 @@ endif() + + + +-INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}") +-if (PYTHON_INCLUDE_PATH) +- INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_PATH}" ) +-else() +- INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIRS}" ) +-endif() + + message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}") + if (WIN32) +@@ -152,6 +146,14 @@ macro(add_python_module module_name modu + ADD_LIBRARY(${module_name}_ SHARED ${module_sources} ${ARGN} ) + TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} dlib::dlib) + ++ target_include_directories(${module_name}_ SYSTEM PUBLIC "${Boost_INCLUDE_DIRS}") ++ if (PYTHON_INCLUDE_PATH) ++ target_include_directories(${module_name}_ SYSTEM PUBLIC "${PYTHON_INCLUDE_PATH}" ) ++ else() ++ target_include_directories(${module_name}_ SYSTEM PUBLIC "${PYTHON_INCLUDE_DIRS}" ) ++ endif() ++ ++ + if(WIN32 AND NOT CYGWIN) + TARGET_LINK_LIBRARIES(${module_name}_ ${PYTHON_LIBRARIES}) + SET_TARGET_PROPERTIES( ${module_name}_ diff --git a/science/py-dlib/files/patch-setup.py b/science/py-dlib/files/patch-setup.py new file mode 100644 index 000000000000..ed415869544e --- /dev/null +++ b/science/py-dlib/files/patch-setup.py @@ -0,0 +1,35 @@ +Add extra machinery to pass arguments to CMake; this is FreeBSD-specific +until CMake's FindBoost understands FreeBSD-suffixed Boost::Python versions. + +Also leave the build directory intact. + +--- setup.py.orig 2017-08-28 22:18:45 UTC ++++ setup.py +@@ -91,6 +91,8 @@ def _get_options(): + elif opt_key == 'G': + _cmake_extra += ['-G', arg.strip()] + _generator_set = True ++ elif opt_key == 'cmake-extra': ++ _cmake_extra.append('-D{arg}'.format(arg=arg.strip())) + + if opt_key: + sys.argv.remove(arg) +@@ -112,7 +114,7 @@ def _get_options(): + opt_key = opt + sys.argv.remove(arg) + continue +- elif opt in ['yes', 'no', 'compiler-flags']: ++ elif opt in ['yes', 'no', 'compiler-flags', 'cmake-extra']: + opt_key = opt + sys.argv.remove(arg) + continue +@@ -548,9 +550,6 @@ class build(_build): + break + + build_dir = os.path.join(script_dir, "./tools/python/build") +- if os.path.exists(build_dir): +- log.info('Removing build directory %s' % build_dir) +- rmtree(build_dir) + + try: + os.makedirs(build_dir) diff --git a/science/py-dlib/pkg-descr b/science/py-dlib/pkg-descr new file mode 100644 index 000000000000..e21d365dbaac --- /dev/null +++ b/science/py-dlib/pkg-descr @@ -0,0 +1,7 @@ +Dlib is a modern C++ toolkit containing machine learning algorithms +and tools for creating complex software in C++ to solve real world +problems. It is used in both industry and academia in a wide range +of domains including robotics, embedded devices, mobile phones, +and large high performance computing environments. + +WWW: http://dlib.net -- cgit v1.2.3