git: 18da1ab51576 - main - cad/opencascade740: Resurrect cad/opencascade @ version 7.4.0

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 30 Jan 2022 06:01:51 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=18da1ab515763d4b1b50b2072b061a17b5adfa7c

commit 18da1ab515763d4b1b50b2072b061a17b5adfa7c
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-01-30 05:58:18 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-01-30 06:01:48 +0000

    cad/opencascade740: Resurrect cad/opencascade @ version 7.4.0
    
    This is needed for science/chrono.
---
 cad/Makefile                                       |   1 +
 cad/opencascade740/Makefile                        | 143 +++++++++++++++++++++
 cad/opencascade740/distinfo                        |   3 +
 cad/opencascade740/files/patch-CMakeLists.txt      |  26 ++++
 .../files/patch-adm_cmake_occt__csf.cmake          |   9 ++
 .../files/patch-adm_cmake_occt__macros.cmake       |  20 +++
 .../patch-adm_templates_OpenCASCADEConfig.cmake.in |  19 +++
 .../files/patch-adm_templates_custom.install.sh.in |  25 ++++
 .../files/patch-inc_Standard__Time.hxx             |  19 +++
 .../patch-src_DrawResources_CheckCommands.tcl      |  62 +++++++++
 .../files/patch-src_IVtkDraw_IVtkDraw.cxx          |  15 +++
 ...c_STEPConstruct_STEPConstruct__AP203Context.cxx |  19 +++
 .../patch-src_Standard_Standard__CLocaleSentry.hxx |  11 ++
 .../files/patch-src_Standard_Standard__CString.cxx |  11 ++
 .../patch-src_Standard_Standard__MMgrTBBalloc.cxx  |  12 ++
 .../files/patch-src_Standard_Standard__Time.hxx    |  19 +++
 .../files/patch-src_StepFile_recfile.pc            |  11 ++
 cad/opencascade740/files/regtest                   |   4 +
 cad/opencascade740/pkg-descr                       |  12 ++
 19 files changed, 441 insertions(+)

diff --git a/cad/Makefile b/cad/Makefile
index 6a7a336bc3cd..a8546b7e1776 100644
--- a/cad/Makefile
+++ b/cad/Makefile
@@ -85,6 +85,7 @@
     SUBDIR += ngspice_rework
     SUBDIR += nvc
     SUBDIR += opencascade
+    SUBDIR += opencascade740
     SUBDIR += openctm
     SUBDIR += openfpgaloader
     SUBDIR += openroad
diff --git a/cad/opencascade740/Makefile b/cad/opencascade740/Makefile
new file mode 100644
index 000000000000..22f28ab929dc
--- /dev/null
+++ b/cad/opencascade740/Makefile
@@ -0,0 +1,143 @@
+# Created by: Thierry Thomas <thierry@pompo.net>
+
+PORTNAME=	opencascade
+PORTVERSION=	7.4.0 # resurrected because science/chrono only builds with opencascade-7.4.0, see https://github.com/projectchrono/chrono/issues/359#issuecomment-1023478083
+CATEGORIES=	cad science
+PKGNAMESUFFIX=	740
+
+MAINTAINER=	thierry@FreeBSD.org
+COMMENT=	Open CASCADE Technology, 3D modeling & numerical simulation
+
+LICENSE=	OCTPL
+LICENSE_NAME=	LGPL21 with exception
+LICENSE_FILE=	${WRKSRC}/OCCT_LGPL_EXCEPTION.txt
+LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+
+BUILD_DEPENDS=	${LOCALBASE}/lib/qt5/bin/qmake:devel/qt5-qmake	\
+		${LOCALBASE}/lib/qt5/bin/moc:devel/qt5-buildtools
+LIB_DEPENDS=	libfontconfig.so:x11-fonts/fontconfig	\
+		libfreetype.so:print/freetype2		\
+		libtbb.so:devel/tbb
+RUN_DEPENDS=	bash:shells/bash
+
+# Check ${WRKSRC}/dox/overview/overview.md
+# and ${WRKSRC}/dox/dev_guides/building
+USES=		alias:10 cmake compiler:c++14-lang dos2unix \
+		gl python qt:5 shebangfix tk tar:tgz xorg
+USE_XORG=	ice sm x11 xext xi xmu xt
+USE_GL=		gl glu
+
+DOS2UNIX_FILES=	adm/templates/*
+SHEBANG_FILES=	adm/templates/*.sh	\
+		adm/templates/*.sh.in	\
+		adm/templates/*.sh.main	\
+		adm/genconf.tcl		\
+		adm/start.tcl		\
+		gendoc
+ENVSH=		adm/templates/env.sh
+
+OPTIONS_DEFINE=	DOCS DOXYGEN FFMPEG VIS
+VIS_DESC=	Build Visualizazion module (requires OpenGL, freetype, ftgl and gl2ps)
+OPTIONS_DEFAULT=FFMPEG VIS
+OPTIONS_SUB=	yes
+
+REINPLACE_ARGS=	-i ""
+CFLAGS+=	-I${LOCALBASE}/include
+CMAKE_ARGS+=	-DINSTALL_DIR=${OCCROOT}				\
+		-DINSTALL_DIR_INCLUDE=${PREFIX}/include/OpenCASCADE	\
+		-DINSTALL_DIR_LIB=${PREFIX}/lib				\
+		-DINSTALL_DIR_CMAKE=${PREFIX}/lib/cmake			\
+		-DINSTALL_DIR_DATA=${OCCROOT}/data			\
+		-DINSTALL_DIR_RESOURCE=${OCCROOT}/resources		\
+		-DINSTALL_DIR_SAMPLES=${OCCROOT}/samples		\
+		-DINSTALL_DIR_TESTS=${OCCROOT}/tests			\
+		-DINSTALL_TEST_CASES:BOOL=ON				\
+		-DUSE_TBB:BOOL=ON					\
+		-DUSE_VTK:BOOL=OFF
+
+USE_LDCONFIG=	yes
+
+LOCCROOT=	OpenCAS
+OCCROOT=	${PREFIX}/${LOCCROOT}
+PLIST_SUB=	OCCROOT="${LOCCROOT}" BITS=${BITS} CC=${CHOSEN_COMPILER_TYPE}	\
+		VE=${PORTVERSION:R:R} VER=${PORTVERSION}
+
+FFMPEG_CMAKE_ON=	-DUSE_FFMPEG:BOOL=ON
+FFMPEG_CMAKE_OFF=	-DUSE_FFMPEG:BOOL=OFF
+FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg
+
+VIS_CMAKE_ON=		-DUSE_FREEIMAGE:BOOL=ON -DUSE_GL2PS:BOOL=ON	\
+			-DUSE_FREETYPE:BOOL=ON -D3RDPARTY_FREETYPE_DIR=${LOCALBASE}
+VIS_CMAKE_OFF=		-DUSE_FREEIMAGE:BOOL=OFF -DUSE_GL2PS:BOOL=OFF	\
+			-DUSE_FREETYPE:BOOL=OFF
+VIS_LIB_DEPENDS=	libftgl.so:graphics/ftgl		\
+			libgl2ps.so:print/gl2ps		\
+			libfreeimageplus.so:graphics/freeimage
+
+DOXYGEN_IMPLIES=	DOCS
+DOXYGEN_USE=	TEX=latex:build
+DOXYGEN_BUILD_DEPENDS=	bash:shells/bash		\
+			doxygen:devel/doxygen		\
+			dot:graphics/graphviz		\
+			pdftex:print/tex-basic-engines	\
+			inkscape:graphics/inkscape
+DOXYGEN_RUN_DEPENDS=	${LOCALBASE}/www/MathJax/MathJax.js:www/mathjax
+
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == "i386"
+BITS=	32
+.else
+BITS=	64
+.endif
+
+pre-everything::
+	@${ECHO_MSG}
+	@${ECHO_MSG} "Warning: to build OpenCascade, you should have at least"
+	@${ECHO_MSG} "2.6 Gb of free disk space in build area!"
+	@${ECHO_MSG}
+
+pre-configure:
+	${REINPLACE_CMD} -e 's|tclsh|${TCLSH}|' ${WRKSRC}/gendoc
+	${REINPLACE_CMD} -e 's|/usr/bin/|${LOCALBASE}/bin/|' ${WRKSRC}/adm/genconfdeps.tcl
+	${GREP} -rl x86_64 ${WRKSRC} | ${XARGS} ${REINPLACE_CMD}	\
+		-e 's|x86_64|amd64|'
+.for es in ${ENVSH}
+	${REINPLACE_CMD} -e 's|lin|bsd|' ${WRKSRC}/${es}
+.endfor
+
+pre-patch:
+	@${REINPLACE_CMD} 's|<malloc.h>|<stdlib.h>|' \
+		${WRKSRC}/src/OSD/OSD_MemInfo.cxx \
+		${WRKSRC}/src/StepFile/step.tab.c \
+		${WRKSRC}/src/StepFile/step.yacc
+
+post-build-DOXYGEN-on:
+	(cd ${WRKSRC} && ./gendoc -overview)
+
+post-install:
+	${MV} ${STAGEDIR}${OCCROOT}/bin/DRAWEXE-${PORTVERSION} ${STAGEDIR}${PREFIX}/bin/DRAWEXE
+	(cd ${STAGEDIR}${PREFIX}/bin &&							\
+	${LN} -sf DRAWEXE ${STAGEDIR}${OCCROOT}/bin/DRAWEXE)
+	# autoplist
+	@cd ${STAGEDIR}${PREFIX} && \
+		${FIND} * -type f -or -type l >> ${TMPPLIST}
+
+post-install-DOXYGEN-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	(cd ${WRKSRC}/doc/overview && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})
+	${RM} -r ${STAGEDIR}${DOCSDIR}/latex
+
+.if defined(MAINTAINER_MODE)
+regression-test:	install
+	${RM} -rf /tmp/testOCC
+	${MKDIR} /tmp/testOCC
+	bash -c "\
+	cd ${OCCROOT} && . ${OCCROOT}/bin/env.sh &&	\
+	CSF_TestScriptsPath=${OCCROOT}/tests		\
+	CSF_TestDataPath=${OCCROOT}/data		\
+	DRAWEXE -f ${FILESDIR}/regtest "
+.endif
+
+
+.include <bsd.port.mk>
diff --git a/cad/opencascade740/distinfo b/cad/opencascade740/distinfo
new file mode 100644
index 000000000000..7a074cbab512
--- /dev/null
+++ b/cad/opencascade740/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1569992557
+SHA256 (opencascade-7.4.0.tgz) = 1eace85115ea178f268e9d803ced994b66b72455b5484074b6ad7f643261f0a0
+SIZE (opencascade-7.4.0.tgz) = 216650633
diff --git a/cad/opencascade740/files/patch-CMakeLists.txt b/cad/opencascade740/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..81f4730e6b3a
--- /dev/null
+++ b/cad/opencascade740/files/patch-CMakeLists.txt
@@ -0,0 +1,26 @@
+--- CMakeLists.txt.orig	2017-08-30 13:27:56 UTC
++++ CMakeLists.txt
+@@ -847,7 +847,7 @@ if (${DRAWEXE_INDEX} GREATER -1)
+             PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
+   else()
+     install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION  "${INSTALL_DIR_SCRIPT}"
+-            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
++            PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+   endif()
+ 
+   # copy draw script to CMake binary folder
+@@ -1056,7 +1056,13 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONF
+ endforeach()
+ # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
+ install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
+-install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
++install(CODE "
++  configure_file(
++    \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\"
++    \"\$ENV{DESTDIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\"
++    COPYONLY)
++")
++
+ 
+ foreach (OCCT_MODULE ${OCCT_MODULES})
+   if (BUILD_MODULE_${OCCT_MODULE})
diff --git a/cad/opencascade740/files/patch-adm_cmake_occt__csf.cmake b/cad/opencascade740/files/patch-adm_cmake_occt__csf.cmake
new file mode 100644
index 000000000000..904f6ae7d25a
--- /dev/null
+++ b/cad/opencascade740/files/patch-adm_cmake_occt__csf.cmake
@@ -0,0 +1,9 @@
+--- adm/cmake/occt_csf.cmake.orig	2018-05-25 19:13:23 UTC
++++ adm/cmake/occt_csf.cmake
+@@ -116,6 +116,5 @@ if (WIN32)
+       set (CSF_OpenGlLibs  "GL")
+     endif()
+     set (CSF_XwLibs      "X11 Xext Xmu Xi")
+-    set (CSF_dl          "dl")
+   endif()
+ endif()
diff --git a/cad/opencascade740/files/patch-adm_cmake_occt__macros.cmake b/cad/opencascade740/files/patch-adm_cmake_occt__macros.cmake
new file mode 100644
index 000000000000..f4128a3ddc7d
--- /dev/null
+++ b/cad/opencascade740/files/patch-adm_cmake_occt__macros.cmake
@@ -0,0 +1,20 @@
+--- adm/cmake/occt_macros.cmake.orig	2018-05-25 19:13:23 UTC
++++ adm/cmake/occt_macros.cmake
+@@ -53,7 +53,7 @@ macro (OCCT_MAKE_OS_WITH_BITNESS)
+   elseif(APPLE)
+     set (OS_WITH_BIT "mac${COMPILER_BITNESS}")
+   else()
+-    set (OS_WITH_BIT "lin${COMPILER_BITNESS}")
++    set (OS_WITH_BIT "bsd${COMPILER_BITNESS}")
+   endif()
+ endmacro()
+ 
+@@ -337,7 +337,7 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_F
+     configure_file ("${TEMPLATE_HEADER_PATH}" "${ROOT_TARGET_OCCT_DIR}/${OCCT_INSTALL_DIR_PREFIX}/${HEADER_FILE_NAME}" @ONLY)
+   endforeach()
+   
+-  install (FILES ${OCCT_HEADER_FILES_COMPLETE} DESTINATION "${INSTALL_DIR}/${OCCT_INSTALL_DIR_PREFIX}")
++  install (FILES ${OCCT_HEADER_FILES_COMPLETE} DESTINATION "${INSTALL_DIR_INCLUDE}")
+   
+   string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
+   message (STATUS "Info: \(${CURRENT_TIME}\) Checking headers in inc folder...")
diff --git a/cad/opencascade740/files/patch-adm_templates_OpenCASCADEConfig.cmake.in b/cad/opencascade740/files/patch-adm_templates_OpenCASCADEConfig.cmake.in
new file mode 100644
index 000000000000..06c2689a20e8
--- /dev/null
+++ b/cad/opencascade740/files/patch-adm_templates_OpenCASCADEConfig.cmake.in
@@ -0,0 +1,19 @@
+--- adm/templates/OpenCASCADEConfig.cmake.in.orig	2017-12-27 14:54:08 UTC
++++ adm/templates/OpenCASCADEConfig.cmake.in
+@@ -31,11 +31,11 @@ if (OpenCASCADE_INSTALL_PREFIX MATCHES "
+ endif()
+ 
+ # Set OpenCASCADE paths to headers, binaries, libraries, resources, tests, samples, data
+-set (OpenCASCADE_BINARY_DIR   "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_BIN@")
+-set (OpenCASCADE_LIBRARY_DIR  "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_LIB@")
+-set (OpenCASCADE_SCRIPT_DIR   "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_SCRIPT@")
+-set (OpenCASCADE_INCLUDE_DIR  "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_INCLUDE@")
+-set (OpenCASCADE_RESOURCE_DIR "${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_RESOURCE@")
++set (OpenCASCADE_BINARY_DIR   "@INSTALL_DIR_BIN@")
++set (OpenCASCADE_LIBRARY_DIR  "@INSTALL_DIR_LIB@")
++set (OpenCASCADE_SCRIPT_DIR   "@INSTALL_DIR_SCRIPT@")
++set (OpenCASCADE_INCLUDE_DIR  "@INSTALL_DIR_INCLUDE@")
++set (OpenCASCADE_RESOURCE_DIR "@INSTALL_DIR_RESOURCE@")
+ 
+ # The C and C++ flags added by OpenCASCADE to the cmake-configured flags.
+ set (OpenCASCADE_C_FLAGS      "@CMAKE_C_FLAGS@")
diff --git a/cad/opencascade740/files/patch-adm_templates_custom.install.sh.in b/cad/opencascade740/files/patch-adm_templates_custom.install.sh.in
new file mode 100644
index 000000000000..7994fab5deff
--- /dev/null
+++ b/cad/opencascade740/files/patch-adm_templates_custom.install.sh.in
@@ -0,0 +1,25 @@
+--- adm/templates/custom.install.sh.in.orig	2017-12-27 14:54:08 UTC
++++ adm/templates/custom.install.sh.in
+@@ -21,14 +21,14 @@ if [ "$1" == "@BIN_LETTER@" ]; then
+     export TCL_VERSION_WITH_DOT="@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
+     export TK_VERSION_WITH_DOT="@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
+ 
+-    export CSF_OCCTBinPath="${CASROOT}/@INSTALL_DIR_BIN@"
+-    export CSF_OCCTLibPath="${CASROOT}/@INSTALL_DIR_LIB@"
+-    export CSF_OCCTIncludePath="${CASROOT}/@INSTALL_DIR_INCLUDE@"
+-    export CSF_OCCTResourcePath="${CASROOT}/@INSTALL_DIR_RESOURCE@"
+-    export CSF_OCCTDataPath="${CASROOT}/@INSTALL_DIR_DATA@"
+-    export CSF_OCCTSamplesPath="${CASROOT}/@INSTALL_DIR_SAMPLES@"
+-    export CSF_OCCTTestsPath="${CASROOT}/@INSTALL_DIR_TESTS@"
+-    export CSF_OCCTDocPath="${CASROOT}/@INSTALL_DIR_DOC@"
++    export CSF_OCCTBinPath="@INSTALL_DIR_BIN@"
++    export CSF_OCCTLibPath="@INSTALL_DIR_LIB@"
++    export CSF_OCCTIncludePath="@INSTALL_DIR_INCLUDE@"
++    export CSF_OCCTResourcePath="@INSTALL_DIR_RESOURCE@"
++    export CSF_OCCTDataPath="@INSTALL_DIR_DATA@"
++    export CSF_OCCTSamplesPath="@INSTALL_DIR_SAMPLES@"
++    export CSF_OCCTTestsPath="@INSTALL_DIR_TESTS@"
++    export CSF_OCCTDocPath="@INSTALL_DIR_DOC@"
+   fi
+ fi
+ 
diff --git a/cad/opencascade740/files/patch-inc_Standard__Time.hxx b/cad/opencascade740/files/patch-inc_Standard__Time.hxx
new file mode 100644
index 000000000000..500d47993eee
--- /dev/null
+++ b/cad/opencascade740/files/patch-inc_Standard__Time.hxx
@@ -0,0 +1,19 @@
+--- inc/Standard_Time.hxx.orig	2017-08-30 13:28:31 UTC
++++ inc/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/opencascade740/files/patch-src_DrawResources_CheckCommands.tcl b/cad/opencascade740/files/patch-src_DrawResources_CheckCommands.tcl
new file mode 100644
index 000000000000..ed30fa375382
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_DrawResources_CheckCommands.tcl
@@ -0,0 +1,62 @@
+--- src/DrawResources/CheckCommands.tcl.orig	2018-05-25 19:13:38 UTC
++++ src/DrawResources/CheckCommands.tcl
+@@ -1036,6 +1036,7 @@ help checkplatform {
+     -windows : return 1 if current platform is 'Windows', overwise return 0
+     -linux   : return 1 if current platform is 'Linux', overwise return 0
+     -osx     : return 1 if current platform is 'MacOS X', overwise return 0
++    -freebsd : return 1 if current platform is 'FreeBSD', overwise return 0
+ 
+   Only one option can be used at once.
+   If no option is given, procedure will return the name of current platform.
+@@ -1044,9 +1045,11 @@ proc checkplatform {args} {
+     set check_for_windows false
+     set check_for_linux false
+     set check_for_macosx false
++    set check_for_freebsd false
+ 
+     set options {{"-windows" check_for_windows 0}
+                  {"-linux" check_for_linux 0}
++                 {"-freebsd" check_for_freebsd 0}
+                  {"-osx" check_for_macosx 0}}
+ 
+     _check_args ${args} ${options} "checkplatform"
+@@ -1055,17 +1058,19 @@ proc checkplatform {args} {
+         set current_platform Windows
+     } elseif { $::tcl_platform(os) == "Linux" } {
+         set current_platform Linux
++    } elseif { $::tcl_platform(os) == "FreeBSD" } {
++        set current_platform FreeBSD
+     } elseif { $::tcl_platform(os) == "Darwin" } {
+         set current_platform MacOS
+     }
+ 
+     # no args are given
+-    if { !${check_for_windows} && !${check_for_linux} && !${check_for_macosx}} {
++    if { !${check_for_windows} && !${check_for_linux} && !${check_for_macosx} && !${check_for_freebsd}} {
+         return ${current_platform}
+     }
+ 
+     # check usage of proc checkplatform
+-    if { [expr [string is true ${check_for_windows}] + [string is true ${check_for_linux}] + [string is true ${check_for_macosx}] ] > 1} {
++    if { [expr [string is true ${check_for_windows}] + [string is true ${check_for_linux}] + [string is true ${check_for_macosx}] + [string is true ${check_for_freebsd}] ] > 1} {
+         error "Error: wrong usage of command checkplatform, only single option can be used at once"
+     }
+ 
+@@ -1074,11 +1079,16 @@ proc checkplatform {args} {
+         return 1
+     }
+ 
+-    # checking for Mac OS X platforms
++    # checking for Linux platforms
+     if { ${check_for_linux} && ${current_platform} == "Linux" } {
+         return 1
+     }
+ 
++    # checking for FreeBSD platforms
++    if { ${check_for_freebsd} && ${current_platform} == "FreeBSD" } {
++        return 1
++    }
++
+     # checking for Mac OS X platforms
+     if { ${check_for_macosx} && ${current_platform} == "MacOS" } {
+         return 1
diff --git a/cad/opencascade740/files/patch-src_IVtkDraw_IVtkDraw.cxx b/cad/opencascade740/files/patch-src_IVtkDraw_IVtkDraw.cxx
new file mode 100644
index 000000000000..3184727b086b
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_IVtkDraw_IVtkDraw.cxx
@@ -0,0 +1,15 @@
+--- src/IVtkDraw/IVtkDraw.cxx.orig	2020-11-03 14:50:01 UTC
++++ src/IVtkDraw/IVtkDraw.cxx
+@@ -36,6 +36,12 @@
+ #include <V3d_TypeOfOrientation.hxx>
+ #include <Aspect_DisplayConnection.hxx>
+ 
++// Preventing naming collisions between
++// GLX and VTK versions 9.0 and above
++#ifdef AllValues
++#undef AllValues
++#endif
++
+ #include <IVtk_Types.hxx>
+ #include <IVtkVTK_ShapeData.hxx>
+ #include <IVtkOCC_Shape.hxx>
diff --git a/cad/opencascade740/files/patch-src_STEPConstruct_STEPConstruct__AP203Context.cxx b/cad/opencascade740/files/patch-src_STEPConstruct_STEPConstruct__AP203Context.cxx
new file mode 100644
index 000000000000..aaa264563964
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_STEPConstruct_STEPConstruct__AP203Context.cxx
@@ -0,0 +1,19 @@
+--- src/STEPConstruct/STEPConstruct_AP203Context.cxx.orig	2017-08-30 13:28:30 UTC
++++ src/STEPConstruct/STEPConstruct_AP203Context.cxx
+@@ -123,7 +123,15 @@ Handle(StepBasic_DateAndTime) STEPConstr
+     long shift = 0;
+     _get_timezone (&shift);
+   #else
+-    Standard_Integer shift = Standard_Integer(timezone);
++    #if defined(__FreeBSD__)
++	struct tm *lt;
++	time_t t = 0;
++	time(&t);
++	lt = localtime(&t);
++	Standard_Integer shift = Standard_Integer(lt->tm_gmtoff);
++    #else
++      Standard_Integer shift = Standard_Integer(timezone);
++    #endif
+   #endif
+     Standard_Integer shifth = abs ( shift ) / 3600;
+     Standard_Integer shiftm = ( abs ( shift ) - shifth * 3600 ) / 60;
diff --git a/cad/opencascade740/files/patch-src_Standard_Standard__CLocaleSentry.hxx b/cad/opencascade740/files/patch-src_Standard_Standard__CLocaleSentry.hxx
new file mode 100644
index 000000000000..3c44df882800
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_Standard_Standard__CLocaleSentry.hxx
@@ -0,0 +1,11 @@
+--- src/Standard/Standard_CLocaleSentry.hxx.orig	2018-05-25 19:14:11 UTC
++++ src/Standard/Standard_CLocaleSentry.hxx
+@@ -31,7 +31,7 @@
+   //! Presence of this extension cannot be checked in straightforward way (like (_POSIX_C_SOURCE >= 200809L))
+   //! due to missing such declarations in standard.
+   //! On macOS new functions are declared within "xlocale.h" header (the same is for glibc, but this header has been removed since glibc 2.26).
+-  #if defined(__APPLE__)
++  #if defined(__APPLE__) || (defined(__FreeBSD__) && (__FreeBSD_version > 910000))
+     #define OCCT_CLOCALE_POSIX2008
+   #endif
+ 
diff --git a/cad/opencascade740/files/patch-src_Standard_Standard__CString.cxx b/cad/opencascade740/files/patch-src_Standard_Standard__CString.cxx
new file mode 100644
index 000000000000..a6755f655f11
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_Standard_Standard__CString.cxx
@@ -0,0 +1,11 @@
+--- src/Standard/Standard_CString.cxx.orig	2017-08-30 13:28:31 UTC
++++ src/Standard/Standard_CString.cxx
+@@ -81,7 +81,7 @@ Standard_Integer HashCodes (const Standa
+     // strtod, strtol, strtoll functions. For other system with locale-depended
+     // implementations problems may appear if "C" locale is not set explicitly.
+     #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__MINGW32__)
+-      #error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
++      #warning System does not support xlocale. Import/export could be broken if C locale did not specified by application.
+     #endif
+     #define strtod_l(thePtr, theNextPtr, theLocale)              strtod(thePtr, theNextPtr)
+   #endif
diff --git a/cad/opencascade740/files/patch-src_Standard_Standard__MMgrTBBalloc.cxx b/cad/opencascade740/files/patch-src_Standard_Standard__MMgrTBBalloc.cxx
new file mode 100644
index 000000000000..dfbd5c7434b2
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_Standard_Standard__MMgrTBBalloc.cxx
@@ -0,0 +1,12 @@
+--- src/Standard/Standard_MMgrTBBalloc.cxx.orig	2017-08-30 13:28:31 UTC
++++ src/Standard/Standard_MMgrTBBalloc.cxx
+@@ -18,6 +18,9 @@
+ 
+ // paralleling with Intel TBB
+ #ifdef HAVE_TBB
++#ifdef VERSION
++#undef VERSION
++#endif
+ #include <tbb/scalable_allocator.h>
+ using namespace tbb;
+ #else
diff --git a/cad/opencascade740/files/patch-src_Standard_Standard__Time.hxx b/cad/opencascade740/files/patch-src_Standard_Standard__Time.hxx
new file mode 100644
index 000000000000..907ca96e6cd6
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_Standard_Standard__Time.hxx
@@ -0,0 +1,19 @@
+--- src/Standard/Standard_Time.hxx.orig	2017-08-30 13:28:31 UTC
++++ src/Standard/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/opencascade740/files/patch-src_StepFile_recfile.pc b/cad/opencascade740/files/patch-src_StepFile_recfile.pc
new file mode 100644
index 000000000000..75784b8b4e44
--- /dev/null
+++ b/cad/opencascade740/files/patch-src_StepFile_recfile.pc
@@ -0,0 +1,11 @@
+--- src/StepFile/recfile.pc.orig	2017-08-30 13:28:34 UTC
++++ src/StepFile/recfile.pc
+@@ -16,7 +16,7 @@
+ #include "stdio.h"
+ #include "string.h"
+ #include "stdlib.h"
+-#if (!defined(_WIN32) && !defined(__APPLE__))
++#if (!defined(_WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__))
+ #include "malloc.h"
+ #endif
+ #include "recfile.ph" 
diff --git a/cad/opencascade740/files/regtest b/cad/opencascade740/files/regtest
new file mode 100644
index 000000000000..4e65a0300dfc
--- /dev/null
+++ b/cad/opencascade740/files/regtest
@@ -0,0 +1,4 @@
+pload ALL
+testgrid -outdir /tmp/testOCC
+exit
+
diff --git a/cad/opencascade740/pkg-descr b/cad/opencascade740/pkg-descr
new file mode 100644
index 000000000000..cf4490349f1d
--- /dev/null
+++ b/cad/opencascade740/pkg-descr
@@ -0,0 +1,12 @@
+Open CASCADE Technology is a software development platform freely available in
+open source. It includes components for 3D surface and solid modeling,
+visualization, data exchange and rapid application development.
+
+Open CASCADE Technology can be best applied in development of numerical
+simulation software including CAD/CAM/CAE, AEC and GIS, as well as PDM
+applications.
+
+BUGS: the interesting parts of this port are the libraries, but some components
+      like Wok are not [yet] fully functional.
+
+WWW: http://www.opencascade.org/