aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cad/py-ocp/Makefile46
-rw-r--r--cad/py-ocp/distinfo3
-rw-r--r--cad/py-ocp/files/patch-FindOpenCascade.cmake12
-rw-r--r--cad/py-ocp/files/patch-OCCT_OpenGl__HaltonSampler.hxx11
-rw-r--r--cad/py-ocp/files/patch-Standard.cpp17
-rw-r--r--cad/py-ocp/pkg-descr4
6 files changed, 93 insertions, 0 deletions
diff --git a/cad/py-ocp/Makefile b/cad/py-ocp/Makefile
new file mode 100644
index 000000000000..195fc1b70b2d
--- /dev/null
+++ b/cad/py-ocp/Makefile
@@ -0,0 +1,46 @@
+# $FreeBSD$
+
+PORTNAME= ocp
+DISTVERSION= 7.4-RC2
+CATEGORIES= cad
+# Direct access to github is needed because the release added an extra archive which
+# we need to build from, rather than the initial release.
+MASTER_SITES= https://github.com/CadQuery/OCP/releases/download/${DISTVERSION}/
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTNAME= OCP_src_Linux
+
+MAINTAINER= ports@nicandneal.net
+COMMENT= Python wrapper for OCCT generated using pywrap
+
+LICENSE= APACHE20
+
+PATCH_DEPENDS= ${LOCALBASE}/include/OpenCASCADE/OpenGl_HaltonSampler.hxx:cad/opencascade
+LIB_DEPENDS= libTKernel.so:cad/opencascade
+BUILD_DEPENDS= ${LOCALBASE}/share/cmake/pybind11/pybind11Config.cmake:devel/pybind11 \
+ ${PYTHON_SITELIBDIR}/pybind11:devel/py-pybind11@${PY_FLAVOR}
+
+USES= cmake gl python:3.6+ zip
+USE_GL= gl glu glut
+
+WRKSRC= ${WRKDIR}/OCP_src_Ubuntu-16.04
+
+OCCT= ${LOCALBASE}/include/OpenCASCADE
+OCCT_LOCAL= ${WRKSRC}/OCCT
+
+CMAKE_ARGS= -DOPENCASCADE_INCLUDE_DIR=${OCCT} \
+ -DPYTHON_EXECUTABLE=${PYTHON_CMD}
+
+USE_PYTHON= flavors
+
+PLIST_FILES= ${PYTHON_SITELIBDIR}/OCP.so
+
+pre-patch:
+# Copy and patch a header file with a troublesome C++ standard mismatch.
+ ${MKDIR} ${OCCT_LOCAL}
+ ${CP} ${OCCT}/OpenGl_HaltonSampler.hxx ${OCCT_LOCAL}
+
+do-install:
+ @${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/
+ ${INSTALL_LIB} ${BUILD_WRKSRC}/OCP.so ${STAGEDIR}${PYTHON_SITELIBDIR}
+
+.include <bsd.port.mk>
diff --git a/cad/py-ocp/distinfo b/cad/py-ocp/distinfo
new file mode 100644
index 000000000000..01fc842b7de9
--- /dev/null
+++ b/cad/py-ocp/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1595488164
+SHA256 (OCP_src_Linux.zip) = 126953106d7e52d3ec6c606ff3a34ecde5c6598899ab0c31279e185771304192
+SIZE (OCP_src_Linux.zip) = 50341316
diff --git a/cad/py-ocp/files/patch-FindOpenCascade.cmake b/cad/py-ocp/files/patch-FindOpenCascade.cmake
new file mode 100644
index 000000000000..4010ac534ad6
--- /dev/null
+++ b/cad/py-ocp/files/patch-FindOpenCascade.cmake
@@ -0,0 +1,12 @@
+--- FindOpenCascade.cmake.orig 2020-06-12 09:48:04 UTC
++++ FindOpenCascade.cmake
+@@ -69,6 +69,6 @@ foreach( MOD ${OCCT_MODULES})
+
+ endforeach()
+
+-target_include_directories( OPENCASCADE INTERFACE ${OPENCASCADE_INCLUDE_DIR})
++target_include_directories( OPENCASCADE INTERFACE OCCT ${OPENCASCADE_INCLUDE_DIR})
+
+-find_package_handle_standard_args( OPENCASCADE DEFAULT_MSG OPENCASCADE_LIBRARIES OPENCASCADE_INCLUDE_DIR )
+\ No newline at end of file
++find_package_handle_standard_args( OPENCASCADE DEFAULT_MSG OPENCASCADE_LIBRARIES OPENCASCADE_INCLUDE_DIR )
diff --git a/cad/py-ocp/files/patch-OCCT_OpenGl__HaltonSampler.hxx b/cad/py-ocp/files/patch-OCCT_OpenGl__HaltonSampler.hxx
new file mode 100644
index 000000000000..7fe4fee18e03
--- /dev/null
+++ b/cad/py-ocp/files/patch-OCCT_OpenGl__HaltonSampler.hxx
@@ -0,0 +1,11 @@
+--- OCCT/OpenGl_HaltonSampler.hxx.orig 2020-06-15 08:29:45 UTC
++++ OCCT/OpenGl_HaltonSampler.hxx
+@@ -180,7 +180,7 @@ void OpenGl_HaltonSampler::initRandom (Random_number_g
+ {
+ aPerms[aBase][i] = i;
+ }
+- std::random_shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand);
++ std::shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand);
+ }
+ initTables (aPerms);
+ }
diff --git a/cad/py-ocp/files/patch-Standard.cpp b/cad/py-ocp/files/patch-Standard.cpp
new file mode 100644
index 000000000000..1d228622f44b
--- /dev/null
+++ b/cad/py-ocp/files/patch-Standard.cpp
@@ -0,0 +1,17 @@
+--- Standard.cpp.orig 2020-05-29 13:26:32 UTC
++++ Standard.cpp
+@@ -902,10 +902,10 @@ py::module m = static_cast<py::module>(main_module.att
+ R"#(None)#" , py::arg("theOne"), py::arg("theTwo")
+ );
+ // ./opencascade/Standard_Time.hxx
+- m.def("IsEqual",
+- (Standard_Boolean (*)( const Standard_Time , const Standard_Time )) static_cast<Standard_Boolean (*)( const Standard_Time , const Standard_Time )>(&IsEqual),
+- R"#(None)#" , py::arg("theOne"), py::arg("theTwo")
+- );
++// m.def("IsEqual",
++// (Standard_Boolean (*)( const Standard_Time , const Standard_Time )) static_cast<Standard_Boolean (*)( const Standard_Time , const Standard_Time )>(&IsEqual),
++// R"#(None)#" , py::arg("theOne"), py::arg("theTwo")
++// );
+ // ./opencascade/Standard_NullValue.hxx
+ // ./opencascade/Standard_DefineHandle.hxx
+ // ./opencascade/Standard_Mutex.hxx
diff --git a/cad/py-ocp/pkg-descr b/cad/py-ocp/pkg-descr
new file mode 100644
index 000000000000..ce5a6b146d1a
--- /dev/null
+++ b/cad/py-ocp/pkg-descr
@@ -0,0 +1,4 @@
+OCP is a Python wrapper for OCCT (OpenCascade) generated using pywrap
+primarily used by CadQuery.
+
+WWW: https://github.com/CadQuery/OCP