pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
cpuinfo: more porting needed
Module Name: pkgsrc-wip
Committed By: Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By: wiz
Date: Mon Aug 4 19:11:15 2025 +0200
Changeset: a7f93795f71748039ab61f4b9f04edf10836a9c2
Modified Files:
cpuinfo/distinfo
cpuinfo/patches/patch-CMakeLists.txt
Added Files:
cpuinfo/patches/patch-src_freebsd_topology.c
cpuinfo/patches/patch-src_init.c
Log Message:
cpuinfo: more porting needed
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=a7f93795f71748039ab61f4b9f04edf10836a9c2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
cpuinfo/distinfo | 4 +++-
cpuinfo/patches/patch-CMakeLists.txt | 3 +--
cpuinfo/patches/patch-src_freebsd_topology.c | 28 ++++++++++++++++++++++++++++
cpuinfo/patches/patch-src_init.c | 15 +++++++++++++++
4 files changed, 47 insertions(+), 3 deletions(-)
diffs:
diff --git a/cpuinfo/distinfo b/cpuinfo/distinfo
index 6ff7361e14..b79c886d5c 100644
--- a/cpuinfo/distinfo
+++ b/cpuinfo/distinfo
@@ -9,4 +9,6 @@ Size (cpuinfo-0.0.20250724-33ed0be77d7767d0e2010e2c3cf972ef36c7c307.tar.gz) = 35
BLAKE2s (googletest-1.11.0.tar.gz) = 0b546cc02c7a8d6e15337b5dde02e2ff1c17bb5232212cba0b665ad47ff51eac
SHA512 (googletest-1.11.0.tar.gz) = 6fcc7827e4c4d95e3ae643dd65e6c4fc0e3d04e1778b84f6e06e390410fe3d18026c131d828d949d2f20dde6327d30ecee24dcd3ef919e21c91e010d149f3a28
Size (googletest-1.11.0.tar.gz) = 886330 bytes
-SHA1 (patch-CMakeLists.txt) = 607c0f8e3104634594493bbf251d0df084d17ff3
+SHA1 (patch-CMakeLists.txt) = 3cccda742be524e5c04191c0b397695b178a7871
+SHA1 (patch-src_freebsd_topology.c) = 55baf7a15de3e803e09171545c3d6ef1154b7129
+SHA1 (patch-src_init.c) = 064515df6f3108ccca0cc4f691e58edb7b0b967c
diff --git a/cpuinfo/patches/patch-CMakeLists.txt b/cpuinfo/patches/patch-CMakeLists.txt
index a0f33e3fcb..3ae7060c0e 100644
--- a/cpuinfo/patches/patch-CMakeLists.txt
+++ b/cpuinfo/patches/patch-CMakeLists.txt
@@ -1,7 +1,6 @@
$NetBSD$
-Handle NetBSD like FreeBSD.
-https://github.com/pytorch/cpuinfo/pull/314
+Handle NetBSD like FreeBSD (compiles, does not work).
--- CMakeLists.txt.orig 2025-07-24 17:36:24.000000000 +0000
+++ CMakeLists.txt
diff --git a/cpuinfo/patches/patch-src_freebsd_topology.c b/cpuinfo/patches/patch-src_freebsd_topology.c
new file mode 100644
index 0000000000..4a20d8a8f7
--- /dev/null
+++ b/cpuinfo/patches/patch-src_freebsd_topology.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+NetBSD support.
+
+--- src/freebsd/topology.c.orig 2025-07-24 17:36:24.000000000 +0000
++++ src/freebsd/topology.c
+@@ -50,6 +50,7 @@ struct cpuinfo_freebsd_topology cpuinfo_
+ .threads_per_core = 0,
+ .threads = 0,
+ };
++#if defined(__FreeBSD)
+ char* topology_spec = sysctl_str("kern.sched.topology_spec");
+ if (!topology_spec) {
+ return topology;
+@@ -94,6 +95,13 @@ struct cpuinfo_freebsd_topology cpuinfo_
+ topology.threads_per_core);
+ topology.threads = topology.threads_per_core * topology.cores;
+ return topology;
++#elif defined(__NetBSD__)
++ topology.cores = sysctl_int("hw.ncpu");
++ if (topology.cores == 0) {
++ goto fail;
++ }
++ return topology;
++#endif
+ fail:
+ topology.packages = 0;
+ return topology;
diff --git a/cpuinfo/patches/patch-src_init.c b/cpuinfo/patches/patch-src_init.c
new file mode 100644
index 0000000000..858cb222f6
--- /dev/null
+++ b/cpuinfo/patches/patch-src_init.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Handle NetBSD.
+
+--- src/init.c.orig 2025-08-04 14:52:02.012913325 +0000
++++ src/init.c
+@@ -24,7 +24,7 @@ bool CPUINFO_ABI cpuinfo_initialize(void
+ #if CPUINFO_ARCH_X86 || CPUINFO_ARCH_X86_64
+ #if defined(__MACH__) && defined(__APPLE__)
+ pthread_once(&init_guard, &cpuinfo_x86_mach_init);
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__NetBSD__)
+ pthread_once(&init_guard, &cpuinfo_x86_freebsd_init);
+ #elif defined(__linux__)
+ pthread_once(&init_guard, &cpuinfo_x86_linux_init);
Home |
Main Index |
Thread Index |
Old Index