git: 41443836f017 - main - cad/py-ocp: Revert update to 7.5.2 to unbreak the ports tree

From: Antoine Brodin <antoine_at_FreeBSD.org>
Date: Fri, 29 Oct 2021 18:22:15 UTC
The branch main has been updated by antoine:

URL: https://cgit.FreeBSD.org/ports/commit/?id=41443836f017f8c69a32dcac15479305aebc903e

commit 41443836f017f8c69a32dcac15479305aebc903e
Author:     Antoine Brodin <antoine@FreeBSD.org>
AuthorDate: 2021-10-29 18:21:42 +0000
Commit:     Antoine Brodin <antoine@FreeBSD.org>
CommitDate: 2021-10-29 18:21:42 +0000

    cad/py-ocp: Revert update to 7.5.2 to unbreak the ports tree
    
    This reverts commit 224b32fffa22fc1abd54938df081c92210b539ba.
---
 cad/py-ocp/Makefile                                | 62 ++++++++--------------
 cad/py-ocp/distinfo                                |  6 +--
 .../files/cpatch-OCCT_OpenGl__HaltonSampler.hxx    | 11 ----
 cad/py-ocp/files/patch-FindOpenCascade.cmake       | 12 +++--
 cad/py-ocp/files/patch-Standard.cpp                | 17 ++++++
 cad/py-ocp/files/patch-dump__symbols.py            | 29 ----------
 cad/py-ocp/files/patch-ocp.toml                    | 30 -----------
 .../files/patch-opencascade_Standard__Time.hxx     | 19 -------
 cad/py-ocp/files/patch-templates_CMakeLists.j2     | 19 -------
 cad/py-ocp/pkg-message                             |  4 --
 10 files changed, 50 insertions(+), 159 deletions(-)

diff --git a/cad/py-ocp/Makefile b/cad/py-ocp/Makefile
index 93cef6cffc4d..f216d98fb5f5 100644
--- a/cad/py-ocp/Makefile
+++ b/cad/py-ocp/Makefile
@@ -1,60 +1,42 @@
 PORTNAME=	ocp
-DISTVERSION=	7.5.2
-CATEGORIES=	cad python
+DISTVERSION=	7.4-RC2
+PORTREVISION=	3
+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
 
+BROKEN=		Mismatch between OpenCascase (7.5) and py-ocp (7.4)
+
 LICENSE=	APACHE20
 
-EXTRACT_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cadquery-pywrap>0:devel/py-cadquery-pywrap@${PY_FLAVOR}
-LIB_DEPENDS=	libTKernel.so:cad/opencascade \
-		libvtksys-${VTKVER}.so:math/vtk9
-BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pybind11>0:devel/py-pybind11@${PY_FLAVOR} \
-		pybind11>0:devel/pybind11 \
-		rapidjson>0:devel/rapidjson \
-		${PYTHON_PKGNAMEPREFIX}path>0:devel/py-path@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}lief>0:devel/py-lief@${PY_FLAVOR}
+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=		python:3.6+ cmake gl compiler:c++11-lang
+USES=		cmake compiler:c++11-lang gl python:3.6+ zip
 USE_GL=		gl glu glut
 
-USE_GITHUB=	yes
-GH_ACCOUNT=	CadQuery
-GH_PROJECT=	OCP
-GH_TAGNAME=	52c15d8
-
-VTKVER=         9.0
-
-CONFIG_FILE=	${WRKSRC}/ocp.toml
-
-OCCT=           ${LOCALBASE}/include/OpenCASCADE
-
-CMAKE_ARGS+=	-DPYTHON_EXECUTABLE=${PYTHON_CMD} \
-		-DOPENCASCADE_INCLUDE_DIR=${OCCT} \
-		-DVTK_DIR:PATH=${LOCALBASE}/lib/vtk-${VTKVER}/cmake/vtk-${VTKVER}
-CMAKE_SOURCE_PATH=	${WRKSRC}/OCP
+WRKSRC=		${WRKDIR}/OCP_src_Ubuntu-16.04
 
-PLIST_FILES=    ${PYTHON_SITELIBDIR}/OCP.so
+OCCT=		${LOCALBASE}/include/OpenCASCADE
+OCCT_LOCAL=	${WRKSRC}/OCCT
 
-export CONDA_PREFIX=	${LOCALBASE}
+CMAKE_ARGS=	-DOPENCASCADE_INCLUDE_DIR=${OCCT} \
+		-DPYTHON_EXECUTABLE=${PYTHON_CMD}
 
-post-patch:
-	@${REINPLACE_CMD} -e 's|input_folder = "./opencascade"|input_folder = "${OCCT}"|g' ${WRKSRC}/ocp.toml
+USE_PYTHON=	flavors
 
-pre-configure:
-	# Generate the header files.
-	(cd ${WRKSRC} && ${PYTHON_CMD} dump_symbols.py ${LOCALBASE})
-	(cd ${WRKSRC} && CONDA_PREFIX=${LOCALBASE}; \
-	 ${PYTHON_CMD} -m bindgen -n ${MAKE_JOBS_NUMBER} \
-	 --libclang=${LOCALBASE}/llvm90/lib/libclang.so \
-	 --include=${LOCALBASE}/include \
-	 --include=${LOCALBASE}/include/vtk-${VTKVER} \
-	 all ${CONFIG_FILE})
+PLIST_FILES=	${PYTHON_SITELIBDIR}/OCP.so
 
 do-install:
 	@${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/
-	${INSTALL_LIB} ${BUILD_WRKSRC}/OCP.cpython-${PYTHON_VER:S/.//}.so ${STAGEDIR}${PYTHON_SITELIBDIR}/OCP.so
+	${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
index 0447d9128285..01fc842b7de9 100644
--- a/cad/py-ocp/distinfo
+++ b/cad/py-ocp/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1635415821
-SHA256 (CadQuery-OCP-7.5.2-52c15d8_GH0.tar.gz) = 9919ebcad16077d311e3be2b943e1290e05ac66e0aa992fa5a8836b39d03187a
-SIZE (CadQuery-OCP-7.5.2-52c15d8_GH0.tar.gz) = 5571420
+TIMESTAMP = 1595488164
+SHA256 (OCP_src_Linux.zip) = 126953106d7e52d3ec6c606ff3a34ecde5c6598899ab0c31279e185771304192
+SIZE (OCP_src_Linux.zip) = 50341316
diff --git a/cad/py-ocp/files/cpatch-OCCT_OpenGl__HaltonSampler.hxx b/cad/py-ocp/files/cpatch-OCCT_OpenGl__HaltonSampler.hxx
deleted file mode 100644
index 7fe4fee18e03..000000000000
--- a/cad/py-ocp/files/cpatch-OCCT_OpenGl__HaltonSampler.hxx
+++ /dev/null
@@ -1,11 +0,0 @@
---- 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-FindOpenCascade.cmake b/cad/py-ocp/files/patch-FindOpenCascade.cmake
index f8f959dd11ec..4010ac534ad6 100644
--- a/cad/py-ocp/files/patch-FindOpenCascade.cmake
+++ b/cad/py-ocp/files/patch-FindOpenCascade.cmake
@@ -1,8 +1,12 @@
---- FindOpenCascade.cmake.orig	2021-04-19 17:00:03 UTC
+--- FindOpenCascade.cmake.orig	2020-06-12 09:48:04 UTC
 +++ FindOpenCascade.cmake
-@@ -76,4 +76,4 @@ endforeach()
+@@ -69,6 +69,6 @@ foreach( MOD ${OCCT_MODULES})
  
- target_include_directories( OPENCASCADE INTERFACE ${OPENCASCADE_INCLUDE_DIR})
+ 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 )
-+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-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/files/patch-dump__symbols.py b/cad/py-ocp/files/patch-dump__symbols.py
deleted file mode 100644
index e0adfcee12f8..000000000000
--- a/cad/py-ocp/files/patch-dump__symbols.py
+++ /dev/null
@@ -1,29 +0,0 @@
---- dump_symbols.py.orig	2021-05-24 10:47:30 UTC
-+++ dump_symbols.py
-@@ -4,22 +4,15 @@ from path import Path
- 
- prefix = sys.argv[1]
- 
--prefix_mac = (Path(prefix) / 'lib_mac').expand()
--libs_mac = prefix_mac.glob('**/libTK*.7.5.1.dylib')
-+prefix_freebsd = (Path(prefix) / 'lib').expand()
-+libs_freebsd = prefix_freebsd.glob('libTK*.so')
- 
--prefix_linux = (Path(prefix) / 'lib_linux').expand()
--libs_linux = prefix_linux.glob('**/libTK*.so.7.5.1')
-+for name,libs in {'freebsd' : libs_freebsd}.items():
- 
--prefix_win = (Path(prefix) / 'lib_win').expand()
--libs_win = prefix_win.glob('**/**/TK*.dll')
--
--
--for name,libs in {'linux' : libs_linux,'mac' : libs_mac, 'win' : libs_win}.items():
--
-     exported_symbols = []
-     
-     for lib in libs:
--        p = lief.parse(lib)
-+        p = lief.parse(str(lib))
-         
-         if name=='linux':
-             for s in p.exported_symbols:
diff --git a/cad/py-ocp/files/patch-ocp.toml b/cad/py-ocp/files/patch-ocp.toml
deleted file mode 100644
index dab4dac4ad4d..000000000000
--- a/cad/py-ocp/files/patch-ocp.toml
+++ /dev/null
@@ -1,30 +0,0 @@
---- ocp.toml.orig	2021-05-24 10:47:30 UTC
-+++ ocp.toml
-@@ -361,6 +361,10 @@ parsing_header = '''#pragma clang diagnostic ignored "
-     modules = ["Xw"]
-     symbols = "symbols_mangled_linux.dat"
- 
-+[FreeBSD]
-+    modules = ["Xw"]
-+    symbols = "symbols_mangled_freebsd.dat"
-+
- [Windows]
-     modules = ["WNT"]
-     exclude_classes = ["Handle_*"]
-@@ -632,7 +636,8 @@ parsing_header = '''#pragma clang diagnostic ignored "
- struct NSOpenGLContext {};"""
-         include_body_pre = 'py::class_<NSOpenGLContext>(m, "NSOpenGLContext");'
-         exclude_methods = ["OpenGl_GlCore11::glGetPointerv","OpenGl_RaytraceGeometry::Clear",
--                           "OpenGl_View::ChangeGraduatedTrihedron","OpenGl_View::LayerList"]
-+                           "OpenGl_View::ChangeGraduatedTrihedron","OpenGl_View::LayerList",
-+                           "OpenGl_VertexBuffer::unbindFixedColor"]
-         exclude_typedefs = ["OpenGl_SequenceOfLayers","OpenGl_SetterList","OpenGl_MapOfHatchStylesAndIds","OpenGl_MapOfZLayerSettings","OpenGl_IndexedMapOfStructure","OpenGl_MapOfShaderPrograms","OpenGl_IndexedMapOfStructure","OpenGl_LayerSeqIds"]
-         exclude_classes = ["OpenGl_GraduatedTrihedron","OpenGl_LayerList","OpenGl_VariableSetterSelector","OpenGl_RaytraceGeometry"]
-         
-@@ -1089,4 +1094,4 @@ using rapidjson::BasicOStreamWrapper;"""
-         
-     [Modules.IVtkOCC]
- 
--        exclude_methods = ["IVtkOCC_ShapePickerAlgo::Pick", "IVtkOCC_ViewerSelector::Pick"]
-\ No newline at end of file
-+        exclude_methods = ["IVtkOCC_ShapePickerAlgo::Pick", "IVtkOCC_ViewerSelector::Pick"]
diff --git a/cad/py-ocp/files/patch-opencascade_Standard__Time.hxx b/cad/py-ocp/files/patch-opencascade_Standard__Time.hxx
deleted file mode 100644
index dcef759748e9..000000000000
--- a/cad/py-ocp/files/patch-opencascade_Standard__Time.hxx
+++ /dev/null
@@ -1,19 +0,0 @@
---- opencascade/Standard_Time.hxx.orig	2021-04-14 15:24:46 UTC
-+++ opencascade/Standard_Time.hxx
-@@ -26,11 +26,11 @@
- // ------------------------------------------------------------------
- // IsEqual : Returns Standard_True if two time values are equal
- // ------------------------------------------------------------------
--inline Standard_Boolean IsEqual (const Standard_Time theOne,
--                                 const Standard_Time theTwo)
--{
--  return theOne == theTwo;
--}
-+//inline Standard_Boolean IsEqual (const Standard_Time theOne,
-+//                                 const Standard_Time theTwo)
-+//{
-+//  return theOne == theTwo;
-+//}
- 
- #endif
- 
diff --git a/cad/py-ocp/files/patch-templates_CMakeLists.j2 b/cad/py-ocp/files/patch-templates_CMakeLists.j2
deleted file mode 100644
index 48a175effe63..000000000000
--- a/cad/py-ocp/files/patch-templates_CMakeLists.j2
+++ /dev/null
@@ -1,19 +0,0 @@
---- templates/CMakeLists.j2.orig	2021-03-03 18:11:14 UTC
-+++ templates/CMakeLists.j2
-@@ -17,7 +17,8 @@ endif()
- 
- find_package( pybind11 REQUIRED )
- find_package( OpenCascade REQUIRED COMPONENTS OPENCASCADE )
- find_package( VTK 9.0 REQUIRED COMPONENTS WrappingPythonCore RenderingCore CommonDataModel CommonExecutionModel)
-+find_package(OpenGL REQUIRED COMPONENTS OpenGL )
- 
- #clang-cl related workaround
- if(WIN32)
-@@ -30,6 +31,7 @@ file( GLOB CPP_FILES ${PROJECT_SOURCE_DIR}/*.cpp )
- add_library( {{ name }} MODULE ${CPP_FILES} )
- 
- target_link_libraries( {{ name }} PRIVATE OPENCASCADE pybind11::pybind11 VTK::WrappingPythonCore VTK::RenderingCore VTK::CommonDataModel VTK::CommonExecutionModel)
-+target_link_libraries( {{ name }} PRIVATE ${OPENGL_gl_LIBRARY} )
- set_target_properties( {{ name }}
-                        PROPERTIES
-                        CXX_STANDARD 17
diff --git a/cad/py-ocp/pkg-message b/cad/py-ocp/pkg-message
deleted file mode 100644
index 7600ab2eba83..000000000000
--- a/cad/py-ocp/pkg-message
+++ /dev/null
@@ -1,4 +0,0 @@
-It is essential for the correct operation of this library for the
-cad/opencascade port to be built with the VIS option disabled. Unfortunately
-the current default is enabled, so if missing symbols are encounted, then
-it will be necessary to rebuild cad/opencascade without the VIS option.