git: 21918bf7f11d - 2022Q3 - math/elpa: Unbreak on systems prior to 13.1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 19 Jul 2022 08:11:42 UTC
The branch 2022Q3 has been updated by yuri:
URL: https://cgit.FreeBSD.org/ports/commit/?id=21918bf7f11d16819abd982aae2a8ad885b3d191
commit 21918bf7f11d16819abd982aae2a8ad885b3d191
Author: Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-07-18 05:21:33 +0000
Commit: Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-07-19 08:11:32 +0000
math/elpa: Unbreak on systems prior to 13.1
sched_getcpu() and sched_getaffinity() were added in 13.1
but the code used them unconditionally.
Reported by: build failure
(cherry picked from commit c7fe2fd1f66075a31d5b02046fea9e5ef583f2f6)
---
math/elpa/Makefile | 1 +
.../files/patch-src_helpers_check__thread__affinity.c | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/math/elpa/Makefile b/math/elpa/Makefile
index bce7ed9c98b6..4be23de3c3c6 100644
--- a/math/elpa/Makefile
+++ b/math/elpa/Makefile
@@ -23,6 +23,7 @@ CONFIGURE_ARGS= --disable-avx --disable-avx2 --disable-avx512 --disable-static \
--disable-c-tests
CFLAGS+= -I${WRKSRC} -I${WRKSRC}/private_modules
+CFLAGS+= -DFREEBSD_OSVERSION=${OSVERSION}
FCFLAGS+= -I${WRKSRC} -I${WRKSRC}/private_modules
LDFLAGS+= -lutil
diff --git a/math/elpa/files/patch-src_helpers_check__thread__affinity.c b/math/elpa/files/patch-src_helpers_check__thread__affinity.c
index 40db36a7cd7d..5561d206753e 100644
--- a/math/elpa/files/patch-src_helpers_check__thread__affinity.c
+++ b/math/elpa/files/patch-src_helpers_check__thread__affinity.c
@@ -1,6 +1,6 @@
--- src/helpers/check_thread_affinity.c.orig 2021-11-16 11:26:03 UTC
+++ src/helpers/check_thread_affinity.c
-@@ -47,11 +47,14 @@
+@@ -47,29 +47,41 @@
//
// Author: Andreas Marek, MPCDF
@@ -15,12 +15,21 @@
+#include <sys/cpuset.h>
#include <unistd.h>
++#if FREEBSD_OSVERSION >= 1301000
++# define HAVE_SCHED_FUNCS // sched_getcpu() and sched_getaffinity() were added in 13.1
++#endif
-@@ -60,11 +63,11 @@ void get_thread_affinity(int *cpu_id) {
+ void get_thread_affinity(int *cpu_id) {
++#if defined(HAVE_SCHED_FUNCS)
+ *cpu_id = sched_getcpu();
++#else
++ *cpu_id = 0;
++#endif
}
void get_process_affinity(int cpu_id) {
- cpu_set_t set;
++#if defined(HAVE_SCHED_FUNCS)
+ cpuset_t set;
int ret, i;
int cpu;
@@ -30,3 +39,9 @@
for (i=0; i < CPU_SETSIZE; i++)
{
cpu = CPU_ISSET(i, &set);
+ if (cpu == 1) { cpu_id = i; }
+ }
++#endif
+ }
+
+ void get_process_id(int *process_id, int *pprocess_id) {