git: 935ebd18187e - main - math/elpa: Update 2019.05.002 -> 2021.11.001

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 17 Jul 2022 00:30:43 UTC
The branch main has been updated by yuri:

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

commit 935ebd18187e109c940bd6a3e2a7eea2ee7b56cf
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-07-17 00:27:37 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-07-17 00:30:41 +0000

    math/elpa: Update 2019.05.002 -> 2021.11.001
    
    A special hack is used to build this port because
    GNU Makefiles don't build components in proper order by default,
    and .mod files are built only after they are used.
    
    It was broken for a long while for this reason.
---
 math/elpa/Makefile                                 | 26 ++++++++----
 math/elpa/distinfo                                 |  6 +--
 .../patch-src_helpers_check__thread__affinity.c    | 32 ++++++++++++++
 math/elpa/pkg-plist                                | 49 +++++++++++++---------
 4 files changed, 83 insertions(+), 30 deletions(-)

diff --git a/math/elpa/Makefile b/math/elpa/Makefile
index e0363f416c7c..bce7ed9c98b6 100644
--- a/math/elpa/Makefile
+++ b/math/elpa/Makefile
@@ -1,8 +1,7 @@
 PORTNAME=	elpa
-DISTVERSION=	2019.05.002
-PORTREVISION=	2
+DISTVERSION=	2021.11.001
 CATEGORIES=	math
-MASTER_SITES=	http://elpa.mpcdf.mpg.de/html/Releases/${DISTVERSION}/
+MASTER_SITES=	https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/${DISTVERSION}/
 
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Eigenvalue soLver for Petaflop Applications
@@ -12,8 +11,6 @@ LICENSE_COMB=	dual
 LICENSE_FILE_GPLv3=	${WRKSRC}/COPYING/gpl.txt
 LICENSE_FILE_LGPL3=	${WRKSRC}/COPYING/lgpl.txt
 
-BROKEN_aarch64=	fails to build: Fatal Error: config-f90.h: No such file or directory
-
 LIB_DEPENDS=	libopenblas.so:math/openblas
 
 USES=		compiler:c11 fortran gmake libtool localbase perl5 shebangfix
@@ -22,14 +19,26 @@ USE_LDCONFIG=	yes
 SHEBANG_GLOB=	*.pl
 
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--disable-avx --disable-avx2 --disable-static \
+CONFIGURE_ARGS=	--disable-avx --disable-avx2 --disable-avx512 --disable-static \
 		--disable-c-tests
 
+CFLAGS+=	-I${WRKSRC} -I${WRKSRC}/private_modules
+FCFLAGS+=	-I${WRKSRC} -I${WRKSRC}/private_modules
+LDFLAGS+=	-lutil
+
+# ugly workaround for missing .mod files: some targets are added before 'all' that force rebuild of missing .mod files
+ALL_TARGET=	src/general/libelpa_private_la-elpa_utilities.lo \
+		src/libelpa_private_la-elpa_generated_fortran_interfaces.lo \
+		src/elpa1/libelpa_private_la-elpa1_compute_private.lo \
+		src/elpa2/libelpa_private_la-elpa2_compute.lo \
+		all
 INSTALL_TARGET=	install-strip
 
 BINARY_ALIAS=	make=gmake gcc=gcc${GCC_DEFAULT} g++=g++${GCC_DEFAULT} # build fails with clang: recursively calls cc
 FCFLAGS+=	-std=legacy -I${LOCALBASE}/include
 
+MAKE_JOBS_UNSAFE=	yes # part of the workaround for .mod files
+
 OPTIONS_DEFINE=			OPENMP MPI DOCS
 OPTIONS_DEFINE_amd64=		SSE
 OPTIONS_DEFAULT_amd64=		SSE
@@ -42,8 +51,11 @@ MPI_LIB_DEPENDS=		libmpich.so:net/mpich \
 
 PORTDOCS=	*
 
-post-patch: # workaround for: https://github.com/marekandreas/elpa/issues/6
+post-patch:
+	# workaround for: https://github.com/marekandreas/elpa/issues/6
 	@${FIND} ${WRKSRC} -name "*.mk" | ${XARGS} ${REINPLACE_CMD} -e 's|-Werror| |'
+	# patch in the full path name of config-f90.h
+	@${FIND} ${WRKSRC} -name *.F90 -o -name *.c | ${XARGS} ${REINPLACE_CMD} -e 's|#include "config-f90.h"|#include "${WRKSRC}/config-f90.h"|'
 
 .include <bsd.port.options.mk>
 
diff --git a/math/elpa/distinfo b/math/elpa/distinfo
index e55b2cbd10a3..2ab100f5d7b4 100644
--- a/math/elpa/distinfo
+++ b/math/elpa/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1570675365
-SHA256 (elpa-2019.05.002.tar.gz) = d2eab5e5d74f53601220b00d18185670da8c00c13e1c1559ecfb0cd7cb2c4e8d
-SIZE (elpa-2019.05.002.tar.gz) = 1239916
+TIMESTAMP = 1642194690
+SHA256 (elpa-2021.11.001.tar.gz) = fb361da6c59946661b73e51538d419028f763d7cb9dacf9d8cd5c9cd3fb7802f
+SIZE (elpa-2021.11.001.tar.gz) = 1388817
diff --git a/math/elpa/files/patch-src_helpers_check__thread__affinity.c b/math/elpa/files/patch-src_helpers_check__thread__affinity.c
new file mode 100644
index 000000000000..40db36a7cd7d
--- /dev/null
+++ b/math/elpa/files/patch-src_helpers_check__thread__affinity.c
@@ -0,0 +1,32 @@
+--- src/helpers/check_thread_affinity.c.orig	2021-11-16 11:26:03 UTC
++++ src/helpers/check_thread_affinity.c
+@@ -47,11 +47,14 @@
+ //
+ // Author: Andreas Marek, MPCDF
+ 
+-#define  _GNU_SOURCE
++//#define  _GNU_SOURCE
++#define __BSD_VISIBLE
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <sched.h>
+ #include <sys/types.h>
++#include <sys/_cpuset.h>
++#include <sys/cpuset.h>
+ #include <unistd.h>
+ 
+ 
+@@ -60,11 +63,11 @@ void get_thread_affinity(int *cpu_id) {
+ }
+ 
+ void get_process_affinity(int cpu_id) {
+-  cpu_set_t set;
++  cpuset_t set;
+   int ret, i;
+   int cpu;
+   cpu_id = 9999999 ;
+-  ret = sched_getaffinity(0, sizeof(cpu_set_t), &set);
++  ret = sched_getaffinity(0, sizeof(cpuset_t), &set);
+   for (i=0; i < CPU_SETSIZE; i++)
+     {
+       cpu = CPU_ISSET(i, &set);
diff --git a/math/elpa/pkg-plist b/math/elpa/pkg-plist
index 4d8e1bbdda50..c4569a7c4294 100644
--- a/math/elpa/pkg-plist
+++ b/math/elpa/pkg-plist
@@ -1,34 +1,41 @@
 bin/elpa2_print_kernels
-include/elpa-2019.05.002/elpa/elpa.h
-include/elpa-2019.05.002/elpa/elpa_constants.h
-include/elpa-2019.05.002/elpa/elpa_generated.h
-include/elpa-2019.05.002/elpa/elpa_generated_c_api.h
-include/elpa-2019.05.002/elpa/elpa_generated_legacy.h
-include/elpa-2019.05.002/elpa/elpa_generic.h
-include/elpa-2019.05.002/elpa/elpa_legacy.h
-include/elpa-2019.05.002/elpa/elpa_version.h
-include/elpa-2019.05.002/modules/elpa.mod
-include/elpa-2019.05.002/modules/elpa_api.mod
-include/elpa-2019.05.002/modules/elpa_constants.mod
-include/elpa-2019.05.002/modules/elpa1.mod
-include/elpa-2019.05.002/modules/elpa1_auxiliary.mod
-include/elpa-2019.05.002/modules/elpa2.mod
-include/elpa-2019.05.002/modules/elpa2_utilities.mod
-include/elpa-2019.05.002/modules/elpa_driver.mod
-include/elpa-2019.05.002/modules/elpa_utilities.mod
+include/elpa-2021.11.001/elpa/elpa.h
+include/elpa-2021.11.001/elpa/elpa_constants.h
+include/elpa-2021.11.001/elpa/elpa_generated.h
+include/elpa-2021.11.001/elpa/elpa_generated_c_api.h
+include/elpa-2021.11.001/elpa/elpa_generic.h
+include/elpa-2021.11.001/elpa/elpa_simd_constants.h
+include/elpa-2021.11.001/elpa/elpa_version.h
+include/elpa-2021.11.001/modules/elpa.mod
+include/elpa-2021.11.001/modules/elpa_api.mod
+include/elpa-2021.11.001/modules/elpa_constants.mod
+include/elpa-2021.11.001/src/helpers/lapack_interfaces.h
+include/elpa-2021.11.001/src/helpers/scalapack_interfaces.h
 lib/libelpa.so
-lib/libelpa.so.14
-lib/libelpa.so.14.0.0
-libdata/pkgconfig/elpa-2019.05.002.pc
+lib/libelpa.so.17
+lib/libelpa.so.17.0.0
+libdata/pkgconfig/elpa.pc
 man/man1/elpa2_print_kernels.1.gz
 man/man3/elpa_allocate.3.gz
+man/man3/elpa_autotune_deallocate.3.gz
 man/man3/elpa_autotune_load_state.3.gz
 man/man3/elpa_autotune_print_state.3.gz
 man/man3/elpa_autotune_save_state.3.gz
+man/man3/elpa_autotune_set_best.3.gz
+man/man3/elpa_autotune_setup.3.gz
+man/man3/elpa_autotune_step.3.gz
 man/man3/elpa_cholesky.3.gz
 man/man3/elpa_deallocate.3.gz
 man/man3/elpa_eigenvalues.3.gz
+man/man3/elpa_eigenvalues_double.3.gz
+man/man3/elpa_eigenvalues_double_complex.3.gz
+man/man3/elpa_eigenvalues_float.3.gz
+man/man3/elpa_eigenvalues_float_complex.3.gz
 man/man3/elpa_eigenvectors.3.gz
+man/man3/elpa_eigenvectors_double.3.gz
+man/man3/elpa_eigenvectors_double_complex.3.gz
+man/man3/elpa_eigenvectors_float.3.gz
+man/man3/elpa_eigenvectors_float_complex.3.gz
 man/man3/elpa_generalized_eigenvalues.3.gz
 man/man3/elpa_generalized_eigenvectors.3.gz
 man/man3/elpa_hermitian_multiply.3.gz
@@ -38,6 +45,8 @@ man/man3/elpa_load_settings.3.gz
 man/man3/elpa_print_settings.3.gz
 man/man3/elpa_set.3.gz
 man/man3/elpa_setup.3.gz
+man/man3/elpa_skew_eigenvalues.3.gz
+man/man3/elpa_skew_eigenvectors.3.gz
 man/man3/elpa_solve_tridiagonal.3.gz
 man/man3/elpa_store_settings.3.gz
 man/man3/elpa_uninit.3.gz