Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 2020 21:11:02 +0000 (UTC)
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r544109 - in head/math: . py-or-tools py-or-tools/files
Message-ID:  <202008032111.073LB2V1067361@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yuri
Date: Mon Aug  3 21:11:02 2020
New Revision: 544109
URL: https://svnweb.freebsd.org/changeset/ports/544109

Log:
  New port: math/py-or-tools: Google's Operations Research tools (Python binding)

Added:
  head/math/py-or-tools/
  head/math/py-or-tools/Makefile   (contents, props changed)
  head/math/py-or-tools/distinfo   (contents, props changed)
  head/math/py-or-tools/files/
  head/math/py-or-tools/files/patch-cmake_python.cmake   (contents, props changed)
  head/math/py-or-tools/files/patch-ortools_python_setup.py.in   (contents, props changed)
  head/math/py-or-tools/files/patch-ortools_util_fp__utils.h   (contents, props changed)
  head/math/py-or-tools/files/patch-ortools_util_zvector.h   (contents, props changed)
  head/math/py-or-tools/files/patch-tools_setup.py.in   (contents, props changed)
  head/math/py-or-tools/pkg-descr   (contents, props changed)
  head/math/py-or-tools/pkg-plist   (contents, props changed)
Modified:
  head/math/Makefile

Modified: head/math/Makefile
==============================================================================
--- head/math/Makefile	Mon Aug  3 20:40:06 2020	(r544108)
+++ head/math/Makefile	Mon Aug  3 21:11:02 2020	(r544109)
@@ -789,6 +789,7 @@
     SUBDIR += py-numpy
     SUBDIR += py-nzmath
     SUBDIR += py-opt-einsum
+    SUBDIR += py-or-tools
     SUBDIR += py-osqp
     SUBDIR += py-pandas
     SUBDIR += py-pandas-datareader

Added: head/math/py-or-tools/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/Makefile	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,51 @@
+# $FreeBSD$
+
+PORTNAME=	or-tools
+DISTVERSIONPREFIX=	v
+DISTVERSION=	7.7
+CATEGORIES=	math
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Google's Operations Research tools (Python binding)
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE-2.0.txt
+
+PY_DEPENDS=	${PYTHON_PKGNAMEPREFIX}protobuf>0:devel/py-protobuf@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}
+BUILD_DEPENDS=	${PY_DEPENDS} \
+		${PYTHON_PKGNAMEPREFIX}pip>0:devel/py-pip@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}virtualenv>0:devel/py-virtualenv@${PY_FLAVOR} \
+		swig:devel/swig
+LIB_DEPENDS=	libabsl_base.so:devel/abseil \
+		libCbc.so:math/cbc \
+		libCgl.so:math/cgl \
+		libOsiClp.so:math/clp \
+		libgflags.so:devel/gflags \
+		libglog.so:devel/glog \
+		libprotobuf.so:devel/protobuf
+RUN_DEPENDS=	${PY_DEPENDS}
+
+USES=		blaslapack cmake compiler:c++11-lang pkgconfig python
+USE_GITHUB=	yes
+GH_ACCOUNT=	google
+
+CMAKE_OFF=	BUILD_DEPS INSTALL_BUILD_DEPS BUILD_EXAMPLES
+CMAKE_ON=	BUILD_PYTHON
+CMAKE_ARGS=	-DSWIG_EXECUTABLE=${LOCALBASE}/bin/swig -DFREEBSD_PYTHON_VER=${PYTHON_VER}
+CONFIGURE_ENV=	UNIX_CBC_DIR=${LOCALBASE} UNIX_CLP_DIR=${LOCALBASE}
+BUILD_ENV=	UNIX_CBC_DIR=${LOCALBASE} UNIX_CLP_DIR=${LOCALBASE}
+
+post-configure: # https://github.com/google/or-tools/issues/2109
+	@${REINPLACE_CMD} -e 's|protobuf::protoc|protoc -I${LOCALBASE}/include| ; s|protobuf$$:$$:protoc||' ${BUILD_WRKSRC}/build.ninja
+
+do-install: # by default cmake installs the whole or-tools project without the python part, so extract the wheel and install python files manually here
+	${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+	cd ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} && \
+		unzip ${BUILD_WRKSRC}/python/dist/ortools-${DISTVERSION}.9999-cp${PYTHON_SUFFIX}-cp${PYTHON_SUFFIX}m-freebsd_*.whl && \
+		${RM} -rf ortools-*.dist-info
+	${FIND} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} -name "*.so" -o -name "*.so.*" | ${XARGS} ${STRIP_CMD}
+
+.include <bsd.port.mk>

Added: head/math/py-or-tools/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/distinfo	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1596476022
+SHA256 (google-or-tools-v7.7_GH0.tar.gz) = d20eb031ea3f1b75e55e44ae6acdb674ee6fb31e7a56498be32dc83ba9bc13bd
+SIZE (google-or-tools-v7.7_GH0.tar.gz) = 184809285

Added: head/math/py-or-tools/files/patch-cmake_python.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/files/patch-cmake_python.cmake	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,11 @@
+--- cmake/python.cmake.orig	2020-08-03 18:30:02 UTC
++++ cmake/python.cmake
+@@ -23,7 +23,7 @@ if(UNIX AND NOT APPLE)
+ endif()
+ 
+ # Find Python
+-find_package(Python REQUIRED COMPONENTS Interpreter Development)
++find_package(Python ${FREEBSD_PYTHON_VER} EXACT REQUIRED COMPONENTS Interpreter Development)
+ 
+ if(Python_VERSION VERSION_GREATER_EQUAL 3)
+   list(APPEND CMAKE_SWIG_FLAGS "-py3")

Added: head/math/py-or-tools/files/patch-ortools_python_setup.py.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/files/patch-ortools_python_setup.py.in	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,12 @@
+--- ortools/python/setup.py.in.orig	2020-08-03 20:33:34 UTC
++++ ortools/python/setup.py.in
+@@ -41,7 +41,8 @@ setup(
+   '@PROJECT_NAME@.util':['$<TARGET_FILE_NAME:sorted_interval_list>', '*.pyi'],
+   },
+   include_package_data=True,
+-  install_requires=['protobuf >= 3.12.2', 'six >= 1.10'],
++  #install_requires=['protobuf >= 3.12.2', 'six >= 1.10'],
++  install_requires=[],
+   classifiers=[
+   'Development Status :: 5 - Production/Stable',
+   'Intended Audience :: Developers',

Added: head/math/py-or-tools/files/patch-ortools_util_fp__utils.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/files/patch-ortools_util_fp__utils.h	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,11 @@
+--- ortools/util/fp_utils.h.orig	2020-07-20 23:21:30 UTC
++++ ortools/util/fp_utils.h
+@@ -83,6 +83,8 @@ class ScopedFloatingPointEnv {
+     excepts &= FE_ALL_EXCEPT;
+ #ifdef __APPLE__
+     fenv_.__control &= ~excepts;
++#elif defined(__FreeBSD__)
++    //fesetexceptflag(&fenv_, excepts);
+ #else  // Linux
+     fenv_.__control_word &= ~excepts;
+ #endif

Added: head/math/py-or-tools/files/patch-ortools_util_zvector.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/files/patch-ortools_util_zvector.h	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,14 @@
+--- ortools/util/zvector.h.orig	2020-07-20 23:36:37 UTC
++++ ortools/util/zvector.h
+@@ -17,7 +17,11 @@
+ #if defined(__APPLE__) && defined(__GNUC__)
+ #include <machine/endian.h>
+ #elif !defined(_MSC_VER)
++#if defined(__FreeBSD__)
++#include <sys/endian.h>
++#else
+ #include <endian.h>
++#endif
+ #endif
+ #include <climits>
+ #include <cstdio>

Added: head/math/py-or-tools/files/patch-tools_setup.py.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/files/patch-tools_setup.py.in	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,13 @@
+--- tools/setup.py.in.orig	2020-08-03 20:20:27 UTC
++++ tools/setup.py.in
+@@ -46,8 +46,8 @@ setup(
+         'ortools.util',
+     ],
+     install_requires=[
+-        'protobuf >= 3.12.2',
+-        'six >= 1.10',
++        #'protobuf >= 3.12.2',
++        #'six >= 1.10',
+     ],
+     package_data={
+         'ortools.constraint_solver' : ['_pywrapcp.dll'],

Added: head/math/py-or-tools/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/pkg-descr	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,3 @@
+Python bindings for Google Optimization Tools (a.k.a., OR-Tools).
+
+WWW: https://github.com/google/or-tools

Added: head/math/py-or-tools/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/math/py-or-tools/pkg-plist	Mon Aug  3 21:11:02 2020	(r544109)
@@ -0,0 +1,40 @@
+%%PYTHON_SITELIBDIR%%/ortools/.libs/libortools.so.7
+%%PYTHON_SITELIBDIR%%/ortools/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/algorithms/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/algorithms/_pywrapknapsack_solver.so
+%%PYTHON_SITELIBDIR%%/ortools/algorithms/pywrapknapsack_solver.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/_pywrapcp.so
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/assignment_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/pywrapcp.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/routing_enums_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/routing_parameters_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/search_limit_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/constraint_solver/solver_parameters_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/data/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/data/_pywraprcpsp.so
+%%PYTHON_SITELIBDIR%%/ortools/data/jobshop_scheduling_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/data/pywraprcpsp.py
+%%PYTHON_SITELIBDIR%%/ortools/data/rcpsp_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/graph/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/graph/_pywrapgraph.so
+%%PYTHON_SITELIBDIR%%/ortools/graph/pywrapgraph.py
+%%PYTHON_SITELIBDIR%%/ortools/linear_solver/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/linear_solver/_pywraplp.so
+%%PYTHON_SITELIBDIR%%/ortools/linear_solver/linear_solver_natural_api.py
+%%PYTHON_SITELIBDIR%%/ortools/linear_solver/linear_solver_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/linear_solver/pywraplp.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/_pywrapsat.so
+%%PYTHON_SITELIBDIR%%/ortools/sat/boolean_problem_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/cp_model_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/python/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/python/cp_model.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/python/cp_model_helper.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/python/visualization.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/pywrapsat.py
+%%PYTHON_SITELIBDIR%%/ortools/sat/sat_parameters_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/util/__init__.py
+%%PYTHON_SITELIBDIR%%/ortools/util/_sorted_interval_list.so
+%%PYTHON_SITELIBDIR%%/ortools/util/optional_boolean_pb2.py
+%%PYTHON_SITELIBDIR%%/ortools/util/sorted_interval_list.py



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008032111.073LB2V1067361>