git: a9a91e3c1401 - main - science/elmerfem: Update 8.4.20200708 -> 9.0

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 16 Nov 2021 00:16:03 UTC
The branch main has been updated by yuri:

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

commit a9a91e3c1401cff0f2e35c851eda669ea7612686
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2021-11-16 00:09:45 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2021-11-16 00:16:01 +0000

    science/elmerfem: Update 8.4.20200708 -> 9.0
    
    PR:             258784
    Original patch submitted by:    henrik@gulbra.net (maintainer)
---
 science/elmerfem/Makefile                          | 49 +++++++++++--------
 science/elmerfem/distinfo                          |  6 +--
 .../patch-ElmerGUI_Application_cad_cadview.cpp     | 55 +++++++++++++++++++++-
 ...ake_Modules_FindPackageHandleStandardArgs.cmake | 10 ++++
 .../files/patch-elmergrid_src_CMakeLists.txt       | 12 ++---
 science/elmerfem/pkg-plist                         |  8 ++++
 6 files changed, 111 insertions(+), 29 deletions(-)

diff --git a/science/elmerfem/Makefile b/science/elmerfem/Makefile
index 819410eb1e2e..e3911bb4dafc 100644
--- a/science/elmerfem/Makefile
+++ b/science/elmerfem/Makefile
@@ -1,8 +1,8 @@
 # Created by: Pedro Giffuni
 
 PORTNAME=	elmerfem
-PORTVERSION=	8.4.20200708
-PORTREVISION=	2
+DISTVERSIONPREFIX=	release-
+DISTVERSION=	9.0
 CATEGORIES=	science
 
 MAINTAINER=	henrik@gulbra.net
@@ -10,23 +10,25 @@ COMMENT=	Multiphysical simulation software
 
 LICENSE=	GPLv2
 
-LIB_DEPENDS=	libmetis.so:math/metis \
+LIB_DEPENDS=	libblas.so:math/blas \
+		libmetis.so:math/metis \
 		libmpich.so:net/mpich \
 		libopenblas.so:math/openblas \
 		libparpack.so:math/arpack-ng
 
 USES=		cmake compiler:c++11-lang fortran
-USE_GITHUB=	yes
-GH_ACCOUNT=	ElmerCSC
-GH_TAGNAME=	679a882b
 USE_LDCONFIG=	${PREFIX}/lib/elmersolver
 
-ALL_TARGET=	# empty
+USE_GITHUB=	yes
+GH_ACCOUNT=	ElmerCSC
 
 CMAKE_ARGS=	-DELMER_FEM_REVISION:STRING=${GH_TAGNAME}
 
+ALL_TARGET=	# empty
+
 LDFLAGS+=	-L${LOCALBASE}/lib
-FCPPFLAGS+=	-ansi
+
+PORTSCOUT=	limit:^release-[1-9]
 
 CMAKE_ARGS+=	-DHAVE_INTTYPES_H=ON
 .if !defined(MAINTAINER_MODE)
@@ -36,31 +38,35 @@ CMAKE_ARGS+=	-Wno-dev
 OPTIONS_DEFINE=		GUI OCC
 OPTIONS_DEFAULT=	GUI OCC
 OPTIONS_SUB=		yes
-OCC_IMPLIES=		GUI
 
 GUI_DESC=		Build with ElmerGUI (Graphical User Interface)
+OCC_DESC=		Use OpenCASCADE for CAD import in ElmerGUI
+
+GUI_LIB_DEPENDS=	libqwt6.so:x11-toolkits/qwt6
+GUI_USES=		gl jpeg qt:5 xorg
+GUI_USE=		gl=gl,glu xorg=ice,sm,x11,xext,xt qt=${_QT5_LIBS:ts,}
 GUI_CMAKE_BOOL=		WITH_ELMERGUI WITH_PARAVIEW
 GUI_CMAKE_ON=		-DQWT_LIBRARY=${QT_LIBDIR}/libqwt6.so \
 			-DQWT_INCLUDE_DIR=${QT_INCDIR}/qwt6 \
 			-DDESIRED_QT_VERSION=5 \
 			-DWITH_QT5:BOOL=TRUE \
 			-DQT_FOUND:BOOL=TRUE
-GUI_LIB_DEPENDS=	libqwt6.so:x11-toolkits/qwt6
-GUI_USES=		gl jpeg qt:5 xorg
-GUI_USE=		gl=gl,glu xorg=ice,sm,x11,xext,xt qt=${QT5_LIBS:ts,}
 
-OCC_DESC=		Use OpenCASCADE for CAD import in ElmerGUI
-OCC_CMAKE_BOOL=		WITH_OCC
-OCC_CMAKE_ON=		-DVTK_DIR=${LOCALBASE}/lib/vtk-8.2/cmake/vtk-8.2
+OCC_IMPLIES=		GUI
 OCC_LIB_DEPENDS=	libexpat.so:textproc/expat2 \
 			libfreetype.so:print/freetype2 \
 			libpng.so:graphics/png \
-			libpython3.7m.so:lang/python37 \
+			libpython${_PYVERSION}.so:lang/python${PYTHON_SUFFIX} \
 			libtiff.so:graphics/tiff \
 			libTKernel.so:cad/opencascade \
-			libvtksys-8.2.so:math/vtk8
+			libvtksys-9.0.so:math/vtk9
+OCC_USES=		python
+OCC_CMAKE_BOOL=		WITH_OCC
+OCC_CMAKE_ON=		-DVTK_DIR=${LOCALBASE}/lib/cmake/vtk-9.0
 
-QT5_LIBS=	buildtools_build concurrent core declarative gui location \
+_LIBSTAGEDIR=	${STAGEDIR}/${PREFIX}/lib/elmersolver
+_PYVERSION=	${PYTHON_VER}${PYTHON_ABIVER}
+_QT5_LIBS=	buildtools_build concurrent core declarative gui location \
 		network opengl printsupport qmake_build script sensors \
 		sql svg webchannel webkit widgets xml
 
@@ -80,9 +86,10 @@ FFLAGS+=	-fallow-argument-mismatch
 .endif
 
 post-patch:
+	@${RM} ${WRKSRC}/cmake/Modules/CMakeParseArguments.cmake
 	@${RM} -r ${WRKSRC}/elmergrid/src/metis-5.1.0
 	@${REINPLACE_CMD} -e 's,"metis.*/metis\.h",<metis.h>,' \
-		${WRKSRC}/elmergrid/src/femelmer.c
+		${WRKSRC}/elmergrid/src/egparallel.c
 
 post-patch-OCC-on:
 	@${REINPLACE_CMD} -e "s|\$${VERSION}|`${PKG_QUERY} '%v' opencascade`|" \
@@ -92,6 +99,10 @@ post-patch-OCC-on:
 
 post-install:
 	${LN} -sf ElmerSolver_mpi ${STAGEDIR}${PREFIX}/bin/ElmerSolver
+	${LN} -sf libelmersolver.so ${_LIBSTAGEDIR}/libelmersolver.so.0
+	${LN} -sf libfhuti.so ${_LIBSTAGEDIR}/libfhuti.so.0
+	${LN} -sf libmatc.so ${_LIBSTAGEDIR}/libmatc.so.0
+	${LN} -sf libmpi_stubs.so ${_LIBSTAGEDIR}/libmpi_stubs.so.0
 	@${STRIP_CMD} ${STAGEDIR}/${PREFIX}/bin/ElmerGrid
 
 do-test:
diff --git a/science/elmerfem/distinfo b/science/elmerfem/distinfo
index d3e4b4b15e1a..cff56053e51d 100644
--- a/science/elmerfem/distinfo
+++ b/science/elmerfem/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1595166083
-SHA256 (ElmerCSC-elmerfem-8.4.20200708-679a882b_GH0.tar.gz) = 13c8b9a4af76ae8fc6b6fcff612572e671ac31cffe070bbef7ace740e4044f1d
-SIZE (ElmerCSC-elmerfem-8.4.20200708-679a882b_GH0.tar.gz) = 63393434
+TIMESTAMP = 1637005486
+SHA256 (ElmerCSC-elmerfem-release-9.0_GH0.tar.gz) = 08c5bf261e87ff37456c1aa0372db3c83efabe4473ea3ea0b8ec66f5944d1aa0
+SIZE (ElmerCSC-elmerfem-release-9.0_GH0.tar.gz) = 64060003
diff --git a/science/elmerfem/files/patch-ElmerGUI_Application_cad_cadview.cpp b/science/elmerfem/files/patch-ElmerGUI_Application_cad_cadview.cpp
index 0c919dfdafff..5187c4d8599f 100644
--- a/science/elmerfem/files/patch-ElmerGUI_Application_cad_cadview.cpp
+++ b/science/elmerfem/files/patch-ElmerGUI_Application_cad_cadview.cpp
@@ -1,4 +1,6 @@
---- ElmerGUI/Application/cad/cadview.cpp.orig	2020-06-26 12:18:06 UTC
+- includes workaround for https://github.com/ElmerCSC/elmerfem/issues/304
+
+--- ElmerGUI/Application/cad/cadview.cpp.orig	2021-11-10 14:49:01 UTC
 +++ ElmerGUI/Application/cad/cadview.cpp
 @@ -74,7 +74,7 @@
  #include <BRepAdaptor_Curve2d.hxx>
@@ -9,3 +11,54 @@
  #include <BRepTools.hxx>
  #include <BRep_Builder.hxx>
  #include <BRep_Tool.hxx>
+@@ -343,9 +343,6 @@ bool CadView::readFile(QString fileName) {
+ 
+     const gp_Trsf &Transformation = Location.Transformation();
+ 
+-    const Poly_Array1OfTriangle &Triangles = Triangulation->Triangles();
+-    const TColgp_Array1OfPnt &Nodes = Triangulation->Nodes();
+-
+     int nofTriangles = Triangulation->NbTriangles();
+     int nofNodes = Triangulation->NbNodes();
+ 
+@@ -366,8 +363,8 @@ bool CadView::readFile(QString fileName) {
+     vtkTriangle *triangle = vtkTriangle::New();
+     partGrid->Allocate(nofTriangles, nofTriangles);
+ 
+-    for (int i = Triangles.Lower(); i <= Triangles.Upper(); i++) {
+-      Triangles(i).Get(n0, n1, n2);
++    for (int i = 1; i <= nofTriangles; i++) {
++      Triangulation->Triangle(i).Get(n0, n1, n2);
+ 
+       if (Face.Orientation() != TopAbs_FORWARD) {
+         int tmp = n2;
+@@ -375,9 +372,9 @@ bool CadView::readFile(QString fileName) {
+         n1 = tmp;
+       }
+ 
+-      triangle->GetPointIds()->SetId(0, n0 - Nodes.Lower());
+-      triangle->GetPointIds()->SetId(1, n1 - Nodes.Lower());
+-      triangle->GetPointIds()->SetId(2, n2 - Nodes.Lower());
++      triangle->GetPointIds()->SetId(0, n0 - 1);
++      triangle->GetPointIds()->SetId(1, n1 - 1);
++      triangle->GetPointIds()->SetId(2, n2 - 1);
+ 
+       partGrid->InsertNextCell(triangle->GetCellType(),
+                                triangle->GetPointIds());
+@@ -385,13 +382,13 @@ bool CadView::readFile(QString fileName) {
+ 
+     double x[3];
+     vtkPoints *partPoints = vtkPoints::New();
+-    for (int i = Nodes.Lower(); i <= Nodes.Upper(); i++) {
+-      gp_XYZ XYZ = Nodes(i).Coord();
++    for (int i = 1; i <= nofNodes; i++) {
++      gp_XYZ XYZ = Triangulation->Node(i).Coord();
+       Transformation.Transforms(XYZ);
+       x[0] = XYZ.X();
+       x[1] = XYZ.Y();
+       x[2] = XYZ.Z();
+-      partPoints->InsertPoint(i - Nodes.Lower(), x);
++      partPoints->InsertPoint(i - 1, x);
+     }
+ 
+     partGrid->SetPoints(partPoints);
diff --git a/science/elmerfem/files/patch-cmake_Modules_FindPackageHandleStandardArgs.cmake b/science/elmerfem/files/patch-cmake_Modules_FindPackageHandleStandardArgs.cmake
new file mode 100644
index 000000000000..68963493b696
--- /dev/null
+++ b/science/elmerfem/files/patch-cmake_Modules_FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,10 @@
+--- cmake/Modules/FindPackageHandleStandardArgs.cmake.orig	2020-11-10 19:52:44 UTC
++++ cmake/Modules/FindPackageHandleStandardArgs.cmake
+@@ -100,7 +100,6 @@
+ #  License text for the above reference.)
+ 
+ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
+-include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
+ 
+ # internal helper macro
+ macro(_FPHSA_FAILURE_MESSAGE _msg)
diff --git a/science/elmerfem/files/patch-elmergrid_src_CMakeLists.txt b/science/elmerfem/files/patch-elmergrid_src_CMakeLists.txt
index c2efbd98e0cf..8daab05b04f0 100644
--- a/science/elmerfem/files/patch-elmergrid_src_CMakeLists.txt
+++ b/science/elmerfem/files/patch-elmergrid_src_CMakeLists.txt
@@ -1,4 +1,4 @@
---- elmergrid/src/CMakeLists.txt.orig	2020-03-06 10:30:22 UTC
+--- elmergrid/src/CMakeLists.txt.orig	2020-11-10 19:52:44 UTC
 +++ elmergrid/src/CMakeLists.txt
 @@ -12,19 +12,13 @@ IF(CMAKE_CROSSCOMPILING)
    ENDIF()
@@ -8,11 +8,11 @@
 -SET(METIS_INSTALL FALSE CACHE BOOL "")
 -ADD_SUBDIRECTORY(metis-5.1.0)
 -
- SET(elmergrid_SRCS common.h femdef.h femelmer.h femfilein.h
-   femfileout.h feminfo.h femknot.h femmesh.h 
-   femtypes.h nrutil.h common.c femelmer.c femfilein.c femfileout.c
-   feminfo.c femknot.c femmesh.c fempre.c 
-   nrutil.c)
+ SET(elmergrid_SRCS egdef.h egparallel.h egnative.h egconvert.h
+   egexport.h egextra.h egmesh.h 
+   egtypes.h egutils.h egparallel.c egnative.c egconvert.c egexport.c
+   egextra.c egmesh.c fempre.c 
+   egutils.c)
  
 -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/metis)
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/science/elmerfem/pkg-plist b/science/elmerfem/pkg-plist
index 7846c097d1d5..a0a7c03ac32b 100644
--- a/science/elmerfem/pkg-plist
+++ b/science/elmerfem/pkg-plist
@@ -12,9 +12,13 @@ bin/matc
 lib/elmersolver/libamd.a
 lib/elmersolver/libamdf77.a
 lib/elmersolver/libelmersolver.so
+lib/elmersolver/libelmersolver.so.0
 lib/elmersolver/libfhuti.so
+lib/elmersolver/libfhuti.so.0
 lib/elmersolver/libmatc.so
+lib/elmersolver/libmatc.so.0
 lib/elmersolver/libmpi_stubs.so
+lib/elmersolver/libmpi_stubs.so.0
 lib/elmersolver/libumfpack.a
 %%GUI%%share/ElmerGUI/edf-extra/advection-diffusion.xml
 %%GUI%%share/ElmerGUI/edf-extra/divergencesolver.xml
@@ -292,7 +296,9 @@ share/elmersolver/include/pelementmaps.mod
 share/elmersolver/include/porousmaterials.mod
 share/elmersolver/include/radiation.mod
 share/elmersolver/include/radiationfactorglobals.mod
+share/elmersolver/include/saveutils.mod
 share/elmersolver/include/smoothers.mod
+share/elmersolver/include/solidmechanicsutils.mod
 share/elmersolver/include/solverutils.mod
 share/elmersolver/include/sparitercomm.mod
 share/elmersolver/include/spariterglobals.mod
@@ -353,6 +359,7 @@ share/elmersolver/lib/FluxSolver.so
 share/elmersolver/lib/FourierLoss.so
 share/elmersolver/lib/FreeSurfaceReduced.so
 share/elmersolver/lib/FreeSurfaceSolver.so
+share/elmersolver/lib/GmshOutputReader.so
 share/elmersolver/lib/HarmonicSignals.so
 share/elmersolver/lib/HeatSolve.so
 share/elmersolver/lib/HeatSolveVec.so
@@ -369,6 +376,7 @@ share/elmersolver/lib/MagnetoDynamics.so
 share/elmersolver/lib/MagnetoDynamics2D.so
 share/elmersolver/lib/MarchingODESolver.so
 share/elmersolver/lib/Mesh2MeshSolver.so
+share/elmersolver/lib/MeshChecksum.so
 share/elmersolver/lib/MeshSolve.so
 share/elmersolver/lib/ModelMixedPoisson.so
 share/elmersolver/lib/ModelPDE.so